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

add tag on create for aws_sqs_queue resource #10156

Merged
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: 12 additions & 1 deletion aws/resource_aws_sqs_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/service/sqs"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
Expand Down Expand Up @@ -170,6 +171,11 @@ func resourceAwsSqsQueueCreate(d *schema.ResourceData, meta interface{}) error {
QueueName: aws.String(name),
}

// Tag-on-create is currently only supported in AWS Commercial
if v, ok := d.GetOk("tags"); ok && meta.(*AWSClient).partition == endpoints.AwsPartitionID {
req.Tags = tagsFromMapGeneric(v.(map[string]interface{}))
}

attributes := make(map[string]*string)

queueResource := *resourceAwsSqsQueue()
Expand Down Expand Up @@ -215,7 +221,12 @@ func resourceAwsSqsQueueCreate(d *schema.ResourceData, meta interface{}) error {

d.SetId(aws.StringValue(output.QueueUrl))

return resourceAwsSqsQueueUpdate(d, meta)
// Tag-on-create is currently only supported in AWS Commercial
if meta.(*AWSClient).partition == endpoints.AwsPartitionID {
return resourceAwsSqsQueueRead(d, meta)
} else {
return resourceAwsSqsQueueUpdate(d, meta)
}
}

func resourceAwsSqsQueueUpdate(d *schema.ResourceData, meta interface{}) error {
Expand Down