Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r/aws_codepipeline: Add arn attribute #2773

Merged
merged 1 commit into from
Dec 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions aws/resource_aws_codepipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ func resourceAwsCodePipeline() *schema.Resource {
},

Schema: map[string]*schema.Schema{
"arn": {
Type: schema.TypeString,
Computed: true,
},

"name": {
Type: schema.TypeString,
Required: true,
Expand Down Expand Up @@ -459,6 +464,7 @@ func resourceAwsCodePipelineRead(d *schema.ResourceData, meta interface{}) error
}
return fmt.Errorf("[ERROR] Error retreiving Pipeline: %q", err)
}
metadata := resp.Metadata
pipeline := resp.Pipeline

if err := d.Set("artifact_store", flattenAwsCodePipelineArtifactStore(pipeline.ArtifactStore)); err != nil {
Expand All @@ -469,6 +475,7 @@ func resourceAwsCodePipelineRead(d *schema.ResourceData, meta interface{}) error
return err
}

d.Set("arn", metadata.PipelineArn)
d.Set("name", pipeline.Name)
d.Set("role_arn", pipeline.RoleArn)
return nil
Expand Down
2 changes: 2 additions & 0 deletions aws/resource_aws_codepipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ func TestAccAWSCodePipeline_basic(t *testing.T) {
Config: testAccAWSCodePipelineConfig_basic(name),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSCodePipelineExists("aws_codepipeline.bar"),
resource.TestMatchResourceAttr("aws_codepipeline.bar", "arn",
regexp.MustCompile(fmt.Sprintf("^arn:aws:codepipeline:[^:]+:[0-9]{12}:test-pipeline-%s", name))),
resource.TestCheckResourceAttr("aws_codepipeline.bar", "artifact_store.0.type", "S3"),
resource.TestCheckResourceAttr("aws_codepipeline.bar", "artifact_store.0.encryption_key.0.id", "1234"),
resource.TestCheckResourceAttr("aws_codepipeline.bar", "artifact_store.0.encryption_key.0.type", "KMS"),
Expand Down
3 changes: 2 additions & 1 deletion website/docs/r/codepipeline.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,10 @@ A `action` block supports the following arguments:

## Attributes Reference

The following attributes are exported:
The following additional attributes are exported:

* `id` - The codepipeline ID.
* `arn` - The codepipeline ARN.

## Import

Expand Down