Class Pipeline
Provides a CodePipeline.
NOTE on
aws.codepipeline.Pipeline: - theGITHUB_TOKENenvironment variable must be set if the GitHub provider is specified.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var codepipelineBucket = new Aws.S3.Bucket("codepipelineBucket", new Aws.S3.BucketArgs
{
Acl = "private",
});
var codepipelineRole = new Aws.Iam.Role("codepipelineRole", new Aws.Iam.RoleArgs
{
AssumeRolePolicy = @"{
""Version"": ""2012-10-17"",
""Statement"": [
{
""Effect"": ""Allow"",
""Principal"": {
""Service"": ""codepipeline.amazonaws.com""
},
""Action"": ""sts:AssumeRole""
}
]
}
",
});
var codepipelinePolicy = new Aws.Iam.RolePolicy("codepipelinePolicy", new Aws.Iam.RolePolicyArgs
{
Policy = Output.Tuple(codepipelineBucket.Arn, codepipelineBucket.Arn).Apply(values =>
{
var codepipelineBucketArn = values.Item1;
var codepipelineBucketArn1 = values.Item2;
return @$"{{
""Version"": ""2012-10-17"",
""Statement"": [
{{
""Effect"":""Allow"",
""Action"": [
""s3:GetObject"",
""s3:GetObjectVersion"",
""s3:GetBucketVersioning"",
""s3:PutObject""
],
""Resource"": [
""{codepipelineBucketArn}"",
""{codepipelineBucketArn1}/*""
]
}},
{{
""Effect"": ""Allow"",
""Action"": [
""codebuild:BatchGetBuilds"",
""codebuild:StartBuild""
],
""Resource"": ""*""
}}
]
}}
";
}),
Role = codepipelineRole.Id,
});
var s3kmskey = Output.Create(Aws.Kms.GetAlias.InvokeAsync(new Aws.Kms.GetAliasArgs
{
Name = "alias/myKmsKey",
}));
var codepipeline = new Aws.CodePipeline.Pipeline("codepipeline", new Aws.CodePipeline.PipelineArgs
{
ArtifactStore = new Aws.CodePipeline.Inputs.PipelineArtifactStoreArgs
{
EncryptionKey = new Aws.CodePipeline.Inputs.PipelineArtifactStoreEncryptionKeyArgs
{
Id = s3kmskey.Apply(s3kmskey => s3kmskey.Arn),
Type = "KMS",
},
Location = codepipelineBucket.BucketName,
Type = "S3",
},
RoleArn = codepipelineRole.Arn,
Stages =
{
new Aws.CodePipeline.Inputs.PipelineStageArgs
{
Action =
{
{
{ "category", "Source" },
{ "configuration",
{
{ "Branch", "master" },
{ "Owner", "my-organization" },
{ "Repo", "test" },
} },
{ "name", "Source" },
{ "outputArtifacts",
{
"source_output",
} },
{ "owner", "ThirdParty" },
{ "provider", "GitHub" },
{ "version", "1" },
},
},
Name = "Source",
},
new Aws.CodePipeline.Inputs.PipelineStageArgs
{
Action =
{
{
{ "category", "Build" },
{ "configuration",
{
{ "ProjectName", "test" },
} },
{ "inputArtifacts",
{
"source_output",
} },
{ "name", "Build" },
{ "outputArtifacts",
{
"build_output",
} },
{ "owner", "AWS" },
{ "provider", "CodeBuild" },
{ "version", "1" },
},
},
Name = "Build",
},
new Aws.CodePipeline.Inputs.PipelineStageArgs
{
Action =
{
{
{ "category", "Deploy" },
{ "configuration",
{
{ "ActionMode", "REPLACE_ON_FAILURE" },
{ "Capabilities", "CAPABILITY_AUTO_EXPAND,CAPABILITY_IAM" },
{ "OutputFileName", "CreateStackOutput.json" },
{ "StackName", "MyStack" },
{ "TemplatePath", "build_output::sam-templated.yaml" },
} },
{ "inputArtifacts",
{
"build_output",
} },
{ "name", "Deploy" },
{ "owner", "AWS" },
{ "provider", "CloudFormation" },
{ "version", "1" },
},
},
Name = "Deploy",
},
},
});
}
}
Inherited Members
Namespace: Pulumi.Aws.CodePipeline
Assembly: Pulumi.Aws.dll
Syntax
public class Pipeline : CustomResource
Constructors
View SourcePipeline(String, PipelineArgs, CustomResourceOptions)
Create a Pipeline resource with the given unique name, arguments, and options.
Declaration
public Pipeline(string name, PipelineArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| PipelineArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceArn
The codepipeline ARN.
Declaration
public Output<string> Arn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ArtifactStore
One or more artifact_store blocks. Artifact stores are documented below.
Declaration
public Output<PipelineArtifactStore> ArtifactStore { get; }
Property Value
| Type | Description |
|---|---|
| Output<PipelineArtifactStore> |
Name
The name of the pipeline.
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
RoleArn
A service role Amazon Resource Name (ARN) that grants AWS CodePipeline permission to make calls to AWS services on your behalf.
Declaration
public Output<string> RoleArn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Stages
A stage block. Stages are documented below.
Declaration
public Output<ImmutableArray<PipelineStage>> Stages { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<PipelineStage>> |
Tags
A map of tags to assign to the resource.
Declaration
public Output<ImmutableDictionary<string, object>> Tags { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.Object>> |
Methods
View SourceGet(String, Input<String>, PipelineState, CustomResourceOptions)
Get an existing Pipeline resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static Pipeline Get(string name, Input<string> id, PipelineState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| PipelineState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| Pipeline |