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

B aws ssm parameter arn #16618

Merged
merged 3 commits into from
Feb 12, 2021
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
13 changes: 2 additions & 11 deletions aws/data_source_aws_ssm_parameter.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ package aws
import (
"fmt"
"log"
"strings"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/arn"
"github.com/aws/aws-sdk-go/service/ssm"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand Down Expand Up @@ -63,16 +61,9 @@ func dataAwsSsmParameterRead(d *schema.ResourceData, meta interface{}) error {
}

param := resp.Parameter
d.SetId(aws.StringValue(param.Name))

arn := arn.ARN{
Partition: meta.(*AWSClient).partition,
Region: meta.(*AWSClient).region,
Service: "ssm",
AccountID: meta.(*AWSClient).accountid,
Resource: fmt.Sprintf("parameter/%s", strings.TrimPrefix(d.Id(), "/")),
}
d.Set("arn", arn.String())
d.SetId(aws.StringValue(param.Name))
d.Set("arn", param.ARN)
d.Set("name", param.Name)
d.Set("type", param.Type)
d.Set("value", param.Value)
Expand Down
11 changes: 1 addition & 10 deletions aws/resource_aws_ssm_parameter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import (
"context"
"fmt"
"log"
"strings"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/arn"
"github.com/aws/aws-sdk-go/service/ssm"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
Expand Down Expand Up @@ -197,14 +195,7 @@ func resourceAwsSsmParameterRead(d *schema.ResourceData, meta interface{}) error
return fmt.Errorf("error setting tags: %s", err)
}

arn := arn.ARN{
Partition: meta.(*AWSClient).partition,
Region: meta.(*AWSClient).region,
Service: "ssm",
AccountID: meta.(*AWSClient).accountid,
Resource: fmt.Sprintf("parameter/%s", strings.TrimPrefix(d.Id(), "/")),
}
d.Set("arn", arn.String())
d.Set("arn", param.ARN)

return nil
}
Expand Down