UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

346 lines (345 loc) • 14.1 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Provides a CodePipeline. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.codestarconnections.Connection("example", { * name: "example-connection", * providerType: "GitHub", * }); * const codepipelineBucket = new aws.s3.Bucket("codepipeline_bucket", {bucket: "test-bucket"}); * const assumeRole = aws.iam.getPolicyDocument({ * statements: [{ * effect: "Allow", * principals: [{ * type: "Service", * identifiers: ["codepipeline.amazonaws.com"], * }], * actions: ["sts:AssumeRole"], * }], * }); * const codepipelineRole = new aws.iam.Role("codepipeline_role", { * name: "test-role", * assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json), * }); * const s3kmskey = aws.kms.getAlias({ * name: "alias/myKmsKey", * }); * const codepipeline = new aws.codepipeline.Pipeline("codepipeline", { * name: "tf-test-pipeline", * roleArn: codepipelineRole.arn, * artifactStores: [{ * location: codepipelineBucket.bucket, * type: "S3", * encryptionKey: { * id: s3kmskey.then(s3kmskey => s3kmskey.arn), * type: "KMS", * }, * }], * stages: [ * { * name: "Source", * actions: [{ * name: "Source", * category: "Source", * owner: "AWS", * provider: "CodeStarSourceConnection", * version: "1", * outputArtifacts: ["source_output"], * configuration: { * ConnectionArn: example.arn, * FullRepositoryId: "my-organization/example", * BranchName: "main", * }, * }], * }, * { * name: "Build", * actions: [{ * name: "Build", * category: "Build", * owner: "AWS", * provider: "CodeBuild", * inputArtifacts: ["source_output"], * outputArtifacts: ["build_output"], * version: "1", * configuration: { * ProjectName: "test", * }, * }], * }, * { * name: "Deploy", * actions: [{ * name: "Deploy", * category: "Deploy", * owner: "AWS", * provider: "CloudFormation", * inputArtifacts: ["build_output"], * version: "1", * configuration: { * ActionMode: "REPLACE_ON_FAILURE", * Capabilities: "CAPABILITY_AUTO_EXPAND,CAPABILITY_IAM", * OutputFileName: "CreateStackOutput.json", * StackName: "MyStack", * TemplatePath: "build_output::sam-templated.yaml", * }, * }], * }, * ], * }); * const codepipelineBucketPab = new aws.s3.BucketPublicAccessBlock("codepipeline_bucket_pab", { * bucket: codepipelineBucket.id, * blockPublicAcls: true, * blockPublicPolicy: true, * ignorePublicAcls: true, * restrictPublicBuckets: true, * }); * const codepipelinePolicy = aws.iam.getPolicyDocumentOutput({ * statements: [ * { * effect: "Allow", * actions: [ * "s3:GetObject", * "s3:GetObjectVersion", * "s3:GetBucketVersioning", * "s3:PutObjectAcl", * "s3:PutObject", * ], * resources: [ * codepipelineBucket.arn, * pulumi.interpolate`${codepipelineBucket.arn}/*`, * ], * }, * { * effect: "Allow", * actions: ["codestar-connections:UseConnection"], * resources: [example.arn], * }, * { * effect: "Allow", * actions: [ * "codebuild:BatchGetBuilds", * "codebuild:StartBuild", * ], * resources: ["*"], * }, * ], * }); * const codepipelinePolicyRolePolicy = new aws.iam.RolePolicy("codepipeline_policy", { * name: "codepipeline_policy", * role: codepipelineRole.id, * policy: codepipelinePolicy.apply(codepipelinePolicy => codepipelinePolicy.json), * }); * ``` * * ## Import * * Using `pulumi import`, import CodePipelines using the `name`. For example: * * ```sh * $ pulumi import aws:codepipeline/pipeline:Pipeline example example-pipeline * ``` */ export declare class Pipeline extends pulumi.CustomResource { /** * Get an existing Pipeline resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: PipelineState, opts?: pulumi.CustomResourceOptions): Pipeline; /** * Returns true if the given object is an instance of Pipeline. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Pipeline; /** * Codepipeline ARN. */ readonly arn: pulumi.Output<string>; /** * One or more artifactStore blocks. Artifact stores are documented below. */ readonly artifactStores: pulumi.Output<outputs.codepipeline.PipelineArtifactStore[]>; /** * The method that the pipeline will use to handle multiple executions. The default mode is `SUPERSEDED`. For value values, refer to the [AWS documentation](https://docs.aws.amazon.com/codepipeline/latest/APIReference/API_PipelineDeclaration.html#CodePipeline-Type-PipelineDeclaration-executionMode). */ readonly executionMode: pulumi.Output<string | undefined>; /** * The name of the pipeline. */ readonly name: pulumi.Output<string>; /** * Type of the pipeline. Possible values are: `V1` and `V2`. Default value is `V1`. */ readonly pipelineType: pulumi.Output<string | undefined>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ readonly region: pulumi.Output<string>; /** * A service role Amazon Resource Name (ARN) that grants AWS CodePipeline permission to make calls to AWS services on your behalf. */ readonly roleArn: pulumi.Output<string>; /** * A stage block. Stages are documented below. */ readonly stages: pulumi.Output<outputs.codepipeline.PipelineStage[]>; /** * A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ readonly tags: pulumi.Output<{ [key: string]: string; } | undefined>; /** * A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. */ readonly tagsAll: pulumi.Output<{ [key: string]: string; }>; /** * A list of all triggers present on the pipeline, including default triggers added by AWS for `V2` pipelines which omit an explicit `trigger` definition. */ readonly triggerAlls: pulumi.Output<outputs.codepipeline.PipelineTriggerAll[]>; /** * A trigger block. Valid only when `pipelineType` is `V2`. Triggers are documented below. */ readonly triggers: pulumi.Output<outputs.codepipeline.PipelineTrigger[] | undefined>; /** * A pipeline-level variable block. Valid only when `pipelineType` is `V2`. Variable are documented below. * * **Note:** `QUEUED` or `PARALLEL` mode can only be used with V2 pipelines. */ readonly variables: pulumi.Output<outputs.codepipeline.PipelineVariable[] | undefined>; /** * Create a Pipeline resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: PipelineArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Pipeline resources. */ export interface PipelineState { /** * Codepipeline ARN. */ arn?: pulumi.Input<string>; /** * One or more artifactStore blocks. Artifact stores are documented below. */ artifactStores?: pulumi.Input<pulumi.Input<inputs.codepipeline.PipelineArtifactStore>[]>; /** * The method that the pipeline will use to handle multiple executions. The default mode is `SUPERSEDED`. For value values, refer to the [AWS documentation](https://docs.aws.amazon.com/codepipeline/latest/APIReference/API_PipelineDeclaration.html#CodePipeline-Type-PipelineDeclaration-executionMode). */ executionMode?: pulumi.Input<string>; /** * The name of the pipeline. */ name?: pulumi.Input<string>; /** * Type of the pipeline. Possible values are: `V1` and `V2`. Default value is `V1`. */ pipelineType?: pulumi.Input<string>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; /** * A service role Amazon Resource Name (ARN) that grants AWS CodePipeline permission to make calls to AWS services on your behalf. */ roleArn?: pulumi.Input<string>; /** * A stage block. Stages are documented below. */ stages?: pulumi.Input<pulumi.Input<inputs.codepipeline.PipelineStage>[]>; /** * A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. */ tagsAll?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * A list of all triggers present on the pipeline, including default triggers added by AWS for `V2` pipelines which omit an explicit `trigger` definition. */ triggerAlls?: pulumi.Input<pulumi.Input<inputs.codepipeline.PipelineTriggerAll>[]>; /** * A trigger block. Valid only when `pipelineType` is `V2`. Triggers are documented below. */ triggers?: pulumi.Input<pulumi.Input<inputs.codepipeline.PipelineTrigger>[]>; /** * A pipeline-level variable block. Valid only when `pipelineType` is `V2`. Variable are documented below. * * **Note:** `QUEUED` or `PARALLEL` mode can only be used with V2 pipelines. */ variables?: pulumi.Input<pulumi.Input<inputs.codepipeline.PipelineVariable>[]>; } /** * The set of arguments for constructing a Pipeline resource. */ export interface PipelineArgs { /** * One or more artifactStore blocks. Artifact stores are documented below. */ artifactStores: pulumi.Input<pulumi.Input<inputs.codepipeline.PipelineArtifactStore>[]>; /** * The method that the pipeline will use to handle multiple executions. The default mode is `SUPERSEDED`. For value values, refer to the [AWS documentation](https://docs.aws.amazon.com/codepipeline/latest/APIReference/API_PipelineDeclaration.html#CodePipeline-Type-PipelineDeclaration-executionMode). */ executionMode?: pulumi.Input<string>; /** * The name of the pipeline. */ name?: pulumi.Input<string>; /** * Type of the pipeline. Possible values are: `V1` and `V2`. Default value is `V1`. */ pipelineType?: pulumi.Input<string>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; /** * A service role Amazon Resource Name (ARN) that grants AWS CodePipeline permission to make calls to AWS services on your behalf. */ roleArn: pulumi.Input<string>; /** * A stage block. Stages are documented below. */ stages: pulumi.Input<pulumi.Input<inputs.codepipeline.PipelineStage>[]>; /** * A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * A trigger block. Valid only when `pipelineType` is `V2`. Triggers are documented below. */ triggers?: pulumi.Input<pulumi.Input<inputs.codepipeline.PipelineTrigger>[]>; /** * A pipeline-level variable block. Valid only when `pipelineType` is `V2`. Variable are documented below. * * **Note:** `QUEUED` or `PARALLEL` mode can only be used with V2 pipelines. */ variables?: pulumi.Input<pulumi.Input<inputs.codepipeline.PipelineVariable>[]>; }