diff --git a/aws/resource_aws_s3_bucket.go b/aws/resource_aws_s3_bucket.go index a0405a65522..47c868260dc 100644 --- a/aws/resource_aws_s3_bucket.go +++ b/aws/resource_aws_s3_bucket.go @@ -625,8 +625,11 @@ func resourceAwsS3Bucket() *schema.Resource { }, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, + + CustomizeDiff: SetTagsDiff, } } @@ -708,8 +711,8 @@ func resourceAwsS3BucketCreate(d *schema.ResourceData, meta interface{}) error { func resourceAwsS3BucketUpdate(d *schema.ResourceData, meta interface{}) error { s3conn := meta.(*AWSClient).s3conn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") // Retry due to S3 eventual consistency _, err := retryOnAwsCode(s3.ErrCodeNoSuchBucket, func() (interface{}, error) { @@ -803,6 +806,7 @@ func resourceAwsS3BucketUpdate(d *schema.ResourceData, meta interface{}) error { func resourceAwsS3BucketRead(d *schema.ResourceData, meta interface{}) error { s3conn := meta.(*AWSClient).s3conn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig input := &s3.HeadBucketInput{ @@ -1322,7 +1326,7 @@ func resourceAwsS3BucketRead(d *schema.ResourceData, meta interface{}) error { } // Retry due to S3 eventual consistency - tags, err := retryOnAwsCode(s3.ErrCodeNoSuchBucket, func() (interface{}, error) { + tagsRaw, err := retryOnAwsCode(s3.ErrCodeNoSuchBucket, func() (interface{}, error) { return keyvaluetags.S3BucketListTags(s3conn, d.Id()) }) @@ -1330,8 +1334,21 @@ func resourceAwsS3BucketRead(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("error listing tags for S3 Bucket (%s): %s", d.Id(), err) } - if err := d.Set("tags", tags.(keyvaluetags.KeyValueTags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags, ok := tagsRaw.(keyvaluetags.KeyValueTags) + + if !ok { + return fmt.Errorf("error listing tags for S3 Bucket (%s): unable to convert tags", d.Id()) + } + + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } arn := arn.ARN{ diff --git a/aws/resource_aws_s3_bucket_object.go b/aws/resource_aws_s3_bucket_object.go index d5beb802669..4f90ae35c8c 100644 --- a/aws/resource_aws_s3_bucket_object.go +++ b/aws/resource_aws_s3_bucket_object.go @@ -15,6 +15,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/kms" "github.com/aws/aws-sdk-go/service/s3" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" @@ -32,7 +33,10 @@ func resourceAwsS3BucketObject() *schema.Resource { Update: resourceAwsS3BucketObjectUpdate, Delete: resourceAwsS3BucketObjectDelete, - CustomizeDiff: resourceAwsS3BucketObjectCustomizeDiff, + CustomizeDiff: customdiff.Sequence( + resourceAwsS3BucketObjectCustomizeDiff, + SetTagsDiff, + ), Schema: map[string]*schema.Schema{ "bucket": { @@ -156,7 +160,8 @@ func resourceAwsS3BucketObject() *schema.Resource { Computed: true, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), "website_redirect": { Type: schema.TypeString, @@ -192,6 +197,8 @@ func resourceAwsS3BucketObject() *schema.Resource { func resourceAwsS3BucketObjectPut(d *schema.ResourceData, meta interface{}) error { s3conn := meta.(*AWSClient).s3conn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) var body io.ReadSeeker @@ -278,9 +285,9 @@ func resourceAwsS3BucketObjectPut(d *schema.ResourceData, meta interface{}) erro putInput.ServerSideEncryption = aws.String(s3.ServerSideEncryptionAwsKms) } - if v := d.Get("tags").(map[string]interface{}); len(v) > 0 { + if len(tags) > 0 { // The tag-set must be encoded as URL Query parameters. - putInput.Tagging = aws.String(keyvaluetags.New(v).IgnoreAws().UrlEncode()) + putInput.Tagging = aws.String(tags.IgnoreAws().UrlEncode()) } if v, ok := d.GetOk("website_redirect"); ok { @@ -313,6 +320,7 @@ func resourceAwsS3BucketObjectCreate(d *schema.ResourceData, meta interface{}) e func resourceAwsS3BucketObjectRead(d *schema.ResourceData, meta interface{}) error { s3conn := meta.(*AWSClient).s3conn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig bucket := d.Get("bucket").(string) @@ -396,7 +404,7 @@ func resourceAwsS3BucketObjectRead(d *schema.ResourceData, meta interface{}) err } // Retry due to S3 eventual consistency - tags, err := retryOnAwsCode(s3.ErrCodeNoSuchBucket, func() (interface{}, error) { + tagsRaw, err := retryOnAwsCode(s3.ErrCodeNoSuchBucket, func() (interface{}, error) { return keyvaluetags.S3ObjectListTags(s3conn, bucket, key) }) @@ -404,8 +412,21 @@ func resourceAwsS3BucketObjectRead(d *schema.ResourceData, meta interface{}) err return fmt.Errorf("error listing tags for S3 Bucket (%s) Object (%s): %s", bucket, key, err) } - if err := d.Set("tags", tags.(keyvaluetags.KeyValueTags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags, ok := tagsRaw.(keyvaluetags.KeyValueTags) + + if !ok { + return fmt.Errorf("error listing tags for S3 Bucket (%s) Object (%s): unable to convert tags", bucket, key) + } + + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } return nil @@ -471,8 +492,8 @@ func resourceAwsS3BucketObjectUpdate(d *schema.ResourceData, meta interface{}) e } } - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.S3ObjectUpdateTags(conn, bucket, key, o, n); err != nil { return fmt.Errorf("error updating tags: %s", err) diff --git a/aws/resource_aws_s3_object_copy.go b/aws/resource_aws_s3_object_copy.go index 033e8eeae77..7a56db9a137 100644 --- a/aws/resource_aws_s3_object_copy.go +++ b/aws/resource_aws_s3_object_copy.go @@ -270,7 +270,8 @@ func resourceAwsS3ObjectCopy() *schema.Resource { Optional: true, ValidateFunc: validation.StringInSlice(s3.TaggingDirective_Values(), false), }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), "version_id": { Type: schema.TypeString, Computed: true, @@ -281,6 +282,8 @@ func resourceAwsS3ObjectCopy() *schema.Resource { Computed: true, }, }, + + CustomizeDiff: SetTagsDiff, } } @@ -290,6 +293,7 @@ func resourceAwsS3ObjectCopyCreate(d *schema.ResourceData, meta interface{}) err func resourceAwsS3ObjectCopyRead(d *schema.ResourceData, meta interface{}) error { s3conn := meta.(*AWSClient).s3conn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig bucket := d.Get("bucket").(string) @@ -356,7 +360,7 @@ func resourceAwsS3ObjectCopyRead(d *schema.ResourceData, meta interface{}) error } // Retry due to S3 eventual consistency - tags, err := retryOnAwsCode(s3.ErrCodeNoSuchBucket, func() (interface{}, error) { + tagsRaw, err := retryOnAwsCode(s3.ErrCodeNoSuchBucket, func() (interface{}, error) { return keyvaluetags.S3ObjectListTags(s3conn, bucket, key) }) @@ -364,10 +368,23 @@ func resourceAwsS3ObjectCopyRead(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("error listing tags for S3 Bucket (%s) Object (%s): %w", bucket, key, err) } - if err := d.Set("tags", tags.(keyvaluetags.KeyValueTags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags, ok := tagsRaw.(keyvaluetags.KeyValueTags) + + if !ok { + return fmt.Errorf("error listing tags for S3 Bucket (%s) Object (%s): unable to convert tags", bucket, key) + } + + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %w", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) + } + return nil } @@ -417,6 +434,7 @@ func resourceAwsS3ObjectCopyUpdate(d *schema.ResourceData, meta interface{}) err "storage_class", "tagging_directive", "tags", + "tags_all", "website_redirect", } if d.HasChanges(args...) { @@ -451,6 +469,8 @@ func resourceAwsS3ObjectCopyDelete(d *schema.ResourceData, meta interface{}) err func resourceAwsS3ObjectCopyDoCopy(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).s3conn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) input := &s3.CopyObjectInput{ Bucket: aws.String(d.Get("bucket").(string)), @@ -592,9 +612,9 @@ func resourceAwsS3ObjectCopyDoCopy(d *schema.ResourceData, meta interface{}) err input.TaggingDirective = aws.String(v.(string)) } - if v := d.Get("tags").(map[string]interface{}); len(v) > 0 { + if len(tags) > 0 { // The tag-set must be encoded as URL Query parameters. - input.Tagging = aws.String(keyvaluetags.New(v).IgnoreAws().UrlEncode()) + input.Tagging = aws.String(tags.IgnoreAws().UrlEncode()) } if v, ok := d.GetOk("website_redirect"); ok { diff --git a/aws/resource_aws_s3control_bucket.go b/aws/resource_aws_s3control_bucket.go index ce79b9d8114..1caaefd52a7 100644 --- a/aws/resource_aws_s3control_bucket.go +++ b/aws/resource_aws_s3control_bucket.go @@ -64,13 +64,18 @@ func resourceAwsS3ControlBucket() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsS3ControlBucketCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).s3controlconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) bucket := d.Get("bucket").(string) @@ -91,8 +96,8 @@ func resourceAwsS3ControlBucketCreate(d *schema.ResourceData, meta interface{}) d.SetId(aws.StringValue(output.BucketArn)) - if v := d.Get("tags").(map[string]interface{}); len(v) > 0 { - if err := keyvaluetags.S3controlBucketUpdateTags(conn, d.Id(), nil, v); err != nil { + if len(tags) > 0 { + if err := keyvaluetags.S3controlBucketUpdateTags(conn, d.Id(), nil, tags); err != nil { return fmt.Errorf("error adding S3 Control Bucket (%s) tags: %w", d.Id(), err) } } @@ -102,6 +107,7 @@ func resourceAwsS3ControlBucketCreate(d *schema.ResourceData, meta interface{}) func resourceAwsS3ControlBucketRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).s3controlconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig parsedArn, err := arn.Parse(d.Id()) @@ -160,18 +166,25 @@ func resourceAwsS3ControlBucketRead(d *schema.ResourceData, meta interface{}) er return fmt.Errorf("error listing tags for S3 Control Bucket (%s): %w", d.Id(), err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %w", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) + } + return nil } func resourceAwsS3ControlBucketUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).s3controlconn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.S3controlBucketUpdateTags(conn, d.Id(), o, n); err != nil { return fmt.Errorf("error updating S3 Control Bucket (%s) tags: %w", d.Id(), err) diff --git a/aws/resource_aws_sagemaker_app.go b/aws/resource_aws_sagemaker_app.go index 2d921b87090..108256a5cd0 100644 --- a/aws/resource_aws_sagemaker_app.go +++ b/aws/resource_aws_sagemaker_app.go @@ -73,18 +73,23 @@ func resourceAwsSagemakerApp() *schema.Resource { }, }, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), "user_profile_name": { Type: schema.TypeString, ForceNew: true, Required: true, }, }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsSagemakerAppCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) input := &sagemaker.CreateAppInput{ AppName: aws.String(d.Get("app_name").(string)), @@ -93,8 +98,8 @@ func resourceAwsSagemakerAppCreate(d *schema.ResourceData, meta interface{}) err UserProfileName: aws.String(d.Get("user_profile_name").(string)), } - if v, ok := d.GetOk("tags"); ok { - input.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().SagemakerTags() + if len(tags) > 0 { + input.Tags = tags.IgnoreAws().SagemakerTags() } if v, ok := d.GetOk("resource_spec"); ok { @@ -124,6 +129,7 @@ func resourceAwsSagemakerAppCreate(d *schema.ResourceData, meta interface{}) err func resourceAwsSagemakerAppRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig domainID, userProfileName, appType, appName, err := decodeSagemakerAppID(d.Id()) @@ -164,18 +170,25 @@ func resourceAwsSagemakerAppRead(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("error listing tags for SageMaker App (%s): %w", d.Id(), err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %w", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) + } + return nil } func resourceAwsSagemakerAppUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SagemakerUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating SageMaker App (%s) tags: %w", d.Id(), err) diff --git a/aws/resource_aws_sagemaker_domain.go b/aws/resource_aws_sagemaker_domain.go index 7f125e4aebe..4ca348eb607 100644 --- a/aws/resource_aws_sagemaker_domain.go +++ b/aws/resource_aws_sagemaker_domain.go @@ -224,7 +224,8 @@ func resourceAwsSagemakerDomain() *schema.Resource { }, }, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), "url": { Type: schema.TypeString, Computed: true, @@ -238,11 +239,15 @@ func resourceAwsSagemakerDomain() *schema.Resource { Computed: true, }, }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsSagemakerDomainCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) input := &sagemaker.CreateDomainInput{ DomainName: aws.String(d.Get("domain_name").(string)), @@ -253,8 +258,8 @@ func resourceAwsSagemakerDomainCreate(d *schema.ResourceData, meta interface{}) DefaultUserSettings: expandSagemakerDomainDefaultUserSettings(d.Get("default_user_settings").([]interface{})), } - if v, ok := d.GetOk("tags"); ok { - input.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().SagemakerTags() + if len(tags) > 0 { + input.Tags = tags.IgnoreAws().SagemakerTags() } if v, ok := d.GetOk("kms_key_id"); ok { @@ -284,6 +289,7 @@ func resourceAwsSagemakerDomainCreate(d *schema.ResourceData, meta interface{}) func resourceAwsSagemakerDomainRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig domain, err := finder.DomainByName(conn, d.Id()) @@ -321,10 +327,17 @@ func resourceAwsSagemakerDomainRead(d *schema.ResourceData, meta interface{}) er return fmt.Errorf("error listing tags for SageMaker Domain (%s): %w", d.Id(), err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %w", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) + } + return nil } @@ -348,8 +361,8 @@ func resourceAwsSagemakerDomainUpdate(d *schema.ResourceData, meta interface{}) } } - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SagemakerUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating SageMaker domain (%s) tags: %w", d.Id(), err) diff --git a/aws/resource_aws_sagemaker_endpoint.go b/aws/resource_aws_sagemaker_endpoint.go index 2193222c309..6597b09daff 100644 --- a/aws/resource_aws_sagemaker_endpoint.go +++ b/aws/resource_aws_sagemaker_endpoint.go @@ -41,13 +41,18 @@ func resourceAwsSagemakerEndpoint() *schema.Resource { ValidateFunc: validateSagemakerName, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsSagemakerEndpointCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) var name string if v, ok := d.GetOk("name"); ok { @@ -61,8 +66,8 @@ func resourceAwsSagemakerEndpointCreate(d *schema.ResourceData, meta interface{} EndpointConfigName: aws.String(d.Get("endpoint_config_name").(string)), } - if v, ok := d.GetOk("tags"); ok { - createOpts.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().SagemakerTags() + if len(tags) > 0 { + createOpts.Tags = tags.IgnoreAws().SagemakerTags() } log.Printf("[DEBUG] SageMaker Endpoint create config: %#v", *createOpts) @@ -86,6 +91,7 @@ func resourceAwsSagemakerEndpointCreate(d *schema.ResourceData, meta interface{} func resourceAwsSagemakerEndpointRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig describeInput := &sagemaker.DescribeEndpointInput{ @@ -123,8 +129,15 @@ func resourceAwsSagemakerEndpointRead(d *schema.ResourceData, meta interface{}) return fmt.Errorf("error listing tags for Sagemaker Endpoint (%s): %s", d.Id(), err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } return nil @@ -133,8 +146,8 @@ func resourceAwsSagemakerEndpointRead(d *schema.ResourceData, meta interface{}) func resourceAwsSagemakerEndpointUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SagemakerUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating Sagemaker Endpoint (%s) tags: %s", d.Id(), err) diff --git a/aws/resource_aws_sagemaker_endpoint_configuration.go b/aws/resource_aws_sagemaker_endpoint_configuration.go index 3f2cd84adb8..347b5edc593 100644 --- a/aws/resource_aws_sagemaker_endpoint_configuration.go +++ b/aws/resource_aws_sagemaker_endpoint_configuration.go @@ -94,7 +94,8 @@ func resourceAwsSagemakerEndpointConfiguration() *schema.Resource { ValidateFunc: validateArn, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), "data_capture_config": { Type: schema.TypeList, @@ -192,11 +193,15 @@ func resourceAwsSagemakerEndpointConfiguration() *schema.Resource { }, }, }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsSagemakerEndpointConfigurationCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) var name string if v, ok := d.GetOk("name"); ok { @@ -214,8 +219,8 @@ func resourceAwsSagemakerEndpointConfigurationCreate(d *schema.ResourceData, met createOpts.KmsKeyId = aws.String(v.(string)) } - if v, ok := d.GetOk("tags"); ok { - createOpts.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().SagemakerTags() + if len(tags) > 0 { + createOpts.Tags = tags.IgnoreAws().SagemakerTags() } if v, ok := d.GetOk("data_capture_config"); ok { @@ -234,6 +239,7 @@ func resourceAwsSagemakerEndpointConfigurationCreate(d *schema.ResourceData, met func resourceAwsSagemakerEndpointConfigurationRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig request := &sagemaker.DescribeEndpointConfigInput{ @@ -271,8 +277,15 @@ func resourceAwsSagemakerEndpointConfigurationRead(d *schema.ResourceData, meta return fmt.Errorf("error listing tags for Sagemaker Endpoint Configuration (%s): %s", d.Id(), err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } return nil @@ -281,8 +294,8 @@ func resourceAwsSagemakerEndpointConfigurationRead(d *schema.ResourceData, meta func resourceAwsSagemakerEndpointConfigurationUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SagemakerUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating Sagemaker Endpoint Configuration (%s) tags: %s", d.Id(), err) diff --git a/aws/resource_aws_sagemaker_feature_group.go b/aws/resource_aws_sagemaker_feature_group.go index 56638c201c9..48804a817bc 100644 --- a/aws/resource_aws_sagemaker_feature_group.go +++ b/aws/resource_aws_sagemaker_feature_group.go @@ -188,13 +188,18 @@ func resourceAwsSagemakerFeatureGroup() *schema.Resource { }, }, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsSagemakerFeatureGroupCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) name := d.Get("feature_group_name").(string) @@ -210,8 +215,8 @@ func resourceAwsSagemakerFeatureGroupCreate(d *schema.ResourceData, meta interfa input.Description = aws.String(v.(string)) } - if v, ok := d.GetOk("tags"); ok { - input.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().SagemakerTags() + if len(tags) > 0 { + input.Tags = tags.IgnoreAws().SagemakerTags() } if v, ok := d.GetOk("offline_store_config"); ok { @@ -256,6 +261,7 @@ func resourceAwsSagemakerFeatureGroupCreate(d *schema.ResourceData, meta interfa func resourceAwsSagemakerFeatureGroupRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig output, err := finder.FeatureGroupByName(conn, d.Id()) @@ -294,18 +300,25 @@ func resourceAwsSagemakerFeatureGroupRead(d *schema.ResourceData, meta interface return fmt.Errorf("error listing tags for Sagemaker Feature Group (%s): %w", d.Id(), err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %w", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) + } + return nil } func resourceAwsSagemakerFeatureGroupUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SagemakerUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating SageMaker Feature Group (%s) tags: %w", d.Id(), err) diff --git a/aws/resource_aws_sagemaker_image.go b/aws/resource_aws_sagemaker_image.go index d8d7afd5b62..8b5190f0f21 100644 --- a/aws/resource_aws_sagemaker_image.go +++ b/aws/resource_aws_sagemaker_image.go @@ -56,13 +56,18 @@ func resourceAwsSagemakerImage() *schema.Resource { Optional: true, ValidateFunc: validation.StringLenBetween(1, 512), }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsSagemakerImageCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) name := d.Get("image_name").(string) input := &sagemaker.CreateImageInput{ @@ -78,8 +83,8 @@ func resourceAwsSagemakerImageCreate(d *schema.ResourceData, meta interface{}) e input.Description = aws.String(v.(string)) } - if v, ok := d.GetOk("tags"); ok { - input.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().SagemakerTags() + if len(tags) > 0 { + input.Tags = tags.IgnoreAws().SagemakerTags() } // for some reason even if the operation is retried the same error response is given even though the role is valid. a short sleep before creation solves it. @@ -100,6 +105,7 @@ func resourceAwsSagemakerImageCreate(d *schema.ResourceData, meta interface{}) e func resourceAwsSagemakerImageRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig image, err := finder.ImageByName(conn, d.Id()) @@ -126,10 +132,17 @@ func resourceAwsSagemakerImageRead(d *schema.ResourceData, meta interface{}) err return fmt.Errorf("error listing tags for SageMaker Image (%s): %w", d.Id(), err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %w", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) + } + return nil } @@ -175,8 +188,8 @@ func resourceAwsSagemakerImageUpdate(d *schema.ResourceData, meta interface{}) e } } - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SagemakerUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating SageMaker Image (%s) tags: %s", d.Id(), err) diff --git a/aws/resource_aws_sagemaker_model.go b/aws/resource_aws_sagemaker_model.go index 100c1e35eac..1bf6f5a891e 100644 --- a/aws/resource_aws_sagemaker_model.go +++ b/aws/resource_aws_sagemaker_model.go @@ -192,13 +192,18 @@ func resourceAwsSagemakerModel() *schema.Resource { }, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsSagemakerModelCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) var name string if v, ok := d.GetOk("name"); ok { @@ -223,8 +228,8 @@ func resourceAwsSagemakerModelCreate(d *schema.ResourceData, meta interface{}) e createOpts.ExecutionRoleArn = aws.String(v.(string)) } - if v, ok := d.GetOk("tags"); ok { - createOpts.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().SagemakerTags() + if len(tags) > 0 { + createOpts.Tags = tags.IgnoreAws().SagemakerTags() } if v, ok := d.GetOk("vpc_config"); ok { @@ -263,6 +268,7 @@ func expandSageMakerVpcConfigRequest(l []interface{}) *sagemaker.VpcConfig { func resourceAwsSagemakerModelRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig request := &sagemaker.DescribeModelInput{ @@ -306,10 +312,17 @@ func resourceAwsSagemakerModelRead(d *schema.ResourceData, meta interface{}) err return fmt.Errorf("error listing tags for Sagemaker Model (%s): %w", d.Id(), err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %w", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) + } + return nil } @@ -329,8 +342,8 @@ func flattenSageMakerVpcConfigResponse(vpcConfig *sagemaker.VpcConfig) []map[str func resourceAwsSagemakerModelUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SagemakerUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating Sagemaker Model (%s) tags: %w", d.Id(), err) diff --git a/aws/resource_aws_sagemaker_model_package_group.go b/aws/resource_aws_sagemaker_model_package_group.go index 06a655df984..bf59efcb912 100644 --- a/aws/resource_aws_sagemaker_model_package_group.go +++ b/aws/resource_aws_sagemaker_model_package_group.go @@ -45,13 +45,18 @@ func resourceAwsSagemakerModelPackageGroup() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 1024), }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsSagemakerModelPackageGroupCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) name := d.Get("model_package_group_name").(string) input := &sagemaker.CreateModelPackageGroupInput{ @@ -62,8 +67,8 @@ func resourceAwsSagemakerModelPackageGroupCreate(d *schema.ResourceData, meta in input.ModelPackageGroupDescription = aws.String(v.(string)) } - if v, ok := d.GetOk("tags"); ok { - input.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().SagemakerTags() + if len(tags) > 0 { + input.Tags = tags.IgnoreAws().SagemakerTags() } _, err := conn.CreateModelPackageGroup(input) @@ -82,6 +87,7 @@ func resourceAwsSagemakerModelPackageGroupCreate(d *schema.ResourceData, meta in func resourceAwsSagemakerModelPackageGroupRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig mpg, err := finder.ModelPackageGroupByName(conn, d.Id()) @@ -106,18 +112,25 @@ func resourceAwsSagemakerModelPackageGroupRead(d *schema.ResourceData, meta inte return fmt.Errorf("error listing tags for SageMaker Model Package Group (%s): %w", d.Id(), err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %w", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) + } + return nil } func resourceAwsSagemakerModelPackageGroupUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SagemakerUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating SageMaker Model Package Group (%s) tags: %s", d.Id(), err) diff --git a/aws/resource_aws_sagemaker_notebook_instance.go b/aws/resource_aws_sagemaker_notebook_instance.go index 1b0e3486317..7e829d9a809 100644 --- a/aws/resource_aws_sagemaker_notebook_instance.go +++ b/aws/resource_aws_sagemaker_notebook_instance.go @@ -29,6 +29,7 @@ func resourceAwsSagemakerNotebookInstance() *schema.Resource { customdiff.ForceNewIfChange("volume_size", func(_ context.Context, old, new, meta interface{}) bool { return new.(int) < old.(int) }), + SetTagsDiff, ), Schema: map[string]*schema.Schema{ @@ -122,13 +123,16 @@ func resourceAwsSagemakerNotebookInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, } } func resourceAwsSagemakerNotebookInstanceCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) name := d.Get("name").(string) @@ -167,8 +171,8 @@ func resourceAwsSagemakerNotebookInstanceCreate(d *schema.ResourceData, meta int createOpts.LifecycleConfigName = aws.String(l.(string)) } - if v, ok := d.GetOk("tags"); ok { - createOpts.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().SagemakerTags() + if len(tags) > 0 { + createOpts.Tags = tags.IgnoreAws().SagemakerTags() } if v, ok := d.GetOk("additional_code_repositories"); ok && v.(*schema.Set).Len() > 0 { @@ -193,6 +197,7 @@ func resourceAwsSagemakerNotebookInstanceCreate(d *schema.ResourceData, meta int func resourceAwsSagemakerNotebookInstanceRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig describeNotebookInput := &sagemaker.DescribeNotebookInstanceInput{ @@ -271,8 +276,15 @@ func resourceAwsSagemakerNotebookInstanceRead(d *schema.ResourceData, meta inter return fmt.Errorf("error listing tags for Sagemaker Notebook Instance (%s): %s", d.Id(), err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } return nil @@ -281,8 +293,8 @@ func resourceAwsSagemakerNotebookInstanceRead(d *schema.ResourceData, meta inter func resourceAwsSagemakerNotebookInstanceUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SagemakerUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating Sagemaker Notebook Instance (%s) tags: %s", d.Id(), err) diff --git a/aws/resource_aws_sagemaker_user_profile.go b/aws/resource_aws_sagemaker_user_profile.go index 39d1690fc3e..6bb01d2429b 100644 --- a/aws/resource_aws_sagemaker_user_profile.go +++ b/aws/resource_aws_sagemaker_user_profile.go @@ -208,17 +208,22 @@ func resourceAwsSagemakerUserProfile() *schema.Resource { }, }, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), "home_efs_file_system_uid": { Type: schema.TypeString, Computed: true, }, }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsSagemakerUserProfileCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) input := &sagemaker.CreateUserProfileInput{ UserProfileName: aws.String(d.Get("user_profile_name").(string)), @@ -237,8 +242,8 @@ func resourceAwsSagemakerUserProfileCreate(d *schema.ResourceData, meta interfac input.SingleSignOnUserValue = aws.String(v.(string)) } - if v, ok := d.GetOk("tags"); ok { - input.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().SagemakerTags() + if len(tags) > 0 { + input.Tags = tags.IgnoreAws().SagemakerTags() } log.Printf("[DEBUG] SageMaker User Profile create config: %#v", *input) @@ -264,6 +269,7 @@ func resourceAwsSagemakerUserProfileCreate(d *schema.ResourceData, meta interfac func resourceAwsSagemakerUserProfileRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sagemakerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig domainID, userProfileName, err := decodeSagemakerUserProfileName(d.Id()) @@ -299,10 +305,17 @@ func resourceAwsSagemakerUserProfileRead(d *schema.ResourceData, meta interface{ return fmt.Errorf("error listing tags for SageMaker User Profile (%s): %w", d.Id(), err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %w", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) + } + return nil } @@ -330,8 +343,8 @@ func resourceAwsSagemakerUserProfileUpdate(d *schema.ResourceData, meta interfac } } - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SagemakerUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating SageMaker UserProfile (%s) tags: %w", d.Id(), err) diff --git a/aws/resource_aws_secretsmanager_secret.go b/aws/resource_aws_secretsmanager_secret.go index 3d16345de8a..f1cc42e6cb4 100644 --- a/aws/resource_aws_secretsmanager_secret.go +++ b/aws/resource_aws_secretsmanager_secret.go @@ -99,13 +99,18 @@ func resourceAwsSecretsManagerSecret() *schema.Resource { }, }, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsSecretsManagerSecretCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).secretsmanagerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) var secretName string if v, ok := d.GetOk("name"); ok { @@ -121,8 +126,8 @@ func resourceAwsSecretsManagerSecretCreate(d *schema.ResourceData, meta interfac Name: aws.String(secretName), } - if v, ok := d.GetOk("tags"); ok { - input.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().SecretsmanagerTags() + if len(tags) > 0 { + input.Tags = tags.IgnoreAws().SecretsmanagerTags() } if v, ok := d.GetOk("kms_key_id"); ok { @@ -214,6 +219,7 @@ func resourceAwsSecretsManagerSecretCreate(d *schema.ResourceData, meta interfac func resourceAwsSecretsManagerSecretRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).secretsmanagerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig input := &secretsmanager.DescribeSecretInput{ @@ -290,10 +296,17 @@ func resourceAwsSecretsManagerSecretRead(d *schema.ResourceData, meta interface{ d.Set("rotation_rules", []interface{}{}) } - if err := d.Set("tags", keyvaluetags.SecretsmanagerKeyValueTags(output.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags := keyvaluetags.SecretsmanagerKeyValueTags(output.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %w", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) + } + return nil } @@ -399,8 +412,8 @@ func resourceAwsSecretsManagerSecretUpdate(d *schema.ResourceData, meta interfac } } - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SecretsmanagerUpdateTags(conn, d.Id(), o, n); err != nil { return fmt.Errorf("error updating tags: %w", err) } diff --git a/aws/resource_aws_security_group.go b/aws/resource_aws_security_group.go index 9acb2a03475..31a08ea60b3 100644 --- a/aws/resource_aws_security_group.go +++ b/aws/resource_aws_security_group.go @@ -225,7 +225,8 @@ func resourceAwsSecurityGroup() *schema.Resource { Computed: true, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), "revoke_rules_on_delete": { Type: schema.TypeBool, @@ -233,11 +234,15 @@ func resourceAwsSecurityGroup() *schema.Resource { Optional: true, }, }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsSecurityGroupCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) securityGroupOpts := &ec2.CreateSecurityGroupInput{} @@ -245,8 +250,8 @@ func resourceAwsSecurityGroupCreate(d *schema.ResourceData, meta interface{}) er securityGroupOpts.VpcId = aws.String(v.(string)) } - if v, ok := d.GetOk("tags"); ok { - securityGroupOpts.TagSpecifications = ec2TagSpecificationsFromMap(v.(map[string]interface{}), ec2.ResourceTypeSecurityGroup) + if len(tags) > 0 { + securityGroupOpts.TagSpecifications = ec2TagSpecificationsFromKeyValueTags(tags, ec2.ResourceTypeSecurityGroup) } if v := d.Get("description"); v != nil { @@ -339,6 +344,7 @@ func resourceAwsSecurityGroupCreate(d *schema.ResourceData, meta interface{}) er func resourceAwsSecurityGroupRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig var sgRaw interface{} @@ -395,8 +401,15 @@ func resourceAwsSecurityGroupRead(d *schema.ResourceData, meta interface{}) erro log.Printf("[WARN] Error setting Egress rule set for (%s): %s", d.Id(), err) } - if err := d.Set("tags", keyvaluetags.Ec2KeyValueTags(sg.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags := keyvaluetags.Ec2KeyValueTags(sg.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } return nil @@ -436,8 +449,8 @@ func resourceAwsSecurityGroupUpdate(d *schema.ResourceData, meta interface{}) er } } - if d.HasChange("tags") && !d.IsNewResource() { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") && !d.IsNewResource() { + o, n := d.GetChange("tags_all") if err := keyvaluetags.Ec2UpdateTags(conn, d.Id(), o, n); err != nil { return fmt.Errorf("error updating EC2 Security Group (%s) tags: %s", d.Id(), err) diff --git a/aws/resource_aws_serverlessapplicationrepository_cloudformation_stack.go b/aws/resource_aws_serverlessapplicationrepository_cloudformation_stack.go index 998db6a1fa9..2bd208ec6af 100644 --- a/aws/resource_aws_serverlessapplicationrepository_cloudformation_stack.go +++ b/aws/resource_aws_serverlessapplicationrepository_cloudformation_stack.go @@ -82,8 +82,11 @@ func resourceAwsServerlessApplicationRepositoryCloudFormationStack() *schema.Res Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, + + CustomizeDiff: SetTagsDiff, } } @@ -123,6 +126,7 @@ func resourceAwsServerlessApplicationRepositoryCloudFormationStackCreate(d *sche func resourceAwsServerlessApplicationRepositoryCloudFormationStackRead(d *schema.ResourceData, meta interface{}) error { serverlessConn := meta.(*AWSClient).serverlessapplicationrepositoryconn cfConn := meta.(*AWSClient).cfconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig stack, err := cffinder.Stack(cfConn, d.Id()) @@ -154,10 +158,17 @@ func resourceAwsServerlessApplicationRepositoryCloudFormationStackRead(d *schema return fmt.Errorf("error describing Serverless Application Repository CloudFormation Stack (%s): missing required tag \"%s\"", d.Id(), serverlessApplicationRepositoryCloudFormationStackTagSemanticVersion) } - if err = d.Set("tags", tags.IgnoreServerlessApplicationRepository().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags = tags.IgnoreServerlessApplicationRepository().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err = d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("failed to set tags: %w", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("failed to set tags_all: %w", err) + } + if err = d.Set("outputs", flattenCloudFormationOutputs(stack.Outputs)); err != nil { return fmt.Errorf("failed to set outputs: %w", err) } @@ -287,13 +298,15 @@ func resourceAwsServerlessApplicationRepositoryCloudFormationStackImport(d *sche func createServerlessApplicationRepositoryCloudFormationChangeSet(d *schema.ResourceData, client *AWSClient) (*cloudformation.DescribeChangeSetOutput, error) { serverlessConn := client.serverlessapplicationrepositoryconn cfConn := client.cfconn + defaultTagsConfig := client.DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) stackName := d.Get("name").(string) changeSetRequest := serverlessrepository.CreateCloudFormationChangeSetRequest{ StackName: aws.String(stackName), ApplicationId: aws.String(d.Get("application_id").(string)), Capabilities: expandStringSet(d.Get("capabilities").(*schema.Set)), - Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreServerlessApplicationRepository().ServerlessapplicationrepositoryTags(), + Tags: tags.IgnoreServerlessApplicationRepository().ServerlessapplicationrepositoryTags(), } if v, ok := d.GetOk("semantic_version"); ok { changeSetRequest.SemanticVersion = aws.String(v.(string)) diff --git a/aws/resource_aws_service_discovery_http_namespace.go b/aws/resource_aws_service_discovery_http_namespace.go index 33c50b81834..cf3162ea5df 100644 --- a/aws/resource_aws_service_discovery_http_namespace.go +++ b/aws/resource_aws_service_discovery_http_namespace.go @@ -34,23 +34,28 @@ func resourceAwsServiceDiscoveryHttpNamespace() *schema.Resource { Optional: true, ForceNew: true, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), "arn": { Type: schema.TypeString, Computed: true, }, }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsServiceDiscoveryHttpNamespaceCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sdconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) name := d.Get("name").(string) input := &servicediscovery.CreateHttpNamespaceInput{ Name: aws.String(name), - Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().ServicediscoveryTags(), + Tags: tags.IgnoreAws().ServicediscoveryTags(), CreatorRequestId: aws.String(resource.UniqueId()), } @@ -91,6 +96,7 @@ func resourceAwsServiceDiscoveryHttpNamespaceCreate(d *schema.ResourceData, meta func resourceAwsServiceDiscoveryHttpNamespaceRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sdconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig input := &servicediscovery.GetNamespaceInput{ @@ -117,8 +123,15 @@ func resourceAwsServiceDiscoveryHttpNamespaceRead(d *schema.ResourceData, meta i return fmt.Errorf("error listing tags for resource (%s): %s", arn, err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } return nil @@ -127,8 +140,8 @@ func resourceAwsServiceDiscoveryHttpNamespaceRead(d *schema.ResourceData, meta i func resourceAwsServiceDiscoveryHttpNamespaceUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sdconn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.ServicediscoveryUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating Service Discovery HTTP Namespace (%s) tags: %s", d.Id(), err) } diff --git a/aws/resource_aws_service_discovery_private_dns_namespace.go b/aws/resource_aws_service_discovery_private_dns_namespace.go index bb7d984729e..47ed796a1cb 100644 --- a/aws/resource_aws_service_discovery_private_dns_namespace.go +++ b/aws/resource_aws_service_discovery_private_dns_namespace.go @@ -47,7 +47,8 @@ func resourceAwsServiceDiscoveryPrivateDnsNamespace() *schema.Resource { Required: true, ForceNew: true, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), "arn": { Type: schema.TypeString, Computed: true, @@ -57,11 +58,15 @@ func resourceAwsServiceDiscoveryPrivateDnsNamespace() *schema.Resource { Computed: true, }, }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsServiceDiscoveryPrivateDnsNamespaceCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sdconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) name := d.Get("name").(string) // The CreatorRequestId has a limit of 64 bytes @@ -74,7 +79,7 @@ func resourceAwsServiceDiscoveryPrivateDnsNamespaceCreate(d *schema.ResourceData input := &servicediscovery.CreatePrivateDnsNamespaceInput{ Name: aws.String(name), - Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().ServicediscoveryTags(), + Tags: tags.IgnoreAws().ServicediscoveryTags(), Vpc: aws.String(d.Get("vpc").(string)), CreatorRequestId: aws.String(requestId), } @@ -116,6 +121,7 @@ func resourceAwsServiceDiscoveryPrivateDnsNamespaceCreate(d *schema.ResourceData func resourceAwsServiceDiscoveryPrivateDnsNamespaceRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sdconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig input := &servicediscovery.GetNamespaceInput{ @@ -145,8 +151,15 @@ func resourceAwsServiceDiscoveryPrivateDnsNamespaceRead(d *schema.ResourceData, return fmt.Errorf("error listing tags for resource (%s): %s", arn, err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } return nil @@ -155,8 +168,8 @@ func resourceAwsServiceDiscoveryPrivateDnsNamespaceRead(d *schema.ResourceData, func resourceAwsServiceDiscoveryPrivateDnsNamespaceUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sdconn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.ServicediscoveryUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating Service Discovery Private DNS Namespace (%s) tags: %s", d.Id(), err) } diff --git a/aws/resource_aws_service_discovery_public_dns_namespace.go b/aws/resource_aws_service_discovery_public_dns_namespace.go index 8955ef963e0..cc04f16cb08 100644 --- a/aws/resource_aws_service_discovery_public_dns_namespace.go +++ b/aws/resource_aws_service_discovery_public_dns_namespace.go @@ -34,7 +34,8 @@ func resourceAwsServiceDiscoveryPublicDnsNamespace() *schema.Resource { Optional: true, ForceNew: true, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), "arn": { Type: schema.TypeString, Computed: true, @@ -44,11 +45,15 @@ func resourceAwsServiceDiscoveryPublicDnsNamespace() *schema.Resource { Computed: true, }, }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsServiceDiscoveryPublicDnsNamespaceCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sdconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) name := d.Get("name").(string) // The CreatorRequestId has a limit of 64 bytes @@ -61,7 +66,7 @@ func resourceAwsServiceDiscoveryPublicDnsNamespaceCreate(d *schema.ResourceData, input := &servicediscovery.CreatePublicDnsNamespaceInput{ Name: aws.String(name), - Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().ServicediscoveryTags(), + Tags: tags.IgnoreAws().ServicediscoveryTags(), CreatorRequestId: aws.String(requestId), } @@ -102,6 +107,7 @@ func resourceAwsServiceDiscoveryPublicDnsNamespaceCreate(d *schema.ResourceData, func resourceAwsServiceDiscoveryPublicDnsNamespaceRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sdconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig input := &servicediscovery.GetNamespaceInput{ @@ -131,8 +137,15 @@ func resourceAwsServiceDiscoveryPublicDnsNamespaceRead(d *schema.ResourceData, m return fmt.Errorf("error listing tags for resource (%s): %s", arn, err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } return nil @@ -141,8 +154,8 @@ func resourceAwsServiceDiscoveryPublicDnsNamespaceRead(d *schema.ResourceData, m func resourceAwsServiceDiscoveryPublicDnsNamespaceUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sdconn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.ServicediscoveryUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating Service Discovery Public DNS Namespace (%s) tags: %s", d.Id(), err) } diff --git a/aws/resource_aws_service_discovery_service.go b/aws/resource_aws_service_discovery_service.go index db0113a5924..fca2ee2adfe 100644 --- a/aws/resource_aws_service_discovery_service.go +++ b/aws/resource_aws_service_discovery_service.go @@ -128,21 +128,26 @@ func resourceAwsServiceDiscoveryService() *schema.Resource { }, }, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), "arn": { Type: schema.TypeString, Computed: true, }, }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsServiceDiscoveryServiceCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sdconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) input := &servicediscovery.CreateServiceInput{ Name: aws.String(d.Get("name").(string)), - Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().ServicediscoveryTags(), + Tags: tags.IgnoreAws().ServicediscoveryTags(), } dnsConfig := d.Get("dns_config").([]interface{}) @@ -180,6 +185,7 @@ func resourceAwsServiceDiscoveryServiceCreate(d *schema.ResourceData, meta inter func resourceAwsServiceDiscoveryServiceRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sdconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig input := &servicediscovery.GetServiceInput{ @@ -212,8 +218,15 @@ func resourceAwsServiceDiscoveryServiceRead(d *schema.ResourceData, meta interfa return fmt.Errorf("error listing tags for resource (%s): %s", arn, err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } return nil @@ -249,8 +262,8 @@ func resourceAwsServiceDiscoveryServiceUpdate(d *schema.ResourceData, meta inter } } - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.ServicediscoveryUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating Service Discovery Private DNS Namespace (%s) tags: %s", d.Id(), err) } diff --git a/aws/resource_aws_servicecatalog_portfolio.go b/aws/resource_aws_servicecatalog_portfolio.go index 214f0d25061..43bfbff9ec8 100644 --- a/aws/resource_aws_servicecatalog_portfolio.go +++ b/aws/resource_aws_servicecatalog_portfolio.go @@ -56,17 +56,22 @@ func resourceAwsServiceCatalogPortfolio() *schema.Resource { Optional: true, ValidateFunc: validation.StringLenBetween(1, 20), }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsServiceCatalogPortfolioCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).scconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) input := servicecatalog.CreatePortfolioInput{ AcceptLanguage: aws.String("en"), DisplayName: aws.String(d.Get("name").(string)), IdempotencyToken: aws.String(resource.UniqueId()), - Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().ServicecatalogTags(), + Tags: tags.IgnoreAws().ServicecatalogTags(), } if v, ok := d.GetOk("description"); ok { @@ -89,6 +94,7 @@ func resourceAwsServiceCatalogPortfolioCreate(d *schema.ResourceData, meta inter func resourceAwsServiceCatalogPortfolioRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).scconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig input := servicecatalog.DescribePortfolioInput{ @@ -115,8 +121,15 @@ func resourceAwsServiceCatalogPortfolioRead(d *schema.ResourceData, meta interfa d.Set("name", portfolioDetail.DisplayName) d.Set("provider_name", portfolioDetail.ProviderName) - if err := d.Set("tags", keyvaluetags.ServicecatalogKeyValueTags(resp.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags := keyvaluetags.ServicecatalogKeyValueTags(resp.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } return nil @@ -149,8 +162,8 @@ func resourceAwsServiceCatalogPortfolioUpdate(d *schema.ResourceData, meta inter input.ProviderName = aws.String(v.(string)) } - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") input.AddTags = keyvaluetags.New(n).IgnoreAws().ServicecatalogTags() input.RemoveTags = aws.StringSlice(keyvaluetags.New(o).IgnoreAws().Keys()) diff --git a/aws/resource_aws_sfn_activity.go b/aws/resource_aws_sfn_activity.go index 672254795ac..f1a5202ff75 100644 --- a/aws/resource_aws_sfn_activity.go +++ b/aws/resource_aws_sfn_activity.go @@ -35,18 +35,23 @@ func resourceAwsSfnActivity() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsSfnActivityCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sfnconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) log.Print("[DEBUG] Creating Step Function Activity") params := &sfn.CreateActivityInput{ Name: aws.String(d.Get("name").(string)), - Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().SfnTags(), + Tags: tags.IgnoreAws().SfnTags(), } activity, err := conn.CreateActivity(params) @@ -62,8 +67,8 @@ func resourceAwsSfnActivityCreate(d *schema.ResourceData, meta interface{}) erro func resourceAwsSfnActivityUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sfnconn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SfnUpdateTags(conn, d.Id(), o, n); err != nil { return fmt.Errorf("error updating tags: %s", err) } @@ -74,6 +79,7 @@ func resourceAwsSfnActivityUpdate(d *schema.ResourceData, meta interface{}) erro func resourceAwsSfnActivityRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sfnconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig log.Printf("[DEBUG] Reading Step Function Activity: %s", d.Id()) @@ -101,8 +107,15 @@ func resourceAwsSfnActivityRead(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("error listing tags for SFN Activity (%s): %s", d.Id(), err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } return nil diff --git a/aws/resource_aws_sfn_state_machine.go b/aws/resource_aws_sfn_state_machine.go index c6fe16bb3a3..e6b9810f834 100644 --- a/aws/resource_aws_sfn_state_machine.go +++ b/aws/resource_aws_sfn_state_machine.go @@ -83,7 +83,8 @@ func resourceAwsSfnStateMachine() *schema.Resource { Computed: true, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), "arn": { Type: schema.TypeString, Computed: true, @@ -99,18 +100,22 @@ func resourceAwsSfnStateMachine() *schema.Resource { }, false), }, }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsSfnStateMachineCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sfnconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) log.Print("[DEBUG] Creating Step Function State Machine") params := &sfn.CreateStateMachineInput{ Definition: aws.String(d.Get("definition").(string)), LoggingConfiguration: expandAwsSfnLoggingConfiguration(d.Get("logging_configuration").([]interface{})), Name: aws.String(d.Get("name").(string)), RoleArn: aws.String(d.Get("role_arn").(string)), - Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().SfnTags(), + Tags: tags.IgnoreAws().SfnTags(), Type: aws.String(d.Get("type").(string)), } @@ -152,6 +157,7 @@ func resourceAwsSfnStateMachineCreate(d *schema.ResourceData, meta interface{}) func resourceAwsSfnStateMachineRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).sfnconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig log.Printf("[DEBUG] Reading Step Function State Machine: %s", d.Id()) @@ -191,8 +197,15 @@ func resourceAwsSfnStateMachineRead(d *schema.ResourceData, meta interface{}) er return fmt.Errorf("error listing tags for SFN State Machine (%s): %s", d.Id(), err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } return nil @@ -224,8 +237,8 @@ func resourceAwsSfnStateMachineUpdate(d *schema.ResourceData, meta interface{}) } } - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SfnUpdateTags(conn, d.Id(), o, n); err != nil { return fmt.Errorf("error updating tags: %s", err) } diff --git a/aws/resource_aws_signer_signing_profile.go b/aws/resource_aws_signer_signing_profile.go index 0b6c4fe042c..79a38c97101 100644 --- a/aws/resource_aws_signer_signing_profile.go +++ b/aws/resource_aws_signer_signing_profile.go @@ -73,7 +73,8 @@ func resourceAwsSignerSigningProfile() *schema.Resource { }, }, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), "arn": { Type: schema.TypeString, Computed: true, @@ -115,11 +116,15 @@ func resourceAwsSignerSigningProfile() *schema.Resource { Computed: true, }, }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsSignerSigningProfileCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).signerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) log.Printf("[DEBUG] Creating Signer signing profile") @@ -139,8 +144,8 @@ func resourceAwsSignerSigningProfileCreate(d *schema.ResourceData, meta interfac } } - if v, exists := d.GetOk("tags"); exists { - signingProfileInput.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().SignerTags() + if len(tags) > 0 { + signingProfileInput.Tags = tags.IgnoreAws().SignerTags() } _, err := conn.PutSigningProfile(signingProfileInput) @@ -155,6 +160,7 @@ func resourceAwsSignerSigningProfileCreate(d *schema.ResourceData, meta interfac func resourceAwsSignerSigningProfileRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).signerconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig signingProfileOutput, err := conn.GetSigningProfile(&signer.GetSigningProfileInput{ @@ -208,8 +214,15 @@ func resourceAwsSignerSigningProfileRead(d *schema.ResourceData, meta interface{ return fmt.Errorf("error setting signer signing profile status: %s", err) } - if err := d.Set("tags", keyvaluetags.SignerKeyValueTags(signingProfileOutput.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting signer signing profile tags: %s", err) + tags := keyvaluetags.SignerKeyValueTags(signingProfileOutput.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } if err := d.Set("revocation_record", flattenSignerSigningProfileRevocationRecord(signingProfileOutput.RevocationRecord)); err != nil { @@ -223,8 +236,8 @@ func resourceAwsSignerSigningProfileUpdate(d *schema.ResourceData, meta interfac conn := meta.(*AWSClient).signerconn arn := d.Get("arn").(string) - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SignerUpdateTags(conn, arn, o, n); err != nil { return fmt.Errorf("error updating Signer signing profile (%s) tags: %s", arn, err) diff --git a/aws/resource_aws_sns_topic.go b/aws/resource_aws_sns_topic.go index ca5d8777a0a..ecf7cb15db3 100644 --- a/aws/resource_aws_sns_topic.go +++ b/aws/resource_aws_sns_topic.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/arn" "github.com/aws/aws-sdk-go/service/sns" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/structure" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" @@ -27,7 +28,10 @@ func resourceAwsSnsTopic() *schema.Resource { Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, - CustomizeDiff: resourceAwsSnsTopicCustomizeDiff, + CustomizeDiff: customdiff.Sequence( + resourceAwsSnsTopicCustomizeDiff, + SetTagsDiff, + ), Schema: map[string]*schema.Schema{ "name": { @@ -141,14 +145,16 @@ func resourceAwsSnsTopic() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, } } func resourceAwsSnsTopicCreate(d *schema.ResourceData, meta interface{}) error { snsconn := meta.(*AWSClient).snsconn - tags := keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().SnsTags() + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) var name string fifoTopic := d.Get("fifo_topic").(bool) @@ -169,7 +175,7 @@ func resourceAwsSnsTopicCreate(d *schema.ResourceData, meta interface{}) error { req := &sns.CreateTopicInput{ Name: aws.String(name), - Tags: tags, + Tags: tags.IgnoreAws().SnsTags(), } if len(attributes) > 0 { @@ -409,8 +415,8 @@ func resourceAwsSnsTopicUpdate(d *schema.ResourceData, meta interface{}) error { } } - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SnsUpdateTags(snsconn, d.Id(), o, n); err != nil { return fmt.Errorf("error updating tags: %w", err) } @@ -421,6 +427,7 @@ func resourceAwsSnsTopicUpdate(d *schema.ResourceData, meta interface{}) error { func resourceAwsSnsTopicRead(d *schema.ResourceData, meta interface{}) error { snsconn := meta.(*AWSClient).snsconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig log.Printf("[DEBUG] Reading SNS Topic Attributes for %s", d.Id()) @@ -530,10 +537,17 @@ func resourceAwsSnsTopicRead(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("error listing tags for SNS Topic (%s): %w", d.Id(), err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %w", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) + } + return nil } diff --git a/aws/resource_aws_spot_fleet_request.go b/aws/resource_aws_spot_fleet_request.go index 20f52611cec..19294744fdf 100644 --- a/aws/resource_aws_spot_fleet_request.go +++ b/aws/resource_aws_spot_fleet_request.go @@ -545,8 +545,11 @@ func resourceAwsSpotFleetRequest() *schema.Resource { }, Set: schema.HashString, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, + + CustomizeDiff: SetTagsDiff, } } @@ -923,6 +926,8 @@ func expandSpotCapacityRebalance(l []interface{}) *ec2.SpotCapacityRebalance { func resourceAwsSpotFleetRequestCreate(d *schema.ResourceData, meta interface{}) error { // http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotFleet.html conn := meta.(*AWSClient).ec2conn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) _, launchSpecificationOk := d.GetOk("launch_specification") _, launchTemplateConfigsOk := d.GetOk("launch_template_config") @@ -936,7 +941,7 @@ func resourceAwsSpotFleetRequestCreate(d *schema.ResourceData, meta interface{}) ReplaceUnhealthyInstances: aws.Bool(d.Get("replace_unhealthy_instances").(bool)), InstanceInterruptionBehavior: aws.String(d.Get("instance_interruption_behaviour").(string)), Type: aws.String(d.Get("fleet_type").(string)), - TagSpecifications: ec2TagSpecificationsFromMap(d.Get("tags").(map[string]interface{}), ec2.ResourceTypeSpotFleetRequest), + TagSpecifications: ec2TagSpecificationsFromKeyValueTags(tags, ec2.ResourceTypeSpotFleetRequest), } if launchSpecificationOk { @@ -1197,6 +1202,7 @@ func resourceAwsSpotFleetRequestFulfillmentRefreshFunc(id string, conn *ec2.EC2) func resourceAwsSpotFleetRequestRead(d *schema.ResourceData, meta interface{}) error { // http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSpotFleetRequests.html conn := meta.(*AWSClient).ec2conn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig req := &ec2.DescribeSpotFleetRequestsInput{ @@ -1287,8 +1293,15 @@ func resourceAwsSpotFleetRequestRead(d *schema.ResourceData, meta interface{}) e d.Set("instance_interruption_behaviour", config.InstanceInterruptionBehavior) d.Set("fleet_type", config.Type) d.Set("launch_specification", launchSpec) - if err := d.Set("tags", keyvaluetags.Ec2KeyValueTags(sfr.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags := keyvaluetags.Ec2KeyValueTags(sfr.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } if len(config.LaunchTemplateConfigs) > 0 { @@ -1616,8 +1629,8 @@ func resourceAwsSpotFleetRequestUpdate(d *schema.ResourceData, meta interface{}) } } - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.Ec2UpdateTags(conn, d.Id(), o, n); err != nil { return fmt.Errorf("error updating tags: %s", err) } diff --git a/aws/resource_aws_spot_instance_request.go b/aws/resource_aws_spot_instance_request.go index 907832b1d0d..49dab4aee72 100644 --- a/aws/resource_aws_spot_instance_request.go +++ b/aws/resource_aws_spot_instance_request.go @@ -42,7 +42,7 @@ func resourceAwsSpotInstanceRequest() *schema.Resource { // Everything on a spot instance is ForceNew except tags for k, v := range s { - if k == "tags" { + if k == "tags" || k == "tags_all" { continue } v.ForceNew = true @@ -128,6 +128,8 @@ func resourceAwsSpotInstanceRequest() *schema.Resource { func resourceAwsSpotInstanceRequestCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) instanceOpts, err := buildAwsInstanceOpts(d, meta) if err != nil { @@ -138,7 +140,7 @@ func resourceAwsSpotInstanceRequestCreate(d *schema.ResourceData, meta interface SpotPrice: aws.String(d.Get("spot_price").(string)), Type: aws.String(d.Get("spot_type").(string)), InstanceInterruptionBehavior: aws.String(d.Get("instance_interruption_behaviour").(string)), - TagSpecifications: ec2TagSpecificationsFromMap(d.Get("tags").(map[string]interface{}), ec2.ResourceTypeSpotInstancesRequest), + TagSpecifications: ec2TagSpecificationsFromKeyValueTags(tags, ec2.ResourceTypeSpotInstancesRequest), // Though the AWS API supports creating spot instance requests for multiple // instances, for TF purposes we fix this to one instance per request. @@ -253,6 +255,7 @@ func resourceAwsSpotInstanceRequestCreate(d *schema.ResourceData, meta interface // Update spot state, etc func resourceAwsSpotInstanceRequestRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig var request *ec2.SpotInstanceRequest @@ -327,8 +330,15 @@ func resourceAwsSpotInstanceRequestRead(d *schema.ResourceData, meta interface{} d.Set("launch_group", request.LaunchGroup) d.Set("block_duration_minutes", request.BlockDurationMinutes) - if err := d.Set("tags", keyvaluetags.Ec2KeyValueTags(request.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags := keyvaluetags.Ec2KeyValueTags(request.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } d.Set("instance_interruption_behaviour", request.InstanceInterruptionBehavior) @@ -429,8 +439,8 @@ func readInstance(d *schema.ResourceData, meta interface{}) error { func resourceAwsSpotInstanceRequestUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.Ec2UpdateTags(conn, d.Id(), o, n); err != nil { return fmt.Errorf("error updating EC2 Spot Instance Request (%s) tags: %s", d.Id(), err) diff --git a/aws/resource_aws_sqs_queue.go b/aws/resource_aws_sqs_queue.go index ed790b8073b..534cd0a041e 100644 --- a/aws/resource_aws_sqs_queue.go +++ b/aws/resource_aws_sqs_queue.go @@ -14,6 +14,7 @@ import ( "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-plugin-sdk/v2/helper/customdiff" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/structure" @@ -50,7 +51,10 @@ func resourceAwsSqsQueue() *schema.Resource { Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, - CustomizeDiff: resourceAwsSqsQueueCustomizeDiff, + CustomizeDiff: customdiff.Sequence( + resourceAwsSqsQueueCustomizeDiff, + SetTagsDiff, + ), Schema: map[string]*schema.Schema{ "name": { @@ -132,13 +136,16 @@ func resourceAwsSqsQueue() *schema.Resource { Computed: true, Optional: true, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, } } func resourceAwsSqsQueueCreate(d *schema.ResourceData, meta interface{}) error { sqsconn := meta.(*AWSClient).sqsconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) var name string fifoQueue := d.Get("fifo_queue").(bool) @@ -156,8 +163,8 @@ func resourceAwsSqsQueueCreate(d *schema.ResourceData, meta interface{}) error { } // Tag-on-create is currently only supported in AWS Commercial - if v, ok := d.GetOk("tags"); ok && meta.(*AWSClient).partition == endpoints.AwsPartitionID { - req.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().SqsTags() + if len(tags) > 0 && meta.(*AWSClient).partition == endpoints.AwsPartitionID { + req.Tags = tags.IgnoreAws().SqsTags() } attributes := make(map[string]*string) @@ -216,8 +223,8 @@ func resourceAwsSqsQueueCreate(d *schema.ResourceData, meta interface{}) error { func resourceAwsSqsQueueUpdate(d *schema.ResourceData, meta interface{}) error { sqsconn := meta.(*AWSClient).sqsconn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SqsUpdateTags(sqsconn, d.Id(), o, n); err != nil { return fmt.Errorf("error updating SQS Queue (%s) tags: %s", d.Id(), err) @@ -260,6 +267,7 @@ func resourceAwsSqsQueueUpdate(d *schema.ResourceData, meta interface{}) error { func resourceAwsSqsQueueRead(d *schema.ResourceData, meta interface{}) error { sqsconn := meta.(*AWSClient).sqsconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig attributeOutput, err := sqsconn.GetQueueAttributes(&sqs.GetQueueAttributesInput{ @@ -418,8 +426,15 @@ func resourceAwsSqsQueueRead(d *schema.ResourceData, meta interface{}) error { } } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } return nil diff --git a/aws/resource_aws_ssm_activation.go b/aws/resource_aws_ssm_activation.go index 216cdb8ff55..1abcc7863a4 100644 --- a/aws/resource_aws_ssm_activation.go +++ b/aws/resource_aws_ssm_activation.go @@ -63,13 +63,18 @@ func resourceAwsSsmActivation() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "tags": tagsSchemaForceNew(), + "tags": tagsSchemaForceNew(), + "tags_all": tagsSchemaComputed(), }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsSsmActivationCreate(d *schema.ResourceData, meta interface{}) error { ssmconn := meta.(*AWSClient).ssmconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) log.Printf("[DEBUG] SSM activation create: %s", d.Id()) @@ -97,8 +102,8 @@ func resourceAwsSsmActivationCreate(d *schema.ResourceData, meta interface{}) er if _, ok := d.GetOk("registration_limit"); ok { activationInput.RegistrationLimit = aws.Int64(int64(d.Get("registration_limit").(int))) } - if v, ok := d.GetOk("tags"); ok { - activationInput.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().SsmTags() + if len(tags) > 0 { + activationInput.Tags = tags.IgnoreAws().SsmTags() } // Retry to allow iam_role to be created and policy attachment to take place @@ -138,6 +143,7 @@ func resourceAwsSsmActivationCreate(d *schema.ResourceData, meta interface{}) er func resourceAwsSsmActivationRead(d *schema.ResourceData, meta interface{}) error { ssmconn := meta.(*AWSClient).ssmconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig log.Printf("[DEBUG] Reading SSM Activation: %s", d.Id()) @@ -173,8 +179,15 @@ func resourceAwsSsmActivationRead(d *schema.ResourceData, meta interface{}) erro d.Set("iam_role", activation.IamRole) d.Set("registration_limit", activation.RegistrationLimit) d.Set("registration_count", activation.RegistrationsCount) - if err := d.Set("tags", keyvaluetags.SsmKeyValueTags(activation.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags := keyvaluetags.SsmKeyValueTags(activation.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } return nil diff --git a/aws/resource_aws_ssm_document.go b/aws/resource_aws_ssm_document.go index cf5f1bef825..c264047ddf2 100644 --- a/aws/resource_aws_ssm_document.go +++ b/aws/resource_aws_ssm_document.go @@ -163,7 +163,8 @@ func resourceAwsSsmDocument() *schema.Resource { Type: schema.TypeString, }, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), "target_type": { Type: schema.TypeString, Optional: true, @@ -181,11 +182,15 @@ func resourceAwsSsmDocument() *schema.Resource { ), }, }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsSsmDocumentCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ssmconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) // Validates permissions keys, if set, to be type and account_ids // since ValidateFunc validates only the value not the key. @@ -204,8 +209,8 @@ func resourceAwsSsmDocumentCreate(d *schema.ResourceData, meta interface{}) erro DocumentType: aws.String(d.Get("document_type").(string)), } - if v, ok := d.GetOk("tags"); ok { - docInput.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().SsmTags() + if len(tags) > 0 { + docInput.Tags = tags.IgnoreAws().SsmTags() } if v, ok := d.GetOk("attachments_source"); ok { @@ -245,6 +250,7 @@ func resourceAwsSsmDocumentCreate(d *schema.ResourceData, meta interface{}) erro func resourceAwsSsmDocumentRead(d *schema.ResourceData, meta interface{}) error { ssmconn := meta.(*AWSClient).ssmconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig log.Printf("[DEBUG] Reading SSM Document: %s", d.Id()) @@ -348,8 +354,15 @@ func resourceAwsSsmDocumentRead(d *schema.ResourceData, meta interface{}) error return err } - if err := d.Set("tags", keyvaluetags.SsmKeyValueTags(doc.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags := keyvaluetags.SsmKeyValueTags(doc.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } if err := d.Set("target_type", doc.TargetType); err != nil { @@ -370,8 +383,8 @@ func resourceAwsSsmDocumentUpdate(d *schema.ResourceData, meta interface{}) erro } } - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SsmUpdateTags(conn, d.Id(), ssm.ResourceTypeForTaggingDocument, o, n); err != nil { return fmt.Errorf("error updating SSM Document (%s) tags: %s", d.Id(), err) diff --git a/aws/resource_aws_ssm_maintenance_window.go b/aws/resource_aws_ssm_maintenance_window.go index 3a127f7d312..28891e0b227 100644 --- a/aws/resource_aws_ssm_maintenance_window.go +++ b/aws/resource_aws_ssm_maintenance_window.go @@ -75,17 +75,22 @@ func resourceAwsSsmMaintenanceWindow() *schema.Resource { Optional: true, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), "description": { Type: schema.TypeString, Optional: true, }, }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsSsmMaintenanceWindowCreate(d *schema.ResourceData, meta interface{}) error { ssmconn := meta.(*AWSClient).ssmconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) params := &ssm.CreateMaintenanceWindowInput{ AllowUnassociatedTargets: aws.Bool(d.Get("allow_unassociated_targets").(bool)), @@ -95,8 +100,8 @@ func resourceAwsSsmMaintenanceWindowCreate(d *schema.ResourceData, meta interfac Schedule: aws.String(d.Get("schedule").(string)), } - if v, ok := d.GetOk("tags"); ok { - params.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().SsmTags() + if len(tags) > 0 { + params.Tags = tags.IgnoreAws().SsmTags() } if v, ok := d.GetOk("end_date"); ok { @@ -187,8 +192,8 @@ func resourceAwsSsmMaintenanceWindowUpdate(d *schema.ResourceData, meta interfac return fmt.Errorf("error updating SSM Maintenance Window (%s): %s", d.Id(), err) } - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SsmUpdateTags(ssmconn, d.Id(), ssm.ResourceTypeForTaggingMaintenanceWindow, o, n); err != nil { return fmt.Errorf("error updating SSM Maintenance Window (%s) tags: %s", d.Id(), err) @@ -200,6 +205,7 @@ func resourceAwsSsmMaintenanceWindowUpdate(d *schema.ResourceData, meta interfac func resourceAwsSsmMaintenanceWindowRead(d *schema.ResourceData, meta interface{}) error { ssmconn := meta.(*AWSClient).ssmconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig params := &ssm.GetMaintenanceWindowInput{ @@ -234,8 +240,15 @@ func resourceAwsSsmMaintenanceWindowRead(d *schema.ResourceData, meta interface{ return fmt.Errorf("error listing tags for SSM Maintenance Window (%s): %s", d.Id(), err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } return nil diff --git a/aws/resource_aws_ssm_parameter.go b/aws/resource_aws_ssm_parameter.go index b89cb43ce01..fda4d794a55 100644 --- a/aws/resource_aws_ssm_parameter.go +++ b/aws/resource_aws_ssm_parameter.go @@ -95,7 +95,8 @@ func resourceAwsSsmParameter() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, CustomizeDiff: customdiff.All( @@ -106,12 +107,15 @@ func resourceAwsSsmParameter() *schema.Resource { customdiff.ForceNewIfChange("tier", func(_ context.Context, old, new, meta interface{}) bool { return old.(string) == ssm.ParameterTierAdvanced && (new.(string) == ssm.ParameterTierStandard || new.(string) == ssm.ParameterTierIntelligentTiering) }), + SetTagsDiff, ), } } func resourceAwsSsmParameterCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ssmconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) name := d.Get("name").(string) @@ -139,8 +143,8 @@ func resourceAwsSsmParameterCreate(d *schema.ResourceData, meta interface{}) err // AWS SSM Service only supports PutParameter requests with Tags // iff Overwrite is not provided or is false; in this resource's case, // the Overwrite value is always set in the paramInput so we check for the value - if v, ok := d.GetOk("tags"); ok && !aws.BoolValue(paramInput.Overwrite) { - paramInput.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().SsmTags() + if len(tags) > 0 && !aws.BoolValue(paramInput.Overwrite) { + paramInput.Tags = tags.IgnoreAws().SsmTags() } _, err := conn.PutParameter(paramInput) @@ -157,8 +161,8 @@ func resourceAwsSsmParameterCreate(d *schema.ResourceData, meta interface{}) err // Since the AWS SSM Service does not support PutParameter requests with // Tags and Overwrite set to true, we make an additional API call // to Update the resource's tags if necessary - if d.HasChange("tags") && paramInput.Tags == nil { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") && paramInput.Tags == nil { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SsmUpdateTags(conn, name, ssm.ResourceTypeForTaggingParameter, o, n); err != nil { return fmt.Errorf("error updating SSM Parameter (%s) tags: %w", name, err) @@ -172,6 +176,7 @@ func resourceAwsSsmParameterCreate(d *schema.ResourceData, meta interface{}) err func resourceAwsSsmParameterRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ssmconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig input := &ssm.GetParameterInput{ @@ -252,10 +257,17 @@ func resourceAwsSsmParameterRead(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("error listing tags for SSM Parameter (%s): %w", name, err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %w", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) + } + d.Set("arn", param.ARN) return nil @@ -264,7 +276,7 @@ func resourceAwsSsmParameterRead(d *schema.ResourceData, meta interface{}) error func resourceAwsSsmParameterUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ssmconn - if d.HasChangesExcept("tags") { + if d.HasChangesExcept("tags", "tags_all") { paramInput := &ssm.PutParameterInput{ Name: aws.String(d.Get("name").(string)), Type: aws.String(d.Get("type").(string)), @@ -298,8 +310,8 @@ func resourceAwsSsmParameterUpdate(d *schema.ResourceData, meta interface{}) err } } - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SsmUpdateTags(conn, d.Id(), ssm.ResourceTypeForTaggingParameter, o, n); err != nil { return fmt.Errorf("error updating SSM Parameter (%s) tags: %w", d.Id(), err) diff --git a/aws/resource_aws_ssm_patch_baseline.go b/aws/resource_aws_ssm_patch_baseline.go index e7446cfd363..718076d0647 100644 --- a/aws/resource_aws_ssm_patch_baseline.go +++ b/aws/resource_aws_ssm_patch_baseline.go @@ -206,13 +206,18 @@ func resourceAwsSsmPatchBaseline() *schema.Resource { }, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsSsmPatchBaselineCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ssmconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) params := &ssm.CreatePatchBaselineInput{ Name: aws.String(d.Get("name").(string)), @@ -220,8 +225,8 @@ func resourceAwsSsmPatchBaselineCreate(d *schema.ResourceData, meta interface{}) OperatingSystem: aws.String(d.Get("operating_system").(string)), } - if v, ok := d.GetOk("tags"); ok { - params.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().SsmTags() + if len(tags) > 0 { + params.Tags = tags.IgnoreAws().SsmTags() } if v, ok := d.GetOk("description"); ok { @@ -313,15 +318,15 @@ func resourceAwsSsmPatchBaselineUpdate(d *schema.ResourceData, meta interface{}) params.RejectedPatchesAction = aws.String(d.Get("rejected_patches_action").(string)) } - if d.HasChangesExcept("tags") { + if d.HasChangesExcept("tags", "tags_all") { _, err := conn.UpdatePatchBaseline(params) if err != nil { return fmt.Errorf("error updating SSM Patch Baseline (%s): %w", d.Id(), err) } } - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SsmUpdateTags(conn, d.Id(), ssm.ResourceTypeForTaggingPatchBaseline, o, n); err != nil { return fmt.Errorf("error updating SSM Patch Baseline (%s) tags: %s", d.Id(), err) @@ -332,6 +337,7 @@ func resourceAwsSsmPatchBaselineUpdate(d *schema.ResourceData, meta interface{}) } func resourceAwsSsmPatchBaselineRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ssmconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig params := &ssm.GetPatchBaselineInput{ @@ -384,8 +390,15 @@ func resourceAwsSsmPatchBaselineRead(d *schema.ResourceData, meta interface{}) e return fmt.Errorf("error listing tags for SSM Patch Baseline (%s): %s", d.Id(), err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } return nil diff --git a/aws/resource_aws_ssoadmin_permission_set.go b/aws/resource_aws_ssoadmin_permission_set.go index 15da5c76fc1..e96cc7cf479 100644 --- a/aws/resource_aws_ssoadmin_permission_set.go +++ b/aws/resource_aws_ssoadmin_permission_set.go @@ -80,13 +80,18 @@ func resourceAwsSsoAdminPermissionSet() *schema.Resource { Default: "PT1H", }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsSsoAdminPermissionSetCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ssoadminconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) instanceArn := d.Get("instance_arn").(string) name := d.Get("name").(string) @@ -108,8 +113,8 @@ func resourceAwsSsoAdminPermissionSetCreate(d *schema.ResourceData, meta interfa input.SessionDuration = aws.String(v.(string)) } - if v, ok := d.GetOk("tags"); ok { - input.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().SsoadminTags() + if len(tags) > 0 { + input.Tags = tags.IgnoreAws().SsoadminTags() } output, err := conn.CreatePermissionSet(input) @@ -128,6 +133,7 @@ func resourceAwsSsoAdminPermissionSetCreate(d *schema.ResourceData, meta interfa func resourceAwsSsoAdminPermissionSetRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ssoadminconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig arn, instanceArn, err := parseSsoAdminResourceID(d.Id()) @@ -169,10 +175,17 @@ func resourceAwsSsoAdminPermissionSetRead(d *schema.ResourceData, meta interface return fmt.Errorf("error listing tags for SSO Permission Set (%s): %w", arn, err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %w", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) + } + return nil } @@ -213,8 +226,8 @@ func resourceAwsSsoAdminPermissionSetUpdate(d *schema.ResourceData, meta interfa } } - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SsoadminUpdateTags(conn, arn, instanceArn, o, n); err != nil { return fmt.Errorf("error updating tags: %w", err) } diff --git a/aws/resource_aws_storagegateway_cached_iscsi_volume.go b/aws/resource_aws_storagegateway_cached_iscsi_volume.go index 0993ef18097..afd61d8938a 100644 --- a/aws/resource_aws_storagegateway_cached_iscsi_volume.go +++ b/aws/resource_aws_storagegateway_cached_iscsi_volume.go @@ -86,7 +86,8 @@ func resourceAwsStorageGatewayCachedIscsiVolume() *schema.Resource { Required: true, ForceNew: true, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), "kms_encrypted": { Type: schema.TypeBool, Optional: true, @@ -100,11 +101,15 @@ func resourceAwsStorageGatewayCachedIscsiVolume() *schema.Resource { RequiredWith: []string{"kms_encrypted"}, }, }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsStorageGatewayCachedIscsiVolumeCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).storagegatewayconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) input := &storagegateway.CreateCachediSCSIVolumeInput{ ClientToken: aws.String(resource.UniqueId()), @@ -112,7 +117,7 @@ func resourceAwsStorageGatewayCachedIscsiVolumeCreate(d *schema.ResourceData, me NetworkInterfaceId: aws.String(d.Get("network_interface_id").(string)), TargetName: aws.String(d.Get("target_name").(string)), VolumeSizeInBytes: aws.Int64(int64(d.Get("volume_size_in_bytes").(int))), - Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().StoragegatewayTags(), + Tags: tags.IgnoreAws().StoragegatewayTags(), } if v, ok := d.GetOk("snapshot_id"); ok { @@ -145,8 +150,8 @@ func resourceAwsStorageGatewayCachedIscsiVolumeCreate(d *schema.ResourceData, me func resourceAwsStorageGatewayCachedIscsiVolumeUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).storagegatewayconn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.StoragegatewayUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating tags: %s", err) } @@ -157,6 +162,7 @@ func resourceAwsStorageGatewayCachedIscsiVolumeUpdate(d *schema.ResourceData, me func resourceAwsStorageGatewayCachedIscsiVolumeRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).storagegatewayconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig input := &storagegateway.DescribeCachediSCSIVolumesInput{ @@ -200,8 +206,15 @@ func resourceAwsStorageGatewayCachedIscsiVolumeRead(d *schema.ResourceData, meta if err != nil { return fmt.Errorf("error listing tags for resource (%s): %s", arn, err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } if volume.VolumeiSCSIAttributes != nil { diff --git a/aws/resource_aws_storagegateway_gateway.go b/aws/resource_aws_storagegateway_gateway.go index 4c0cd665403..5c9a2ecce52 100644 --- a/aws/resource_aws_storagegateway_gateway.go +++ b/aws/resource_aws_storagegateway_gateway.go @@ -29,6 +29,7 @@ func resourceAwsStorageGatewayGateway() *schema.Resource { customdiff.ForceNewIfChange("smb_active_directory_settings", func(_ context.Context, old, new, meta interface{}) bool { return len(old.([]interface{})) == 1 && len(new.([]interface{})) == 0 }), + SetTagsDiff, ), Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, @@ -181,7 +182,8 @@ func resourceAwsStorageGatewayGateway() *schema.Resource { "IBM-ULT3580-TD5", }, false), }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), "cloudwatch_log_group_arn": { Type: schema.TypeString, Optional: true, @@ -237,6 +239,8 @@ func resourceAwsStorageGatewayGateway() *schema.Resource { func resourceAwsStorageGatewayGatewayCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).storagegatewayconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) region := meta.(*AWSClient).region activationKey := d.Get("activation_key").(string) @@ -320,7 +324,7 @@ func resourceAwsStorageGatewayGatewayCreate(d *schema.ResourceData, meta interfa GatewayName: aws.String(d.Get("gateway_name").(string)), GatewayTimezone: aws.String(d.Get("gateway_timezone").(string)), GatewayType: aws.String(d.Get("gateway_type").(string)), - Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().StoragegatewayTags(), + Tags: tags.IgnoreAws().StoragegatewayTags(), } if v, ok := d.GetOk("medium_changer_type"); ok { @@ -433,6 +437,7 @@ func resourceAwsStorageGatewayGatewayCreate(d *schema.ResourceData, meta interfa func resourceAwsStorageGatewayGatewayRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).storagegatewayconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig input := &storagegateway.DescribeGatewayInformationInput{ @@ -452,10 +457,17 @@ func resourceAwsStorageGatewayGatewayRead(d *schema.ResourceData, meta interface return fmt.Errorf("error reading Storage Gateway Gateway: %w", err) } - if err := d.Set("tags", keyvaluetags.StoragegatewayKeyValueTags(output.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags := keyvaluetags.StoragegatewayKeyValueTags(output.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %w", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) + } + smbSettingsInput := &storagegateway.DescribeSMBSettingsInput{ GatewayARN: aws.String(d.Id()), } @@ -587,8 +599,8 @@ func resourceAwsStorageGatewayGatewayUpdate(d *schema.ResourceData, meta interfa } } - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.StoragegatewayUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating tags: %w", err) } diff --git a/aws/resource_aws_storagegateway_nfs_file_share.go b/aws/resource_aws_storagegateway_nfs_file_share.go index 36ef82b6990..eab6931c13b 100644 --- a/aws/resource_aws_storagegateway_nfs_file_share.go +++ b/aws/resource_aws_storagegateway_nfs_file_share.go @@ -189,13 +189,18 @@ func resourceAwsStorageGatewayNfsFileShare() *schema.Resource { validation.StringLenBetween(2, 100), ), }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsStorageGatewayNfsFileShareCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).storagegatewayconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) fileShareDefaults, err := expandStorageGatewayNfsFileShareDefaults(d.Get("nfs_file_share_defaults").([]interface{})) if err != nil { @@ -216,7 +221,7 @@ func resourceAwsStorageGatewayNfsFileShareCreate(d *schema.ResourceData, meta in RequesterPays: aws.Bool(d.Get("requester_pays").(bool)), Role: aws.String(d.Get("role_arn").(string)), Squash: aws.String(d.Get("squash").(string)), - Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().StoragegatewayTags(), + Tags: tags.IgnoreAws().StoragegatewayTags(), } if v, ok := d.GetOk("kms_key_arn"); ok { @@ -252,6 +257,7 @@ func resourceAwsStorageGatewayNfsFileShareCreate(d *schema.ResourceData, meta in func resourceAwsStorageGatewayNfsFileShareRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).storagegatewayconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig input := &storagegateway.DescribeNFSFileSharesInput{ @@ -309,18 +315,25 @@ func resourceAwsStorageGatewayNfsFileShareRead(d *schema.ResourceData, meta inte d.Set("squash", fileshare.Squash) d.Set("notification_policy", fileshare.NotificationPolicy) - if err := d.Set("tags", keyvaluetags.StoragegatewayKeyValueTags(fileshare.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags := keyvaluetags.StoragegatewayKeyValueTags(fileshare.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %w", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) + } + return nil } func resourceAwsStorageGatewayNfsFileShareUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).storagegatewayconn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.StoragegatewayUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating tags: %w", err) } diff --git a/aws/resource_aws_storagegateway_smb_file_share.go b/aws/resource_aws_storagegateway_smb_file_share.go index dbb2cec31ea..9d01013cc40 100644 --- a/aws/resource_aws_storagegateway_smb_file_share.go +++ b/aws/resource_aws_storagegateway_smb_file_share.go @@ -179,13 +179,18 @@ func resourceAwsStorageGatewaySmbFileShare() *schema.Resource { validation.StringLenBetween(2, 100), ), }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsStorageGatewaySmbFileShareCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).storagegatewayconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) input := &storagegateway.CreateSMBFileShareInput{ Authentication: aws.String(d.Get("authentication").(string)), @@ -203,7 +208,7 @@ func resourceAwsStorageGatewaySmbFileShareCreate(d *schema.ResourceData, meta in CaseSensitivity: aws.String(d.Get("case_sensitivity").(string)), ValidUserList: expandStringSet(d.Get("valid_user_list").(*schema.Set)), AdminUserList: expandStringSet(d.Get("admin_user_list").(*schema.Set)), - Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().StoragegatewayTags(), + Tags: tags.IgnoreAws().StoragegatewayTags(), } if v, ok := d.GetOk("kms_key_arn"); ok { @@ -251,6 +256,7 @@ func resourceAwsStorageGatewaySmbFileShareCreate(d *schema.ResourceData, meta in func resourceAwsStorageGatewaySmbFileShareRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).storagegatewayconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig input := &storagegateway.DescribeSMBFileSharesInput{ @@ -315,18 +321,25 @@ func resourceAwsStorageGatewaySmbFileShareRead(d *schema.ResourceData, meta inte return fmt.Errorf("error setting admin_user_list: %s", err) } - if err := d.Set("tags", keyvaluetags.StoragegatewayKeyValueTags(fileshare.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags := keyvaluetags.StoragegatewayKeyValueTags(fileshare.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %w", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) + } + return nil } func resourceAwsStorageGatewaySmbFileShareUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).storagegatewayconn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.StoragegatewayUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating tags: %w", err) } diff --git a/aws/resource_aws_storagegateway_stored_iscsi_volume.go b/aws/resource_aws_storagegateway_stored_iscsi_volume.go index 5ad15d6681d..a2418377b95 100644 --- a/aws/resource_aws_storagegateway_stored_iscsi_volume.go +++ b/aws/resource_aws_storagegateway_stored_iscsi_volume.go @@ -108,13 +108,18 @@ func resourceAwsStorageGatewayStoredIscsiVolume() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsStorageGatewayStoredIscsiVolumeCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).storagegatewayconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) input := &storagegateway.CreateStorediSCSIVolumeInput{ DiskId: aws.String(d.Get("disk_id").(string)), @@ -122,7 +127,7 @@ func resourceAwsStorageGatewayStoredIscsiVolumeCreate(d *schema.ResourceData, me NetworkInterfaceId: aws.String(d.Get("network_interface_id").(string)), TargetName: aws.String(d.Get("target_name").(string)), PreserveExistingData: aws.Bool(d.Get("preserve_existing_data").(bool)), - Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().StoragegatewayTags(), + Tags: tags.IgnoreAws().StoragegatewayTags(), } if v, ok := d.GetOk("snapshot_id"); ok { @@ -157,8 +162,8 @@ func resourceAwsStorageGatewayStoredIscsiVolumeCreate(d *schema.ResourceData, me func resourceAwsStorageGatewayStoredIscsiVolumeUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).storagegatewayconn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.StoragegatewayUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating tags: %w", err) } @@ -169,6 +174,7 @@ func resourceAwsStorageGatewayStoredIscsiVolumeUpdate(d *schema.ResourceData, me func resourceAwsStorageGatewayStoredIscsiVolumeRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).storagegatewayconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig input := &storagegateway.DescribeStorediSCSIVolumesInput{ @@ -212,10 +218,17 @@ func resourceAwsStorageGatewayStoredIscsiVolumeRead(d *schema.ResourceData, meta if err != nil { return fmt.Errorf("error listing tags for resource (%s): %w", arn, err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %w", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) + } + attr := volume.VolumeiSCSIAttributes d.Set("chap_enabled", attr.ChapEnabled) d.Set("lun_number", attr.LunNumber) diff --git a/aws/resource_aws_storagegateway_tape_pool.go b/aws/resource_aws_storagegateway_tape_pool.go index 5677bd5fd33..c2dc19a7cca 100644 --- a/aws/resource_aws_storagegateway_tape_pool.go +++ b/aws/resource_aws_storagegateway_tape_pool.go @@ -52,20 +52,25 @@ func resourceAwsStorageGatewayTapePool() *schema.Resource { Default: 0, ValidateFunc: validation.IntBetween(0, 36500), }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsStorageGatewayTapePoolCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).storagegatewayconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) input := &storagegateway.CreateTapePoolInput{ PoolName: aws.String(d.Get("pool_name").(string)), StorageClass: aws.String(d.Get("storage_class").(string)), RetentionLockType: aws.String(d.Get("retention_lock_type").(string)), RetentionLockTimeInDays: aws.Int64(int64(d.Get("retention_lock_time_in_days").(int))), - Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().StoragegatewayTags(), + Tags: tags.IgnoreAws().StoragegatewayTags(), } log.Printf("[DEBUG] Creating Storage Gateway Tape Pool: %s", input) @@ -82,8 +87,8 @@ func resourceAwsStorageGatewayTapePoolCreate(d *schema.ResourceData, meta interf func resourceAwsStorageGatewayTapePoolUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).storagegatewayconn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.StoragegatewayUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating tags: %w", err) } @@ -94,6 +99,7 @@ func resourceAwsStorageGatewayTapePoolUpdate(d *schema.ResourceData, meta interf func resourceAwsStorageGatewayTapePoolRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).storagegatewayconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig input := &storagegateway.ListTapePoolsInput{ @@ -126,10 +132,17 @@ func resourceAwsStorageGatewayTapePoolRead(d *schema.ResourceData, meta interfac if err != nil { return fmt.Errorf("error listing tags for resource (%s): %w", poolArn, err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %w", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) + } + return nil } diff --git a/aws/resource_aws_swf_domain.go b/aws/resource_aws_swf_domain.go index 0c872820bc4..b9f533dab59 100644 --- a/aws/resource_aws_swf_domain.go +++ b/aws/resource_aws_swf_domain.go @@ -58,13 +58,18 @@ func resourceAwsSwfDomain() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsSwfDomainCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).swfconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) var name string @@ -79,7 +84,7 @@ func resourceAwsSwfDomainCreate(d *schema.ResourceData, meta interface{}) error input := &swf.RegisterDomainInput{ Name: aws.String(name), WorkflowExecutionRetentionPeriodInDays: aws.String(d.Get("workflow_execution_retention_period_in_days").(string)), - Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().SwfTags(), + Tags: tags.IgnoreAws().SwfTags(), } if v, ok := d.GetOk("description"); ok { @@ -98,6 +103,7 @@ func resourceAwsSwfDomainCreate(d *schema.ResourceData, meta interface{}) error func resourceAwsSwfDomainRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).swfconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig input := &swf.DescribeDomainInput{ @@ -127,8 +133,15 @@ func resourceAwsSwfDomainRead(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("error listing tags for SWF Domain (%s): %s", arn, err) } - if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + tags = tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) } d.Set("arn", resp.DomainInfo.Arn) @@ -142,8 +155,8 @@ func resourceAwsSwfDomainRead(d *schema.ResourceData, meta interface{}) error { func resourceAwsSwfDomainUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).swfconn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SwfUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating SWF Domain (%s) tags: %s", d.Id(), err) diff --git a/aws/resource_aws_synthetics_canary.go b/aws/resource_aws_synthetics_canary.go index eb109806e8c..6b5c1d8eb96 100644 --- a/aws/resource_aws_synthetics_canary.go +++ b/aws/resource_aws_synthetics_canary.go @@ -162,7 +162,8 @@ func resourceAwsSyntheticsCanary() *schema.Resource { Default: 31, ValidateFunc: validation.IntBetween(1, 455), }, - "tags": tagsSchema(), + "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), "timeline": { Type: schema.TypeList, Computed: true, @@ -216,11 +217,15 @@ func resourceAwsSyntheticsCanary() *schema.Resource { ConflictsWith: []string{"s3_bucket", "s3_key", "s3_version"}, }, }, + + CustomizeDiff: SetTagsDiff, } } func resourceAwsSyntheticsCanaryCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).syntheticsconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) input := &synthetics.CreateCanaryInput{ Name: aws.String(d.Get("name").(string)), @@ -236,8 +241,8 @@ func resourceAwsSyntheticsCanaryCreate(d *schema.ResourceData, meta interface{}) input.Code = code - if v := d.Get("tags").(map[string]interface{}); len(v) > 0 { - input.Tags = keyvaluetags.New(v).IgnoreAws().SyntheticsTags() + if len(tags) > 0 { + input.Tags = tags.IgnoreAws().SyntheticsTags() } if v, ok := d.GetOk("run_config"); ok { @@ -328,6 +333,7 @@ func resourceAwsSyntheticsCanaryCreate(d *schema.ResourceData, meta interface{}) func resourceAwsSyntheticsCanaryRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).syntheticsconn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig resp, err := finder.CanaryByName(conn, d.Id()) @@ -378,10 +384,17 @@ func resourceAwsSyntheticsCanaryRead(d *schema.ResourceData, meta interface{}) e return fmt.Errorf("error setting schedule: %w", err) } - if err := d.Set("tags", keyvaluetags.SyntheticsKeyValueTags(canary.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags := keyvaluetags.SyntheticsKeyValueTags(canary.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %w", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) + } + return nil } @@ -478,8 +491,8 @@ func resourceAwsSyntheticsCanaryUpdate(d *schema.ResourceData, meta interface{}) } } - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.SyntheticsUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { return fmt.Errorf("error updating Synthetics Canary (%s) tags: %w", d.Id(), err) diff --git a/website/docs/r/s3_bucket.html.markdown b/website/docs/r/s3_bucket.html.markdown index 166e496ae0a..9d502db21c7 100644 --- a/website/docs/r/s3_bucket.html.markdown +++ b/website/docs/r/s3_bucket.html.markdown @@ -343,7 +343,7 @@ The following arguments are supported: * `grant` - (Optional) An [ACL policy grant](https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#sample-acl) (documented below). Conflicts with `acl`. * `policy` - (Optional) A valid [bucket policy](https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html) JSON document. Note that if the policy document is not specific enough (but still valid), Terraform may view the policy as constantly changing in a `terraform plan`. In this case, please make sure you use the verbose/specific version of the policy. For more information about building AWS IAM policy documents with Terraform, see the [AWS IAM Policy Document Guide](https://learn.hashicorp.com/terraform/aws/iam-policy). -* `tags` - (Optional) A map of tags to assign to the bucket. +* `tags` - (Optional) A map of tags to assign to the bucket. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. * `force_destroy` - (Optional, Default:`false`) A boolean that indicates all objects (including any [locked objects](https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock-overview.html)) should be deleted from the bucket so that the bucket can be destroyed without error. These objects are *not* recoverable. * `website` - (Optional) A website object (documented below). * `cors_rule` - (Optional) A rule of [Cross-Origin Resource Sharing](https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html) (documented below). @@ -527,6 +527,7 @@ In addition to all arguments above, the following attributes are exported: * `bucket_regional_domain_name` - The bucket region-specific domain name. The bucket domain name including the region name, please refer [here](https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) for format. Note: The AWS CloudFront allows specifying S3 region-specific endpoint when creating S3 origin, it will prevent [redirect issues](https://forums.aws.amazon.com/thread.jspa?threadID=216814) from CloudFront to S3 Origin URL. * `hosted_zone_id` - The [Route 53 Hosted Zone ID](https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_website_region_endpoints) for this bucket's region. * `region` - The AWS region this bucket resides in. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). * `website_endpoint` - The website endpoint, if the bucket is configured with a website. If not, this will be an empty string. * `website_domain` - The domain of the website endpoint, if the bucket is configured with a website. If not, this will be an empty string. This is used to create Route 53 alias records. diff --git a/website/docs/r/s3_bucket_object.html.markdown b/website/docs/r/s3_bucket_object.html.markdown index 968a1f9a4d1..6bbd9dfa11c 100644 --- a/website/docs/r/s3_bucket_object.html.markdown +++ b/website/docs/r/s3_bucket_object.html.markdown @@ -137,7 +137,7 @@ This attribute is not compatible with KMS encryption, `kms_key_id` or `server_si is provided. * `bucket_key_enabled` - (Optional) Whether or not to use [Amazon S3 Bucket Keys](https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-key.html) for SSE-KMS. * `metadata` - (Optional) A map of keys/values to provision metadata (will be automatically prefixed by `x-amz-meta-`, note that only lowercase label are currently supported by the AWS Go API). -* `tags` - (Optional) A map of tags to assign to the object. +* `tags` - (Optional) A map of tags to assign to the object. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. * `force_destroy` - (Optional) Allow the object to be deleted by removing any legal hold on any object version. Default is `false`. This value should be set to `true` only if the bucket has S3 object lock enabled. * `object_lock_legal_hold_status` - (Optional) The [legal hold](https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock-overview.html#object-lock-legal-holds) status that you want to apply to the specified object. Valid values are `ON` and `OFF`. @@ -154,5 +154,6 @@ In addition to all arguments above, the following attributes are exported: * `id` - the `key` of the resource supplied above * `etag` - the ETag generated for the object (an MD5 sum of the object content). For plaintext objects or objects encrypted with an AWS-managed key, the hash is an MD5 digest of the object data. For objects encrypted with a KMS key or objects created by either the Multipart Upload or Part Copy operation, the hash is not an MD5 digest, regardless of the method of encryption. More information on possible values can be found on [Common Response Headers](https://docs.aws.amazon.com/AmazonS3/latest/API/RESTCommonResponseHeaders.html). +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). * `version_id` - A unique version ID value for the object, if bucket versioning is enabled. diff --git a/website/docs/r/s3_object_copy.html.markdown b/website/docs/r/s3_object_copy.html.markdown index 76b05e18ee5..5c5e4764729 100644 --- a/website/docs/r/s3_object_copy.html.markdown +++ b/website/docs/r/s3_object_copy.html.markdown @@ -69,7 +69,7 @@ The following arguments are optional: * `storage_class` - (Optional) Specifies the desired [Storage Class](http://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html) for the object. Can be either `STANDARD`, `REDUCED_REDUNDANCY`, `ONEZONE_IA`, `INTELLIGENT_TIERING`, `GLACIER`, `DEEP_ARCHIVE`, or `STANDARD_IA`. Defaults to `STANDARD`. * `tagging_directive` - (Optional) Specifies whether the object tag-set are copied from the source object or replaced with tag-set provided in the request. Valid values are `COPY` and `REPLACE`. -* `tags` - (Optional) A map of tags to assign to the object. +* `tags` - (Optional) A map of tags to assign to the object. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. * `website_redirect` - (Optional) Specifies a target URL for [website redirect](http://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html). ### grant @@ -99,4 +99,5 @@ In addition to all arguments above, the following attributes are exported: * `last_modified` - Returns the date that the object was last modified, in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8). * `request_charged` - If present, indicates that the requester was successfully charged for the request. * `source_version_id` - Version of the copied object in the source bucket. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). * `version_id` - Version ID of the newly created copy. diff --git a/website/docs/r/s3control_bucket.html.markdown b/website/docs/r/s3control_bucket.html.markdown index 874cf779010..771e86d0225 100644 --- a/website/docs/r/s3control_bucket.html.markdown +++ b/website/docs/r/s3control_bucket.html.markdown @@ -27,7 +27,7 @@ The following arguments are required: * `bucket` - (Required) Name of the bucket. * `outpost_id` - (Required) Identifier of the Outpost to contain this bucket. -* `tags` - (Optional) Key-value map of resource tags. +* `tags` - (Optional) Key-value map of resource tags. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference @@ -37,6 +37,7 @@ In addition to all arguments above, the following attributes are exported: * `creation_date` - UTC creation date in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8). * `id` - Amazon Resource Name (ARN) of the bucket. * `public_access_block_enabled` - Boolean whether Public Access Block is enabled. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/sagemaker_app.html.markdown b/website/docs/r/sagemaker_app.html.markdown index c14b69bb1d8..4c19dcba3e1 100644 --- a/website/docs/r/sagemaker_app.html.markdown +++ b/website/docs/r/sagemaker_app.html.markdown @@ -32,7 +32,7 @@ The following arguments are supported: * `domain_id` - (Required) The domain ID. * `user_profile_name` - (Required) The user profile name. * `resource_spec` - (Optional) The instance type and the Amazon Resource Name (ARN) of the SageMaker image created on the instance.See [Resource Spec](#resource-spec) below. -* `tags` - (Optional) A map of tags to assign to the resource. +* `tags` - (Optional) A map of tags to assign to the resource. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ### Resource Spec @@ -46,6 +46,7 @@ In addition to all arguments above, the following attributes are exported: * `id` - The Amazon Resource Name (ARN) of the app. * `arn` - The Amazon Resource Name (ARN) of the app. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/sagemaker_domain.html.markdown b/website/docs/r/sagemaker_domain.html.markdown index 86c55cfc21e..2bd8a25252d 100644 --- a/website/docs/r/sagemaker_domain.html.markdown +++ b/website/docs/r/sagemaker_domain.html.markdown @@ -97,7 +97,7 @@ The following arguments are supported: * `default_user_settings` - (Required) The default user settings. See [Default User Settings](#default-user-settings) below. * `kms_key_id` - (Optional) The AWS KMS customer managed CMK used to encrypt the EFS volume attached to the domain. * `app_network_access_type` - (Optional) Specifies the VPC used for non-EFS traffic. The default value is `PublicInternetOnly`. Valid values are `PublicInternetOnly` and `VpcOnly`. -* `tags` - (Optional) A map of tags to assign to the resource. +* `tags` - (Optional) A map of tags to assign to the resource. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ### Default User Settings @@ -147,6 +147,7 @@ In addition to all arguments above, the following attributes are exported: * `url` - The domain's URL. * `single_sign_on_managed_application_instance_id` - The SSO managed application instance ID. * `home_efs_file_system_id` - The ID of the Amazon Elastic File System (EFS) managed by this Domain. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/sagemaker_endpoint.html.markdown b/website/docs/r/sagemaker_endpoint.html.markdown index 4b43829e82c..2ec372ceb33 100644 --- a/website/docs/r/sagemaker_endpoint.html.markdown +++ b/website/docs/r/sagemaker_endpoint.html.markdown @@ -31,7 +31,7 @@ The following arguments are supported: * `endpoint_config_name` - (Required) The name of the endpoint configuration to use. * `name` - (Optional) The name of the endpoint. If omitted, Terraform will assign a random, unique name. -* `tags` - (Optional) A map of tags to assign to the resource. +* `tags` - (Optional) A map of tags to assign to the resource. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference @@ -39,6 +39,7 @@ In addition to all arguments above, the following attributes are exported: * `arn` - The Amazon Resource Name (ARN) assigned by AWS to this endpoint. * `name` - The name of the endpoint. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/sagemaker_endpoint_configuration.html.markdown b/website/docs/r/sagemaker_endpoint_configuration.html.markdown index e4d95b18db8..1134bb51a0f 100644 --- a/website/docs/r/sagemaker_endpoint_configuration.html.markdown +++ b/website/docs/r/sagemaker_endpoint_configuration.html.markdown @@ -39,7 +39,7 @@ The following arguments are supported: * `production_variants` - (Required) Fields are documented below. * `kms_key_arn` - (Optional) Amazon Resource Name (ARN) of a AWS Key Management Service key that Amazon SageMaker uses to encrypt data on the storage volume attached to the ML compute instance that hosts the endpoint. * `name` - (Optional) The name of the endpoint configuration. If omitted, Terraform will assign a random, unique name. -* `tags` - (Optional) A mapping of tags to assign to the resource. +* `tags` - (Optional) A mapping of tags to assign to the resource. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. * `data_capture_config` - (Optional) Specifies the parameters to capture input/output of Sagemaker models endpoints. Fields are documented below. The `production_variants` block supports: @@ -75,6 +75,7 @@ In addition to all arguments above, the following attributes are exported: * `arn` - The Amazon Resource Name (ARN) assigned by AWS to this endpoint configuration. * `name` - The name of the endpoint configuration. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/sagemaker_feature_group.html.markdown b/website/docs/r/sagemaker_feature_group.html.markdown index 3913eb6475a..26ba3307437 100644 --- a/website/docs/r/sagemaker_feature_group.html.markdown +++ b/website/docs/r/sagemaker_feature_group.html.markdown @@ -44,6 +44,7 @@ The following arguments are supported: * `feature_definition` (Optional) - A list of Feature names and types. See [Feature Definition](#feature-definition) Below. * `offline_store_config` (Optional) - The Offline Feature Store Configuration. See [Offline Store Config](#offline-store-config) Below. * `online_store_config` (Optional) - The Online Feature Store Configuration. See [Online Store Config](#online-store-config) Below. +* `tags` - (Optional) Map of resource tags for the resource. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ### Feature Definition @@ -82,6 +83,7 @@ In addition to all arguments above, the following attributes are exported: * `name` - The name of the Feature Group. * `arn` - The Amazon Resource Name (ARN) assigned by AWS to this feature_group. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/sagemaker_image.html.markdown b/website/docs/r/sagemaker_image.html.markdown index 283fdef6225..9937e722457 100644 --- a/website/docs/r/sagemaker_image.html.markdown +++ b/website/docs/r/sagemaker_image.html.markdown @@ -29,7 +29,7 @@ The following arguments are supported: * `role_arn` - (Required) The Amazon Resource Name (ARN) of an IAM role that enables Amazon SageMaker to perform tasks on your behalf. * `display_name` - (Optional) The display name of the image. When the image is added to a domain (must be unique to the domain). * `description` - (Optional) The description of the image. -* `tags` - (Optional) A map of tags to assign to the resource. +* `tags` - (Optional) A map of tags to assign to the resource. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference @@ -37,6 +37,7 @@ In addition to all arguments above, the following attributes are exported: * `id` - The name of the Image. * `arn` - The Amazon Resource Name (ARN) assigned by AWS to this Image. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/sagemaker_model.html.markdown b/website/docs/r/sagemaker_model.html.markdown index b34405d565d..03e99639e1c 100644 --- a/website/docs/r/sagemaker_model.html.markdown +++ b/website/docs/r/sagemaker_model.html.markdown @@ -50,7 +50,7 @@ The following arguments are supported: * `container` (Optional) - Specifies containers in the inference pipeline. If not specified, the `primary_container` argument is required. Fields are documented below. * `enable_network_isolation` (Optional) - Isolates the model container. No inbound or outbound network calls can be made to or from the model container. * `vpc_config` (Optional) - Specifies the VPC that you want your model to connect to. VpcConfig is used in hosting services and in batch transform. -* `tags` - (Optional) A map of tags to assign to the resource. +* `tags` - (Optional) A map of tags to assign to the resource. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. The `primary_container` and `container` block both support: @@ -72,6 +72,7 @@ In addition to all arguments above, the following attributes are exported: * `name` - The name of the model. * `arn` - The Amazon Resource Name (ARN) assigned by AWS to this model. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/sagemaker_model_package_group.html.markdown b/website/docs/r/sagemaker_model_package_group.html.markdown index db0b4b35446..a7382bb3cc3 100644 --- a/website/docs/r/sagemaker_model_package_group.html.markdown +++ b/website/docs/r/sagemaker_model_package_group.html.markdown @@ -26,7 +26,7 @@ The following arguments are supported: * `model_package_group_name` - (Required) The name of the model group. * `model_package_group_description` - (Optional) A description for the model group. -* `tags` - (Optional) A map of tags to assign to the resource. +* `tags` - (Optional) A map of tags to assign to the resource. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference @@ -34,6 +34,7 @@ In addition to all arguments above, the following attributes are exported: * `id` - The name of the Model Package Group. * `arn` - The Amazon Resource Name (ARN) assigned by AWS to this Model Package Group. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/sagemaker_notebook_instance.html.markdown b/website/docs/r/sagemaker_notebook_instance.html.markdown index 1f9e7586a8b..e2157d38953 100644 --- a/website/docs/r/sagemaker_notebook_instance.html.markdown +++ b/website/docs/r/sagemaker_notebook_instance.html.markdown @@ -66,7 +66,7 @@ The following arguments are supported: * `additional_code_repositories` - (Optional) An array of up to three Git repositories to associate with the notebook instance. These can be either the names of Git repositories stored as resources in your account, or the URL of Git repositories in [AWS CodeCommit](https://docs.aws.amazon.com/codecommit/latest/userguide/welcome.html) or in any other Git repository. These repositories are cloned at the same level as the default repository of your notebook instance. * `default_code_repository` - (Optional) The Git repository associated with the notebook instance as its default code repository. This can be either the name of a Git repository stored as a resource in your account, or the URL of a Git repository in [AWS CodeCommit](https://docs.aws.amazon.com/codecommit/latest/userguide/welcome.html) or in any other Git repository. -* `tags` - (Optional) A map of tags to assign to the resource. +* `tags` - (Optional) A map of tags to assign to the resource. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference @@ -76,6 +76,7 @@ In addition to all arguments above, the following attributes are exported: * `arn` - The Amazon Resource Name (ARN) assigned by AWS to this notebook instance. * `url` - The URL that you use to connect to the Jupyter notebook that is running in your notebook instance. * `network_interface_id` - The network interface ID that Amazon SageMaker created at the time of creating the instance. Only available when setting `subnet_id`. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/sagemaker_user_profile.html.markdown b/website/docs/r/sagemaker_user_profile.html.markdown index 151f329db13..8a38fa0fe6d 100644 --- a/website/docs/r/sagemaker_user_profile.html.markdown +++ b/website/docs/r/sagemaker_user_profile.html.markdown @@ -30,7 +30,7 @@ The following arguments are supported: * `single_sign_on_user_identifier` - (Optional) A specifier for the type of value specified in `single_sign_on_user_value`. Currently, the only supported value is `UserName`. If the Domain's AuthMode is SSO, this field is required. If the Domain's AuthMode is not SSO, this field cannot be specified. * `single_sign_on_user_value` - (Required) The username of the associated AWS Single Sign-On User for this User Profile. If the Domain's AuthMode is SSO, this field is required, and must match a valid username of a user in your directory. If the Domain's AuthMode is not SSO, this field cannot be specified. * `user_settings` - (Required) The user settings. See [User Settings](#user-settings) below. -* `tags` - (Optional) A map of tags to assign to the resource. +* `tags` - (Optional) A map of tags to assign to the resource. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ### User Settings @@ -78,6 +78,7 @@ In addition to all arguments above, the following attributes are exported: * `id` - The user profile Amazon Resource Name (ARN). * `arn` - The user profile Amazon Resource Name (ARN). * `home_efs_file_system_uid` - The ID of the user's profile in the Amazon Elastic File System (EFS) volume. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/secretsmanager_secret.html.markdown b/website/docs/r/secretsmanager_secret.html.markdown index 24ef93f62ec..e08788089b3 100644 --- a/website/docs/r/secretsmanager_secret.html.markdown +++ b/website/docs/r/secretsmanager_secret.html.markdown @@ -51,7 +51,7 @@ The following arguments are supported: * `recovery_window_in_days` - (Optional) Specifies the number of days that AWS Secrets Manager waits before it can delete the secret. This value can be `0` to force deletion without recovery or range from `7` to `30` days. The default value is `30`. * `rotation_lambda_arn` - (Optional, **DEPRECATED**) Specifies the ARN of the Lambda function that can rotate the secret. Use the `aws_secretsmanager_secret_rotation` resource to manage this configuration instead. As of version 2.67.0, removal of this configuration will no longer remove rotation due to supporting the new resource. Either import the new resource and remove the configuration or manually remove rotation. * `rotation_rules` - (Optional, **DEPRECATED**) A structure that defines the rotation configuration for this secret. Defined below. Use the `aws_secretsmanager_secret_rotation` resource to manage this configuration instead. As of version 2.67.0, removal of this configuration will no longer remove rotation due to supporting the new resource. Either import the new resource and remove the configuration or manually remove rotation. -* `tags` - (Optional) Specifies a key-value map of user-defined tags that are attached to the secret. +* `tags` - (Optional) Specifies a key-value map of user-defined tags that are attached to the secret. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ### rotation_rules @@ -64,6 +64,7 @@ In addition to all arguments above, the following attributes are exported: * `id` - Amazon Resource Name (ARN) of the secret. * `arn` - Amazon Resource Name (ARN) of the secret. * `rotation_enabled` - Specifies whether automatic rotation is enabled for this secret. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/security_group.html.markdown b/website/docs/r/security_group.html.markdown index ace8c405010..4f06f507907 100644 --- a/website/docs/r/security_group.html.markdown +++ b/website/docs/r/security_group.html.markdown @@ -106,7 +106,7 @@ The following arguments are supported: * `name_prefix` - (Optional, Forces new resource) Creates a unique name beginning with the specified prefix. Conflicts with `name`. * `name` - (Optional, Forces new resource) Name of the security group. If omitted, Terraform will assign a random, unique name. * `revoke_rules_on_delete` - (Optional) Instruct Terraform to revoke all of the Security Groups attached ingress and egress rules before deleting the rule itself. This is normally not needed, however certain AWS services such as Elastic Map Reduce may automatically add required rules to security groups used with the service, and those rules may contain a cyclic dependency that prevent the security groups from being destroyed without removing the dependency first. Default `false`. -* `tags` - (Optional) Map of tags to assign to the resource. +* `tags` - (Optional) Map of tags to assign to the resource. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. * `vpc_id` - (Optional, Forces new resource) VPC ID. ### ingress @@ -150,6 +150,7 @@ In addition to all arguments above, the following attributes are exported: * `arn` - ARN of the security group. * `id` - ID of the security group. * `owner_id` - Owner ID. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Timeouts diff --git a/website/docs/r/serverlessapplicationrepository_cloudformation_stack.html.markdown b/website/docs/r/serverlessapplicationrepository_cloudformation_stack.html.markdown index 305fcdf0fa7..b958d24de63 100644 --- a/website/docs/r/serverlessapplicationrepository_cloudformation_stack.html.markdown +++ b/website/docs/r/serverlessapplicationrepository_cloudformation_stack.html.markdown @@ -39,7 +39,7 @@ The following arguments are supported: * `capabilities` - (Required) A list of capabilities. Valid values are `CAPABILITY_IAM`, `CAPABILITY_NAMED_IAM`, `CAPABILITY_RESOURCE_POLICY`, or `CAPABILITY_AUTO_EXPAND` * `parameters` - (Optional) A map of Parameter structures that specify input parameters for the stack. * `semantic_version` - (Optional) The version of the application to deploy. If not supplied, deploys the latest version. -* `tags` - (Optional) A list of tags to associate with this stack. +* `tags` - (Optional) A list of tags to associate with this stack. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference @@ -47,6 +47,7 @@ In addition to all arguments above, the following attributes are exported: * `id` - A unique identifier of the stack. * `outputs` - A map of outputs from the stack. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/service_discovery_http_namespace.html.markdown b/website/docs/r/service_discovery_http_namespace.html.markdown index 1fdd7cfa314..04c914e2556 100644 --- a/website/docs/r/service_discovery_http_namespace.html.markdown +++ b/website/docs/r/service_discovery_http_namespace.html.markdown @@ -24,7 +24,7 @@ The following arguments are supported: * `name` - (Required) The name of the http namespace. * `description` - (Optional) The description that you specify for the namespace when you create it. -* `tags` - (Optional) A map of tags to assign to the namespace. +* `tags` - (Optional) A map of tags to assign to the namespace. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference @@ -32,6 +32,7 @@ In addition to all arguments above, the following attributes are exported: * `id` - The ID of a namespace. * `arn` - The ARN that Amazon Route 53 assigns to the namespace when you create it. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/service_discovery_private_dns_namespace.html.markdown b/website/docs/r/service_discovery_private_dns_namespace.html.markdown index 3f486a7a9e9..9668d4b9ec6 100644 --- a/website/docs/r/service_discovery_private_dns_namespace.html.markdown +++ b/website/docs/r/service_discovery_private_dns_namespace.html.markdown @@ -31,7 +31,7 @@ The following arguments are supported: * `name` - (Required) The name of the namespace. * `vpc` - (Required) The ID of VPC that you want to associate the namespace with. * `description` - (Optional) The description that you specify for the namespace when you create it. -* `tags` - (Optional) A map of tags to assign to the namespace. +* `tags` - (Optional) A map of tags to assign to the namespace. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference @@ -40,6 +40,7 @@ In addition to all arguments above, the following attributes are exported: * `id` - The ID of a namespace. * `arn` - The ARN that Amazon Route 53 assigns to the namespace when you create it. * `hosted_zone` - The ID for the hosted zone that Amazon Route 53 creates when you create a namespace. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/service_discovery_public_dns_namespace.html.markdown b/website/docs/r/service_discovery_public_dns_namespace.html.markdown index b07af9b837a..27cbbcee7e8 100644 --- a/website/docs/r/service_discovery_public_dns_namespace.html.markdown +++ b/website/docs/r/service_discovery_public_dns_namespace.html.markdown @@ -25,7 +25,7 @@ The following arguments are supported: * `name` - (Required) The name of the namespace. * `description` - (Optional) The description that you specify for the namespace when you create it. -* `tags` - (Optional) A map of tags to assign to the namespace. +* `tags` - (Optional) A map of tags to assign to the namespace. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference @@ -34,6 +34,7 @@ In addition to all arguments above, the following attributes are exported: * `id` - The ID of a namespace. * `arn` - The ARN that Amazon Route 53 assigns to the namespace when you create it. * `hosted_zone` - The ID for the hosted zone that Amazon Route 53 creates when you create a namespace. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/service_discovery_service.html.markdown b/website/docs/r/service_discovery_service.html.markdown index a892e4e8e70..441be6546bc 100644 --- a/website/docs/r/service_discovery_service.html.markdown +++ b/website/docs/r/service_discovery_service.html.markdown @@ -81,7 +81,7 @@ The following arguments are supported: * `health_check_config` - (Optional) A complex type that contains settings for an optional health check. Only for Public DNS namespaces. * `health_check_custom_config` - (Optional, ForceNew) A complex type that contains settings for ECS managed health checks. * `namespace_id` - (Optional) The ID of the namespace that you want to use to create the service. -* `tags` - (Optional) A map of tags to assign to the service. +* `tags` - (Optional) A map of tags to assign to the service. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ### dns_config @@ -118,6 +118,7 @@ In addition to all arguments above, the following attributes are exported: * `id` - The ID of the service. * `arn` - The ARN of the service. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/servicecatalog_portfolio.html.markdown b/website/docs/r/servicecatalog_portfolio.html.markdown index 3793a73a8f4..19907ad2665 100644 --- a/website/docs/r/servicecatalog_portfolio.html.markdown +++ b/website/docs/r/servicecatalog_portfolio.html.markdown @@ -27,13 +27,14 @@ The following arguments are supported: * `name` - (Required) The name of the portfolio. * `description` - (Required) Description of the portfolio * `provider_name` - (Required) Name of the person or organization who owns the portfolio. -* `tags` - (Optional) Tags to apply to the connection. +* `tags` - (Optional) Tags to apply to the connection. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference In addition to all arguments above, the following attributes are exported: * `id` - The ID of the Service Catalog Portfolio. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/sfn_activity.html.markdown b/website/docs/r/sfn_activity.html.markdown index 7521043d884..1c660f8c5da 100644 --- a/website/docs/r/sfn_activity.html.markdown +++ b/website/docs/r/sfn_activity.html.markdown @@ -23,7 +23,7 @@ resource "aws_sfn_activity" "sfn_activity" { The following arguments are supported: * `name` - (Required) The name of the activity to create. -* `tags` - (Optional) Key-value map of resource tags +* `tags` - (Optional) Key-value map of resource tags. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference @@ -32,6 +32,7 @@ In addition to all arguments above, the following attributes are exported: * `id` - The Amazon Resource Name (ARN) that identifies the created activity. * `name` - The name of the activity. * `creation_date` - The date the activity was created. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/sfn_state_machine.html.markdown b/website/docs/r/sfn_state_machine.html.markdown index 785560813f6..782d84129ac 100644 --- a/website/docs/r/sfn_state_machine.html.markdown +++ b/website/docs/r/sfn_state_machine.html.markdown @@ -102,7 +102,7 @@ The following arguments are supported: * `name` - (Required) The name of the state machine. * `definition` - (Required) The Amazon States Language definition of the state machine. * `role_arn` - (Required) The Amazon Resource Name (ARN) of the IAM role to use for this state machine. -* `tags` - (Optional) Key-value map of resource tags +* `tags` - (Optional) Key-value map of resource tags. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. * `logging_configuration` - (Optional) Defines what execution history events are logged and where they are logged. The `logging_configuration` parameter is only valid when `type` is set to `EXPRESS`. Defaults to `OFF`. For more information see [Logging Express Workflows](https://docs.aws.amazon.com/step-functions/latest/dg/cw-logs.html) and [Log Levels](https://docs.aws.amazon.com/step-functions/latest/dg/cloudwatch-log-level.html) in the AWS Step Functions User Guide. * `type` - (Optional) Determines whether a Standard or Express state machine is created. The default is STANDARD. You cannot update the type of a state machine once it has been created. Valid Values: STANDARD | EXPRESS @@ -120,6 +120,7 @@ In addition to all arguments above, the following attributes are exported: * `creation_date` - The date the state machine was created. * `status` - The current status of the state machine. Either "ACTIVE" or "DELETING". * `arn` - The ARN of the state machine. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/signer_signing_profile.html.markdown b/website/docs/r/signer_signing_profile.html.markdown index 2dc50bef461..eb0708b03b9 100644 --- a/website/docs/r/signer_signing_profile.html.markdown +++ b/website/docs/r/signer_signing_profile.html.markdown @@ -39,7 +39,7 @@ resource "aws_signer_signing_profile" "prod_sp" { * `name` - (Optional) A unique signing profile name. By default generated by Terraform. Signing profile names are immutable and cannot be reused after canceled. * `name_prefix` - (Optional) A signing profile name prefix. Terraform will generate a unique suffix. Conflicts with `name`. * `signature_validity_period` - (Optional) The validity period for a signing job. -* `tags` - (Optional) A list of tags associated with the signing profile. +* `tags` - (Optional) A list of tags associated with the signing profile. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference @@ -50,6 +50,7 @@ In addition to all arguments above, the following attributes are exported: * `platform_display_name` - A human-readable name for the signing platform associated with the signing profile. * `revocation_record` - Revocation information for a signing profile. * `status` - The status of the target signing profile. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). * `version` - The current version of the signing profile. * `version_arn` - The signing profile ARN, including the profile version. diff --git a/website/docs/r/sns_topic.html.markdown b/website/docs/r/sns_topic.html.markdown index 12d6da05730..3273f1e684e 100644 --- a/website/docs/r/sns_topic.html.markdown +++ b/website/docs/r/sns_topic.html.markdown @@ -92,7 +92,7 @@ The following arguments are supported: * `sqs_success_feedback_role_arn` - (Optional) The IAM role permitted to receive success feedback for this topic * `sqs_success_feedback_sample_rate` - (Optional) Percentage of success to sample * `sqs_failure_feedback_role_arn` - (Optional) IAM role for failure feedback -* `tags` - (Optional) Key-value map of resource tags +* `tags` - (Optional) Key-value map of resource tags. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference @@ -100,6 +100,7 @@ In addition to all arguments above, the following attributes are exported: * `id` - The ARN of the SNS topic * `arn` - The ARN of the SNS topic, as a more obvious property (clone of id) +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/spot_fleet_request.html.markdown b/website/docs/r/spot_fleet_request.html.markdown index 4491f0bcf63..c2438c69fde 100644 --- a/website/docs/r/spot_fleet_request.html.markdown +++ b/website/docs/r/spot_fleet_request.html.markdown @@ -201,7 +201,7 @@ across different markets and instance types. Conflicts with `launch_template_con * `valid_from` - (Optional) The start date and time of the request, in UTC [RFC3339](https://tools.ietf.org/html/rfc3339#section-5.8) format(for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately. * `load_balancers` (Optional) A list of elastic load balancer names to add to the Spot fleet. * `target_group_arns` (Optional) A list of `aws_alb_target_group` ARNs, for use with Application Load Balancing. -* `tags` - (Optional) A map of tags to assign to the resource. +* `tags` - (Optional) A map of tags to assign to the resource. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ### Launch Template Configs @@ -251,6 +251,7 @@ In addition to all arguments above, the following attributes are exported: * `id` - The Spot fleet request ID * `spot_request_state` - The state of the Spot fleet request. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/spot_instance_request.html.markdown b/website/docs/r/spot_instance_request.html.markdown index 3f8d0dc0279..1c9c424c57f 100644 --- a/website/docs/r/spot_instance_request.html.markdown +++ b/website/docs/r/spot_instance_request.html.markdown @@ -66,7 +66,7 @@ Spot Instance Requests support all the same arguments as * `instance_interruption_behaviour` - (Optional) Indicates whether a Spot instance stops or terminates when it is interrupted. Default is `terminate` as this is the current AWS behaviour. * `valid_until` - (Optional) The end date and time of the request, in UTC [RFC3339](https://tools.ietf.org/html/rfc3339#section-5.8) format(for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new Spot instance requests are placed or enabled to fulfill the request. The default end date is 7 days from the current date. * `valid_from` - (Optional) The start date and time of the request, in UTC [RFC3339](https://tools.ietf.org/html/rfc3339#section-5.8) format(for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately. -* `tags` - (Optional) A map of tags to assign to the Spot Instance Request. These tags are not automatically applied to the launched Instance. +* `tags` - (Optional) A map of tags to assign to the Spot Instance Request. These tags are not automatically applied to the launched Instance. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ### Timeouts @@ -99,3 +99,4 @@ should only be used for informational purposes, not for resource dependencies: used inside the Amazon EC2, and only available if you've enabled DNS hostnames for your VPC * `private_ip` - The private IP address assigned to the instance +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). diff --git a/website/docs/r/sqs_queue.html.markdown b/website/docs/r/sqs_queue.html.markdown index 15c7f0401c0..a4a2bfe4f9e 100644 --- a/website/docs/r/sqs_queue.html.markdown +++ b/website/docs/r/sqs_queue.html.markdown @@ -65,7 +65,7 @@ The following arguments are supported: * `content_based_deduplication` - (Optional) Enables content-based deduplication for FIFO queues. For more information, see the [related documentation](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-exactly-once-processing) * `kms_master_key_id` - (Optional) The ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK. For more information, see [Key Terms](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html#sqs-sse-key-terms). * `kms_data_key_reuse_period_seconds` - (Optional) The length of time, in seconds, for which Amazon SQS can reuse a data key to encrypt or decrypt messages before calling AWS KMS again. An integer representing seconds, between 60 seconds (1 minute) and 86,400 seconds (24 hours). The default is 300 (5 minutes). -* `tags` - (Optional) A map of tags to assign to the queue. +* `tags` - (Optional) A map of tags to assign to the queue. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference @@ -73,6 +73,7 @@ In addition to all arguments above, the following attributes are exported: * `id` - The URL for the created Amazon SQS queue. * `arn` - The ARN of the SQS queue +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/ssm_activation.html.markdown b/website/docs/r/ssm_activation.html.markdown index 3f6c4beecf7..1de43d9cf26 100644 --- a/website/docs/r/ssm_activation.html.markdown +++ b/website/docs/r/ssm_activation.html.markdown @@ -51,7 +51,7 @@ The following arguments are supported: * `expiration_date` - (Optional) UTC timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) by which this activation request should expire. The default value is 24 hours from resource creation time. Terraform will only perform drift detection of its value when present in a configuration. * `iam_role` - (Required) The IAM Role to attach to the managed instance. * `registration_limit` - (Optional) The maximum number of managed instances you want to register. The default value is 1 instance. -* `tags` - (Optional) A map of tags to assign to the object. +* `tags` - (Optional) A map of tags to assign to the object. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference @@ -66,6 +66,7 @@ In addition to all arguments above, the following attributes are exported: * `iam_role` - The IAM Role attached to the managed instance. * `registration_limit` - The maximum number of managed instances you want to be registered. The default value is 1 instance. * `registration_count` - The number of managed instances that are currently registered using this activation. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/ssm_document.html.markdown b/website/docs/r/ssm_document.html.markdown index 70d15345cda..d290a2304dd 100644 --- a/website/docs/r/ssm_document.html.markdown +++ b/website/docs/r/ssm_document.html.markdown @@ -54,7 +54,7 @@ The following arguments are supported: * `document_type` - (Required) The type of the document. Valid document types include: `Automation`, `Command`, `Package`, `Policy`, and `Session` * `permissions` - (Optional) Additional Permissions to attach to the document. See [Permissions](#permissions) below for details. * `target_type` - (Optional) The target type which defines the kinds of resources the document can run on. For example, /AWS::EC2::Instance. For a list of valid resource types, see AWS Resource Types Reference (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) -* `tags` - (Optional) A map of tags to assign to the object. +* `tags` - (Optional) A map of tags to assign to the object. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. * `version_name` - (Optional) A field specifying the version of the artifact you are creating with the document. For example, "Release 12, Update 6". This value is unique across all versions of a document and cannot be changed for an existing document version. ## attachments_source @@ -81,6 +81,7 @@ In addition to all arguments above, the following attributes are exported: * `status` - "Creating", "Active" or "Deleting". The current status of the document. * `parameter` - The parameters that are available to this document. * `platform_types` - A list of OS platforms compatible with this SSM document, either "Windows" or "Linux". +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). [1]: http://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-ssm-docs.html#document-schemas-features diff --git a/website/docs/r/ssm_maintenance_window.html.markdown b/website/docs/r/ssm_maintenance_window.html.markdown index f443c3ded7b..2ed1f513788 100644 --- a/website/docs/r/ssm_maintenance_window.html.markdown +++ b/website/docs/r/ssm_maintenance_window.html.markdown @@ -36,13 +36,14 @@ The following arguments are supported: * `schedule_timezone` - (Optional) Timezone for schedule in [Internet Assigned Numbers Authority (IANA) Time Zone Database format](https://www.iana.org/time-zones). For example: `America/Los_Angeles`, `etc/UTC`, or `Asia/Seoul`. * `schedule_offset` - (Optional) The number of days to wait after the date and time specified by a CRON expression before running the maintenance window. * `start_date` - (Optional) Timestamp in [ISO-8601 extended format](https://www.iso.org/iso-8601-date-and-time-format.html) when to begin the maintenance window. -* `tags` - (Optional) A map of tags to assign to the resource. +* `tags` - (Optional) A map of tags to assign to the resource. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference In addition to all arguments above, the following attributes are exported: * `id` - The ID of the maintenance window. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/ssm_parameter.html.markdown b/website/docs/r/ssm_parameter.html.markdown index f0dcda5e4eb..daae44e3680 100644 --- a/website/docs/r/ssm_parameter.html.markdown +++ b/website/docs/r/ssm_parameter.html.markdown @@ -67,7 +67,7 @@ The following arguments are supported: * `allowed_pattern` - (Optional) A regular expression used to validate the parameter value. * `data_type` - (Optional) The data_type of the parameter. Valid values: text and aws:ec2:image for AMI format, see the [Native parameter support for Amazon Machine Image IDs ](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-ec2-aliases.html) -* `tags` - (Optional) A map of tags to assign to the object. +* `tags` - (Optional) A map of tags to assign to the object. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference @@ -76,6 +76,7 @@ In addition to all arguments above, the following attributes are exported: * `arn` - The ARN of the parameter. * `name` - (Required) The name of the parameter. * `description` - (Required) The description of the parameter. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). * `type` - (Required) The type of the parameter. Valid types are `String`, `StringList` and `SecureString`. * `value` - (Required) The value of the parameter. * `version` - The version of the parameter. diff --git a/website/docs/r/ssm_patch_baseline.html.markdown b/website/docs/r/ssm_patch_baseline.html.markdown index ded4b2a9ed2..a25c1f6eadb 100644 --- a/website/docs/r/ssm_patch_baseline.html.markdown +++ b/website/docs/r/ssm_patch_baseline.html.markdown @@ -169,6 +169,7 @@ The following arguments are supported: * `source` - (Optional) Configuration block(s) with alternate sources for patches. Applies to Linux instances only. Documented below. * `rejected_patches_action` - (Optional) The action for Patch Manager to take on patches included in the `rejected_patches` list. Allow values are `ALLOW_AS_DEPENDENCY` and `BLOCK`. * `approved_patches_enable_non_security` - (Optional) Indicates whether the list of approved patches includes non-security updates that should be applied to the instances. Applies to Linux instances only. +* `tags` - (Optional) A map of tags to assign to the resource. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. The `approval_rule` block supports: @@ -178,7 +179,6 @@ The `approval_rule` block supports: * `PATCH_SET` defaults to `OS` if unspecified * `compliance_level` - (Optional) Defines the compliance level for patches approved by this rule. Valid compliance levels include the following: `CRITICAL`, `HIGH`, `MEDIUM`, `LOW`, `INFORMATIONAL`, `UNSPECIFIED`. The default value is `UNSPECIFIED`. * `enable_non_security` - (Optional) Boolean enabling the application of non-security updates. The default value is 'false'. Valid for Linux instances only. -* `tags` - (Optional) A map of tags to assign to the resource. The `source` block supports: @@ -192,6 +192,7 @@ In addition to all arguments above, the following attributes are exported: * `id` - The ID of the patch baseline. * `arn` - The ARN of the patch baseline. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/ssoadmin_permission_set.html.markdown b/website/docs/r/ssoadmin_permission_set.html.markdown index 39197cde941..bf310c1a684 100644 --- a/website/docs/r/ssoadmin_permission_set.html.markdown +++ b/website/docs/r/ssoadmin_permission_set.html.markdown @@ -35,7 +35,7 @@ The following arguments are supported: * `name` - (Required, Forces new resource) The name of the Permission Set. * `relay_state` - (Optional) The relay state URL used to redirect users within the application during the federation authentication process. * `session_duration` - (Optional) The length of time that the application user sessions are valid in the ISO-8601 standard. Default: `PT1H`. -* `tags` - (Optional) Key-value map of resource tags. +* `tags` - (Optional) Key-value map of resource tags. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference @@ -44,6 +44,7 @@ In addition to all arguments above, the following attributes are exported: * `arn` - The Amazon Resource Name (ARN) of the Permission Set. * `id` - The Amazon Resource Names (ARNs) of the Permission Set and SSO Instance, separated by a comma (`,`). * `created_date` - The date the Permission Set was created in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8). +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/storagegateway_cached_iscsi_volume.html.markdown b/website/docs/r/storagegateway_cached_iscsi_volume.html.markdown index 88b2dc7c82a..ba98e8f2d9b 100644 --- a/website/docs/r/storagegateway_cached_iscsi_volume.html.markdown +++ b/website/docs/r/storagegateway_cached_iscsi_volume.html.markdown @@ -65,7 +65,7 @@ The following arguments are supported: * `source_volume_arn` - (Optional) The ARN for an existing volume. Specifying this ARN makes the new volume into an exact copy of the specified existing volume's latest recovery point. The `volume_size_in_bytes` value for this new volume must be equal to or larger than the size of the existing volume, in bytes. * `kms_encrypted` - (Optional) Set to `true` to use Amazon S3 server side encryption with your own AWS KMS key, or `false` to use a key managed by Amazon S3. * `kms_key` - (Optional) The Amazon Resource Name (ARN) of the AWS KMS key used for Amazon S3 server side encryption. Is required when `kms_encrypted` is set. -* `tags` - (Optional) Key-value map of resource tags +* `tags` - (Optional) Key-value map of resource tags. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference @@ -76,6 +76,7 @@ In addition to all arguments above, the following attributes are exported: * `id` - Volume Amazon Resource Name (ARN), e.g. `arn:aws:storagegateway:us-east-1:123456789012:gateway/sgw-12345678/volume/vol-12345678`. * `lun_number` - Logical disk number. * `network_interface_port` - The port used to communicate with iSCSI targets. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). * `target_arn` - Target Amazon Resource Name (ARN), e.g. `arn:aws:storagegateway:us-east-1:123456789012:gateway/sgw-12345678/target/iqn.1997-05.com.amazon:TargetName`. * `volume_arn` - Volume Amazon Resource Name (ARN), e.g. `arn:aws:storagegateway:us-east-1:123456789012:gateway/sgw-12345678/volume/vol-12345678`. * `volume_id` - Volume ID, e.g. `vol-12345678`. diff --git a/website/docs/r/storagegateway_gateway.html.markdown b/website/docs/r/storagegateway_gateway.html.markdown index 7ed9bbcf459..f1d190b94f7 100644 --- a/website/docs/r/storagegateway_gateway.html.markdown +++ b/website/docs/r/storagegateway_gateway.html.markdown @@ -81,7 +81,7 @@ The following arguments are supported: * `smb_security_strategy` - (Optional) Specifies the type of security strategy. Valid values are: `ClientSpecified`, `MandatorySigning`, and `MandatoryEncryption`. See [Setting a Security Level for Your Gateway](https://docs.aws.amazon.com/storagegateway/latest/userguide/managing-gateway-file.html#security-strategy) for more information. * `smb_file_share_visibility` - (Optional) Specifies whether the shares on this gateway appear when listing shares. * `tape_drive_type` - (Optional) Type of tape drive to use for tape gateway. Terraform cannot detect drift of this argument. Valid values: `IBM-ULT3580-TD5`. -* `tags` - (Optional) Key-value map of resource tags +* `tags` - (Optional) Key-value map of resource tags. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ### smb_active_directory_settings @@ -109,6 +109,7 @@ In addition to all arguments above, the following attributes are exported: * `endpoint_type` - The type of endpoint for your gateway. * `host_environment` - The type of hypervisor environment used by the host. * `gateway_network_interface` - An array that contains descriptions of the gateway network interfaces. See [Gateway Network Interface](#gateway-network-interface). +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ### Gateway Network Interface diff --git a/website/docs/r/storagegateway_nfs_file_share.html.markdown b/website/docs/r/storagegateway_nfs_file_share.html.markdown index b15471641c9..bda08851713 100644 --- a/website/docs/r/storagegateway_nfs_file_share.html.markdown +++ b/website/docs/r/storagegateway_nfs_file_share.html.markdown @@ -41,7 +41,7 @@ The following arguments are supported: * `squash` - (Optional) Maps a user to anonymous user. Defaults to `RootSquash`. Valid values: `RootSquash` (only root is mapped to anonymous user), `NoSquash` (no one is mapped to anonymous user), `AllSquash` (everyone is mapped to anonymous user) * `file_share_name` - (Optional) The name of the file share. Must be set if an S3 prefix name is set in `location_arn`. * `notification_policy` - (Optional) The notification policy of the file share. For more information see the [AWS Documentation](https://docs.aws.amazon.com/storagegateway/latest/APIReference/API_CreateNFSFileShare.html#StorageGateway-CreateNFSFileShare-request-NotificationPolicy). Default value is `{}`. -* `tags` - (Optional) Key-value map of resource tags +* `tags` - (Optional) Key-value map of resource tags. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ### nfs_file_share_defaults @@ -67,6 +67,7 @@ In addition to all arguments above, the following attributes are exported: * `arn` - Amazon Resource Name (ARN) of the NFS File Share. * `fileshare_id` - ID of the NFS File Share. * `path` - File share path used by the NFS client to identify the mount point. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Timeouts diff --git a/website/docs/r/storagegateway_smb_file_share.html.markdown b/website/docs/r/storagegateway_smb_file_share.html.markdown index 89933687463..4bdc08b8983 100644 --- a/website/docs/r/storagegateway_smb_file_share.html.markdown +++ b/website/docs/r/storagegateway_smb_file_share.html.markdown @@ -63,7 +63,7 @@ The following arguments are supported: * `valid_user_list` - (Optional) A list of users in the Active Directory that are allowed to access the file share. Only valid if `authentication` is set to `ActiveDirectory`. * `access_based_enumeration` - (Optional) The files and folders on this share will only be visible to users with read access. Default value is `false`. * `notification_policy` - (Optional) The notification policy of the file share. For more information see the [AWS Documentation](https://docs.aws.amazon.com/storagegateway/latest/APIReference/API_CreateNFSFileShare.html#StorageGateway-CreateNFSFileShare-request-NotificationPolicy). Default value is `{}`. -* `tags` - (Optional) Key-value map of resource tags +* `tags` - (Optional) Key-value map of resource tags. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ### cache_attributes @@ -80,6 +80,7 @@ In addition to all arguments above, the following attributes are exported: * `arn` - Amazon Resource Name (ARN) of the SMB File Share. * `fileshare_id` - ID of the SMB File Share. * `path` - File share path used by the NFS client to identify the mount point. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Timeouts diff --git a/website/docs/r/storagegateway_stored_iscsi_volume.html.markdown b/website/docs/r/storagegateway_stored_iscsi_volume.html.markdown index 8d4e3144463..25bb923b7ee 100644 --- a/website/docs/r/storagegateway_stored_iscsi_volume.html.markdown +++ b/website/docs/r/storagegateway_stored_iscsi_volume.html.markdown @@ -51,7 +51,7 @@ The following arguments are supported: * `snapshot_id` - (Optional) The snapshot ID of the snapshot to restore as the new stored volume. e.g. `snap-1122aabb`. * `kms_encrypted` - (Optional) `true` to use Amazon S3 server side encryption with your own AWS KMS key, or `false` to use a key managed by Amazon S3. Optional. * `kms_key` - (Optional) The Amazon Resource Name (ARN) of the AWS KMS key used for Amazon S3 server side encryption. This value can only be set when `kms_encrypted` is `true`. -* `tags` - (Optional) Key-value mapping of resource tags +* `tags` - (Optional) Key-value mapping of resource tags. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference @@ -62,6 +62,7 @@ In addition to all arguments above, the following attributes are exported: * `id` - Volume Amazon Resource Name (ARN), e.g. `arn:aws:storagegateway:us-east-1:123456789012:gateway/sgw-12345678/volume/vol-12345678`. * `lun_number` - Logical disk number. * `network_interface_port` - The port used to communicate with iSCSI targets. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). * `target_arn` - Target Amazon Resource Name (ARN), e.g. `arn:aws:storagegateway:us-east-1:123456789012:gateway/sgw-12345678/target/iqn.1997-05.com.amazon:TargetName`. * `volume_arn` - Volume Amazon Resource Name (ARN), e.g. `arn:aws:storagegateway:us-east-1:123456789012:gateway/sgw-12345678/volume/vol-12345678`. * `volume_id` - Volume ID, e.g. `vol-12345678`. diff --git a/website/docs/r/storagegateway_tape_pool.html.markdown b/website/docs/r/storagegateway_tape_pool.html.markdown index 6b6055abf93..d1862d4dd8d 100644 --- a/website/docs/r/storagegateway_tape_pool.html.markdown +++ b/website/docs/r/storagegateway_tape_pool.html.markdown @@ -27,13 +27,14 @@ The following arguments are supported: * `storage_class` - (Required) The storage class that is associated with the new custom pool. When you use your backup application to eject the tape, the tape is archived directly into the storage class that corresponds to the pool. Possible values are `DEEP_ARCHIVE` or `GLACIER`. * `retention_lock_type` - (Required) Tape retention lock can be configured in two modes. When configured in governance mode, AWS accounts with specific IAM permissions are authorized to remove the tape retention lock from archived virtual tapes. When configured in compliance mode, the tape retention lock cannot be removed by any user, including the root AWS account. Possible values are `COMPLIANCE`, `GOVERNANCE`, and `NONE`. Default value is `NONE`. * `retention_lock_time_in_days` - (Optional) Tape retention lock time is set in days. Tape retention lock can be enabled for up to 100 years (36,500 days). Default value is 0. -* `tags` - (Optional) Key-value map of resource tags +* `tags` - (Optional) Key-value map of resource tags. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference In addition to all arguments above, the following attributes are exported: * `arn` - Volume Amazon Resource Name (ARN), e.g. `aws_storagegateway_tape_pool.example arn:aws:storagegateway:us-east-1:123456789012:tapepool/pool-12345678`. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/swf_domain.html.markdown b/website/docs/r/swf_domain.html.markdown index 54ff506f2b9..9fdba376655 100644 --- a/website/docs/r/swf_domain.html.markdown +++ b/website/docs/r/swf_domain.html.markdown @@ -30,7 +30,7 @@ The following arguments are supported: * `name_prefix` - (Optional, Forces new resource) Creates a unique name beginning with the specified prefix. Conflicts with `name`. * `description` - (Optional, Forces new resource) The domain description. * `workflow_execution_retention_period_in_days` - (Required, Forces new resource) Length of time that SWF will continue to retain information about the workflow execution after the workflow execution is complete, must be between 0 and 90 days. -* `tags` - (Optional) Key-value map of resource tags +* `tags` - (Optional) Key-value map of resource tags. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference @@ -38,6 +38,7 @@ In addition to all arguments above, the following attributes are exported: * `id` - The name of the domain. * `arn` - Amazon Resource Name (ARN) +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). ## Import diff --git a/website/docs/r/synthetics_canary.html.markdown b/website/docs/r/synthetics_canary.html.markdown index afce6ab4484..de4fa66a048 100644 --- a/website/docs/r/synthetics_canary.html.markdown +++ b/website/docs/r/synthetics_canary.html.markdown @@ -49,7 +49,7 @@ The following arguments are optional: * `s3_version` - (Optional) S3 version ID of your script. **Conflicts with `zip_file`.** * `start_canary` - (Optional) Whether to run or stop the canary. * `success_retention_period` - (Optional) Number of days to retain data about successful runs of this canary. If you omit this field, the default of 31 days is used. The valid range is 1 to 455 days. -* `tags` - (Optional) Key-value map of resource tags +* `tags` - (Optional) Key-value map of resource tags. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. * `vpc_config` - (Optional) Configuration block. Detailed below. * `zip_file` - (Optional) ZIP file that contains the script, if you input your canary script directly into the canary instead of referring to an S3 location. It can be up to 5 MB. **Conflicts with `s3_bucket`, `s3_key`, and `s3_version`.** @@ -80,6 +80,7 @@ In addition to all arguments above, the following attributes are exported: * `id` - Name for this canary. * `source_location_arn` - ARN of the Lambda layer where Synthetics stores the canary script code. * `status` - Canary status. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). * `timeline` - Structure that contains information about when the canary was created, modified, and most recently run. see [Timeline](#timeline). ### vpc_config