diff --git a/aws/internal/keyvaluetags/service_generation_customizations.go b/aws/internal/keyvaluetags/service_generation_customizations.go index 8321bab3b1f..3626b57c55b 100644 --- a/aws/internal/keyvaluetags/service_generation_customizations.go +++ b/aws/internal/keyvaluetags/service_generation_customizations.go @@ -270,6 +270,8 @@ func ServiceClientType(serviceName string) string { funcType = reflect.TypeOf(wafregional.New) case "workspaces": funcType = reflect.TypeOf(workspaces.New) + case "resourcegroups": + funcType = reflect.TypeOf(resourcegroups.New) default: panic(fmt.Sprintf("unrecognized ServiceClientType: %s", serviceName)) } diff --git a/aws/internal/keyvaluetags/update_tags_gen.go b/aws/internal/keyvaluetags/update_tags_gen.go index e9c15867acf..16b09080f37 100644 --- a/aws/internal/keyvaluetags/update_tags_gen.go +++ b/aws/internal/keyvaluetags/update_tags_gen.go @@ -2501,6 +2501,42 @@ func ResourcegroupsUpdateTags(conn *resourcegroups.ResourceGroups, identifier st return nil } +// ResourcegroupsUpdateTags updates resourcegroups service tags. +// The identifier is typically the Amazon Resource Name (ARN), although +// it may also be a different identifier depending on the service. +func ResourcegroupsUpdateTags(conn *resourcegroups.ResourceGroups, identifier string, oldTagsMap interface{}, newTagsMap interface{}) error { + oldTags := New(oldTagsMap) + newTags := New(newTagsMap) + + if removedTags := oldTags.Removed(newTags); len(removedTags) > 0 { + input := &resourcegroups.UntagInput{ + Arn: aws.String(identifier), + Keys: aws.StringSlice(removedTags.Keys()), + } + + _, err := conn.Untag(input) + + if err != nil { + return fmt.Errorf("error untagging resource (%s): %s", identifier, err) + } + } + + if updatedTags := oldTags.Updated(newTags); len(updatedTags) > 0 { + input := &resourcegroups.TagInput{ + Arn: aws.String(identifier), + Tags: updatedTags.IgnoreAws().ResourcegroupsTags(), + } + + _, err := conn.Tag(input) + + if err != nil { + return fmt.Errorf("error tagging resource (%s): %s", identifier, err) + } + } + + return nil +} + // Route53resolverUpdateTags updates route53resolver service tags. // The identifier is typically the Amazon Resource Name (ARN), although // it may also be a different identifier depending on the service. diff --git a/website/docs/r/resourcegroups_group.html.markdown b/website/docs/r/resourcegroups_group.html.markdown index 8a17ae28793..ad32ae55294 100644 --- a/website/docs/r/resourcegroups_group.html.markdown +++ b/website/docs/r/resourcegroups_group.html.markdown @@ -41,6 +41,7 @@ The following arguments are supported: * `name` - (Required) The resource group's name. A resource group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with `AWS` or `aws`. * `description` - (Optional) A description of the resource group. * `resource_query` - (Required) A `resource_query` block. Resource queries are documented below. +* `tags` - (Optional) Key-value mapping of resource tags An `resource_query` block supports the following arguments: