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

[feat] add arn attribute to aws_codedeploy_deployment_config #35888

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions .changelog/35888.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_codedeploy_deployment_config: Add `arn` attribute
```
15 changes: 15 additions & 0 deletions internal/service/deploy/deployment_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ package deploy

import (
"context"
"fmt"
"log"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/aws/arn"
"github.com/aws/aws-sdk-go-v2/service/codedeploy"
"github.com/aws/aws-sdk-go-v2/service/codedeploy/types"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
Expand All @@ -32,6 +34,10 @@ func resourceDeploymentConfig() *schema.Resource {
},

Schema: map[string]*schema.Schema{
"arn": {
Type: schema.TypeString,
Computed: true,
},
"compute_platform": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -171,6 +177,15 @@ func resourceDeploymentConfigRead(ctx context.Context, d *schema.ResourceData, m
return sdkdiag.AppendErrorf(diags, "reading CodeDeploy Deployment Config (%s): %s", d.Id(), err)
}

deploymentConfigName := aws.ToString(deploymentConfig.DeploymentConfigName)
arn := arn.ARN{
Partition: meta.(*conns.AWSClient).Partition,
Service: "codedeploy",
Region: meta.(*conns.AWSClient).Region,
AccountID: meta.(*conns.AWSClient).AccountID,
Resource: fmt.Sprintf("deploymentconfig:%s", deploymentConfigName),
}.String()
d.Set("arn", arn)
d.Set("compute_platform", deploymentConfig.ComputePlatform)
d.Set("deployment_config_id", deploymentConfig.DeploymentConfigId)
d.Set("deployment_config_name", deploymentConfig.DeploymentConfigName)
Expand Down
1 change: 1 addition & 0 deletions internal/service/deploy/deployment_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func TestAccDeployDeploymentConfig_basic(t *testing.T) {
Config: testAccDeploymentConfigConfig_fleet(rName, 75),
Check: resource.ComposeTestCheckFunc(
testAccCheckDeploymentConfigExists(ctx, resourceName, &config1),
acctest.CheckResourceAttrRegionalARN(resourceName, "arn", "codedeploy", fmt.Sprintf("deploymentconfig:%s", rName)),
resource.TestCheckResourceAttr(resourceName, "deployment_config_name", rName),
resource.TestCheckResourceAttr(resourceName, "compute_platform", "Server"),
resource.TestCheckResourceAttr(resourceName, "traffic_routing_config.#", "0"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ The `time_based_linear` block supports the following:

This resource exports the following attributes in addition to the arguments above:

* `arn` - The ARN of the deployment config.
* `id` - The deployment group's config name.
* `deployment_config_id` - The AWS Assigned deployment config id

Expand Down
Loading