@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
229 lines • 8.64 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Pipeline = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* 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
* ```
*/
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, id, state, opts) {
return new Pipeline(name, state, { ...opts, id: id });
}
/**
* 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) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Pipeline.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["artifactStores"] = state?.artifactStores;
resourceInputs["executionMode"] = state?.executionMode;
resourceInputs["name"] = state?.name;
resourceInputs["pipelineType"] = state?.pipelineType;
resourceInputs["region"] = state?.region;
resourceInputs["roleArn"] = state?.roleArn;
resourceInputs["stages"] = state?.stages;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["triggerAlls"] = state?.triggerAlls;
resourceInputs["triggers"] = state?.triggers;
resourceInputs["variables"] = state?.variables;
}
else {
const args = argsOrState;
if (args?.artifactStores === undefined && !opts.urn) {
throw new Error("Missing required property 'artifactStores'");
}
if (args?.roleArn === undefined && !opts.urn) {
throw new Error("Missing required property 'roleArn'");
}
if (args?.stages === undefined && !opts.urn) {
throw new Error("Missing required property 'stages'");
}
resourceInputs["artifactStores"] = args?.artifactStores;
resourceInputs["executionMode"] = args?.executionMode;
resourceInputs["name"] = args?.name;
resourceInputs["pipelineType"] = args?.pipelineType;
resourceInputs["region"] = args?.region;
resourceInputs["roleArn"] = args?.roleArn;
resourceInputs["stages"] = args?.stages;
resourceInputs["tags"] = args?.tags;
resourceInputs["triggers"] = args?.triggers;
resourceInputs["variables"] = args?.variables;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
resourceInputs["triggerAlls"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Pipeline.__pulumiType, name, resourceInputs, opts);
}
}
exports.Pipeline = Pipeline;
/** @internal */
Pipeline.__pulumiType = 'aws:codepipeline/pipeline:Pipeline';
//# sourceMappingURL=pipeline.js.map