Skip to content

Commit

Permalink
Merge pull request #39491 from hashicorp/b-dynamodb_tags_propagation
Browse files Browse the repository at this point in the history
r/dynamodb_tag: change equality check in propagation waiter
  • Loading branch information
johnsonaj authored Sep 26, 2024
2 parents d62e960 + c398c7c commit da8ec27
Show file tree
Hide file tree
Showing 19 changed files with 2,383 additions and 91 deletions.
3 changes: 3 additions & 0 deletions .changelog/39491.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_dynamodb_tag: Fix propagation timeout when multiple tags exist
```
3 changes: 3 additions & 0 deletions internal/generate/tags/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ var (
updateTagsFunc = flag.String("UpdateTagsFunc", defaultUpdateTagsFunc, "updateTagsFunc")
waitTagsPropagatedFunc = flag.String("WaitFunc", defaultWaitTagsPropagatedFunc, "waitFunc")
waitContinuousOccurence = flag.Int("WaitContinuousOccurence", 0, "ContinuousTargetOccurence for Wait function")
waitFuncComparator = flag.String("WaitFuncComparator", "Equal", "waitFuncComparator")
waitDelay = flag.Duration("WaitDelay", 0, "Delay for Wait function")
waitMinTimeout = flag.Duration("WaitMinTimeout", 0, `"MinTimeout" (minimum poll interval) for Wait function`)
waitPollInterval = flag.Duration("WaitPollInterval", 0, "PollInterval for Wait function")
Expand Down Expand Up @@ -214,6 +215,7 @@ type TemplateData struct {
WaitTagsPropagatedFunc string
WaitContinuousOccurence int
WaitDelay string
WaitFuncComparator string
WaitMinTimeout string
WaitPollInterval string
WaitTimeout string
Expand Down Expand Up @@ -370,6 +372,7 @@ func main() {
UpdateTagsFunc: *updateTagsFunc,
UpdateTagsIgnoreSystem: !*updateTagsNoIgnoreSystem,
WaitForPropagation: *waitForPropagation,
WaitFuncComparator: *waitFuncComparator,
WaitTagsPropagatedFunc: *waitTagsPropagatedFunc,
WaitContinuousOccurence: *waitContinuousOccurence,
WaitDelay: formatDuration(*waitDelay),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func {{ .WaitTagsPropagatedFunc }}(ctx context.Context, conn {{ .ClientType }},
output = output.IgnoreConfig(inContext.IgnoreConfig)
}

return output.Equal(tags), nil
return output.{{ .WaitFuncComparator }}(tags), nil
}
opts := tfresource.WaitOpts{
{{- if ne .WaitContinuousOccurence 0 }}
Expand Down
6 changes: 4 additions & 2 deletions internal/service/dynamodb/generate.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

//go:generate go run ../../generate/tagresource/main.go
//go:generate go run ../../generate/tags/main.go -GetTag -ListTags -ListTagsOp=ListTagsOfResource -ServiceTagsSlice -UpdateTags -Wait -WaitContinuousOccurence 5 -WaitMinTimeout 1s -WaitTimeout 10m -ParentNotFoundErrCode=ResourceNotFoundException
//go:generate go run ../../generate/tagresource/main.go -UpdateTagsFunc=updateTagsResource
//go:generate go run ../../generate/tags/main.go -GetTag -ListTags -ListTagsOp=ListTagsOfResource -ServiceTagsSlice -UpdateTags -Wait -WaitContinuousOccurence 2 -WaitMinTimeout 1s -WaitTimeout 2m -ParentNotFoundErrCode=ResourceNotFoundException
//go:generate go run ../../generate/tags/main.go -SkipTypesImp -UpdateTags -UpdateTagsFunc=updateTagsResource -Wait -WaitFunc=waitTagsPropagedForResource -WaitContinuousOccurence 2 -WaitMinTimeout 1s -WaitTimeout 2m -WaitFuncComparator=ContainsAll -- update_tags_for_resource_gen.go
//go:generate go run ../../generate/servicepackage/main.go
//go:generate go run ../../generate/listpages/main.go -ListOps=ListBackups -InputPaginator=ExclusiveStartBackupArn -OutputPaginator=LastEvaluatedBackupArn -- list_backups_pages_gen.go
//go:generate go run ../../generate/tagstests/main.go
// ONLY generate directives and package declaration! Do not add anything else to this file.

package dynamodb
2 changes: 1 addition & 1 deletion internal/service/dynamodb/resource_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/hashicorp/terraform-provider-aws/names"
)

// @FrameworkResource(name="Resource Policy")
// @FrameworkResource("aws_dynamodb_resource_policy", name="Resource Policy")
func newResourcePolicyResource(_ context.Context) (resource.ResourceWithConfigure, error) {
r := &resourcePolicyResource{}

Expand Down
1 change: 1 addition & 0 deletions internal/service/dynamodb/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const (

// @SDKResource("aws_dynamodb_table", name="Table")
// @Tags(identifierAttribute="arn")
// @Testing(existsType="github.com/aws/aws-sdk-go-v2/service/dynamodb/types;types.TableDescription")
func resourceTable() *schema.Resource {
//lintignore:R011
return &schema.Resource{
Expand Down
1 change: 1 addition & 0 deletions internal/service/dynamodb/table_replica.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const (

// @SDKResource("aws_dynamodb_table_replica", name="Table Replica")
// @Tags
// @Testing(tagsTest=false)
func resourceTableReplica() *schema.Resource {
//lintignore:R011
return &schema.Resource{
Expand Down
Loading

0 comments on commit da8ec27

Please sign in to comment.