Example #1
0
def bootstrap(
    with_manual_approvals,
    puppet_code_pipeline_role_permission_boundary="arn:aws:iam::aws:policy/AdministratorAccess",
    source_role_permissions_boundary="arn:aws:iam::aws:policy/AdministratorAccess",
    puppet_generate_role_permission_boundary="arn:aws:iam::aws:policy/AdministratorAccess",
    puppet_deploy_role_permission_boundary="arn:aws:iam::aws:policy/AdministratorAccess",
    puppet_provisioning_role_permissions_boundary="arn:aws:iam::aws:policy/AdministratorAccess",
    cloud_formation_deploy_role_permissions_boundary="arn:aws:iam::aws:policy/AdministratorAccess",
):
    """
    Bootstrap the puppet account.  This will create the AWS CodeCommit repo containing the config and it will also
    create the AWS CodePipeline that will run the solution.

    :param with_manual_approvals: Boolean to specify whether there should be manual approvals before provisioning occurs
    :param puppet_code_pipeline_role_permission_boundary: IAM Boundary to apply to the role: PuppetCodePipelineRole
    :param source_role_permissions_boundary: IAM Boundary to apply to the role: SourceRole
    :param puppet_generate_role_permission_boundary: IAM Boundary to apply to the role: PuppetGenerateRole
    :param puppet_deploy_role_permission_boundary: IAM Boundary to apply to the role: PuppetDeployRole
    :param puppet_provisioning_role_permissions_boundary: IAM Boundary to apply to the role: PuppetProvisioningRole
    :param cloud_formation_deploy_role_permissions_boundary: IAM Boundary to apply to the role: CloudFormationDeployRole
    """
    core.bootstrap(
        with_manual_approvals,
        puppet_code_pipeline_role_permission_boundary,
        source_role_permissions_boundary,
        puppet_generate_role_permission_boundary,
        puppet_deploy_role_permission_boundary,
        puppet_provisioning_role_permissions_boundary,
        cloud_formation_deploy_role_permissions_boundary,
    )
def bootstrap(
    with_manual_approvals,
    puppet_code_pipeline_role_permission_boundary,
    source_role_permissions_boundary,
    puppet_generate_role_permission_boundary,
    puppet_deploy_role_permission_boundary,
    puppet_provisioning_role_permissions_boundary,
    cloud_formation_deploy_role_permissions_boundary,
    deploy_environment_compute_type,
    deploy_num_workers,
    source_provider,
    repository_name,
    branch_name,
    owner,
    repo,
    branch,
    poll_for_source_changes,
    webhook_secret,
):
    puppet_account_id = config.get_puppet_account_id()
    if source_provider == "CodeCommit":
        core.bootstrap(
            with_manual_approvals,
            puppet_account_id,
            puppet_code_pipeline_role_permission_boundary,
            source_role_permissions_boundary,
            puppet_generate_role_permission_boundary,
            puppet_deploy_role_permission_boundary,
            puppet_provisioning_role_permissions_boundary,
            cloud_formation_deploy_role_permissions_boundary,
            deploy_environment_compute_type,
            deploy_num_workers,
            source_provider,
            None,
            repository_name,
            branch_name,
            poll_for_source_changes,
            webhook_secret,
        )
    elif source_provider == "GitHub":
        core.bootstrap(
            with_manual_approvals,
            puppet_account_id,
            puppet_code_pipeline_role_permission_boundary,
            source_role_permissions_boundary,
            puppet_generate_role_permission_boundary,
            puppet_deploy_role_permission_boundary,
            puppet_provisioning_role_permissions_boundary,
            cloud_formation_deploy_role_permissions_boundary,
            deploy_environment_compute_type,
            deploy_num_workers,
            source_provider,
            owner,
            repo,
            branch,
            poll_for_source_changes,
            webhook_secret,
        )
    else:
        raise Exception(f"Unsupported source provider: {source_provider}")
Example #3
0
def bootstrap(with_manual_approvals):
    """
    Bootstrap the puppet account.  This will create the AWS CodeCommit repo containing the config and it will also
    create the AWS CodePipeline that will run the solution.

    :param with_manual_approvals: Boolean to specify whether there should be manual approvals before provisioning occurs
    """
    core.bootstrap(with_manual_approvals)
Example #4
0
def bootstrap(
    with_manual_approvals,
    puppet_code_pipeline_role_permission_boundary,
    source_role_permissions_boundary,
    puppet_generate_role_permission_boundary,
    puppet_deploy_role_permission_boundary,
    puppet_provisioning_role_permissions_boundary,
    cloud_formation_deploy_role_permissions_boundary,
):
    core.bootstrap(
        with_manual_approvals,
        puppet_code_pipeline_role_permission_boundary,
        source_role_permissions_boundary,
        puppet_generate_role_permission_boundary,
        puppet_deploy_role_permission_boundary,
        puppet_provisioning_role_permissions_boundary,
        cloud_formation_deploy_role_permissions_boundary,
    )
def bootstrap(
    with_manual_approvals,
    puppet_account_id,
    puppet_code_pipeline_role_permission_boundary="arn:aws:iam::aws:policy/AdministratorAccess",
    source_role_permissions_boundary="arn:aws:iam::aws:policy/AdministratorAccess",
    puppet_generate_role_permission_boundary="arn:aws:iam::aws:policy/AdministratorAccess",
    puppet_deploy_role_permission_boundary="arn:aws:iam::aws:policy/AdministratorAccess",
    puppet_provisioning_role_permissions_boundary="arn:aws:iam::aws:policy/AdministratorAccess",
    cloud_formation_deploy_role_permissions_boundary="arn:aws:iam::aws:policy/AdministratorAccess",
    deploy_environment_compute_type="BUILD_GENERAL1_SMALL",
    deploy_num_workers=10,
):
    """
    Bootstrap the puppet account.  This will create the AWS CodeCommit repo containing the config and it will also
    create the AWS CodePipeline that will run the solution.

    :param with_manual_approvals: Boolean to specify whether there should be manual approvals before provisioning occurs
    :param puppet_account_id: AWS Account Id for your puppet account
    :param puppet_code_pipeline_role_permission_boundary: IAM Boundary to apply to the role: PuppetCodePipelineRole
    :param source_role_permissions_boundary: IAM Boundary to apply to the role: SourceRole
    :param puppet_generate_role_permission_boundary: IAM Boundary to apply to the role: PuppetGenerateRole
    :param puppet_deploy_role_permission_boundary: IAM Boundary to apply to the role: PuppetDeployRole
    :param puppet_provisioning_role_permissions_boundary: IAM Boundary to apply to the role: PuppetProvisioningRole
    :param cloud_formation_deploy_role_permissions_boundary: IAM Boundary to apply to the role: CloudFormationDeployRole
    :param deploy_environment_compute_type: The AWS CodeBuild Environment Compute Type
    :param deploy_num_workers: Number of workers that should be used when running a deploy
    """

    core.bootstrap(
        with_manual_approvals,
        puppet_account_id,
        puppet_code_pipeline_role_permission_boundary,
        source_role_permissions_boundary,
        puppet_generate_role_permission_boundary,
        puppet_deploy_role_permission_boundary,
        puppet_provisioning_role_permissions_boundary,
        cloud_formation_deploy_role_permissions_boundary,
        deploy_environment_compute_type,
        deploy_num_workers,
    )
Example #6
0
def bootstrap(
    with_manual_approvals,
    puppet_code_pipeline_role_permission_boundary,
    source_role_permissions_boundary,
    puppet_generate_role_permission_boundary,
    puppet_deploy_role_permission_boundary,
    puppet_provisioning_role_permissions_boundary,
    cloud_formation_deploy_role_permissions_boundary,
    deploy_environment_compute_type,
    deploy_num_workers,
):
    core.bootstrap(
        with_manual_approvals,
        puppet_code_pipeline_role_permission_boundary,
        source_role_permissions_boundary,
        puppet_generate_role_permission_boundary,
        puppet_deploy_role_permission_boundary,
        puppet_provisioning_role_permissions_boundary,
        cloud_formation_deploy_role_permissions_boundary,
        deploy_environment_compute_type,
        deploy_num_workers,
    )
Example #7
0
def bootstrap(with_manual_approvals):
    core.bootstrap(with_manual_approvals)
def bootstrap(
    with_manual_approvals,
    puppet_code_pipeline_role_permission_boundary,
    source_role_permissions_boundary,
    puppet_generate_role_permission_boundary,
    puppet_deploy_role_permission_boundary,
    puppet_provisioning_role_permissions_boundary,
    cloud_formation_deploy_role_permissions_boundary,
    deploy_environment_compute_type,
    deploy_num_workers,
    source_provider,
    repository_name,
    branch_name,
    owner,
    repo,
    branch,
    poll_for_source_changes,
    webhook_secret,
    puppet_role_name,
    puppet_role_path,
    scm_connection_arn,
    scm_full_repository_id,
    scm_branch_name,
    scm_bucket_name,
    scm_object_key,
    create_repo,
):
    puppet_account_id = config.get_puppet_account_id()

    parameters = dict(
        with_manual_approvals=with_manual_approvals,
        puppet_account_id=puppet_account_id,
        puppet_code_pipeline_role_permission_boundary=
        puppet_code_pipeline_role_permission_boundary,
        source_role_permissions_boundary=source_role_permissions_boundary,
        puppet_generate_role_permission_boundary=
        puppet_generate_role_permission_boundary,
        puppet_deploy_role_permission_boundary=
        puppet_deploy_role_permission_boundary,
        puppet_provisioning_role_permissions_boundary=
        puppet_provisioning_role_permissions_boundary,
        cloud_formation_deploy_role_permissions_boundary=
        cloud_formation_deploy_role_permissions_boundary,
        deploy_environment_compute_type=deploy_environment_compute_type,
        deploy_num_workers=deploy_num_workers,
        source_provider=source_provider,
        owner=None,
        repo=None,
        branch=None,
        poll_for_source_changes=poll_for_source_changes,
        webhook_secret=webhook_secret,
        puppet_role_name=puppet_role_name,
        puppet_role_path=puppet_role_path,
        scm_connection_arn=None,
        scm_full_repository_id=None,
        scm_branch_name=None,
        scm_bucket_name=None,
        scm_object_key=None,
        scm_skip_creation_of_repo=not create_repo,
    )
    if source_provider == "CodeCommit":
        parameters.update(dict(
            repo=repository_name,
            branch=branch_name,
        ))
    elif source_provider == "GitHub":
        parameters.update(
            dict(
                owner=owner,
                repo=repo,
                branch=branch,
                webhook_secret=webhook_secret,
            ))
    elif source_provider == "CodeStarSourceConnection":
        parameters.update(
            dict(
                scm_connection_arn=scm_connection_arn,
                scm_full_repository_id=scm_full_repository_id,
                scm_branch_name=scm_branch_name,
            ))
    elif source_provider == "S3":
        parameters.update(
            dict(
                scm_bucket_name=scm_bucket_name,
                scm_object_key=scm_object_key,
            ))
    else:
        raise Exception(f"Unsupported source provider: {source_provider}")

    core.bootstrap(**parameters)