Skip to content

Commit

Permalink
Merge pull request #34356 from DanielRieske/b/remove-readonly-propert…
Browse files Browse the repository at this point in the history
…ies-replication-settings

Remove readonly properties within `replication_settings` for `aws_dms_replication_config` resource
  • Loading branch information
ewbankkit committed Dec 19, 2023
2 parents 7b5a7a0 + a50d08e commit b73f9aa
Show file tree
Hide file tree
Showing 234 changed files with 1,966 additions and 1,693 deletions.
3 changes: 3 additions & 0 deletions .changelog/30721.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_dms_replication_task: Remove [ForceNew](https://developer.hashicorp.com/terraform/plugin/sdkv2/schemas/schema-behaviors#forcenew) from `replication_instance_arn`, allowing in-place migration between DMS instances
```
3 changes: 3 additions & 0 deletions .changelog/31917.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_dms_replication_task: Allow `cdc_start_time` to use [RFC3339](https://www.rfc-editor.org/rfc/rfc3339) formatted dates in addition to UNIX timestamps
```
7 changes: 7 additions & 0 deletions .changelog/34356.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:bug
resource/aws_dms_replication_config: Prevent erroneous diffs on `replication_settings`
```

```release-note:bug
resource/aws_dms_replication_task: Prevent erroneous diffs on `replication_task_settings`
```
2 changes: 1 addition & 1 deletion .teamcity/scripts/provider_tests/acceptance_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ TF_ACC=1 go test \
./internal/flex/... \
./internal/framework/... \
./internal/generate/... \
./internal/json/... \
./internal/logging/... \
./internal/maps/... \
./internal/provider/... \
Expand All @@ -54,7 +55,6 @@ TF_ACC=1 go test \
./internal/tags/... \
./internal/tfresource/... \
./internal/types/... \
./internal/ujson/... \
./internal/vault/... \
./internal/verify/... \
-json -v -count=1 -parallel "%ACCTEST_PARALLELISM%" -timeout=0 -run=TestAcc
2 changes: 1 addition & 1 deletion .teamcity/scripts/provider_tests/unit_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ go test \
./internal/flex/... \
./internal/framework/... \
./internal/generate/... \
./internal/json/... \
./internal/logging/... \
./internal/maps/... \
./internal/provider/... \
Expand All @@ -26,7 +27,6 @@ go test \
./internal/tags/... \
./internal/tfresource/... \
./internal/types/... \
./internal/ujson/... \
./internal/vault/... \
./internal/verify/... \
-json
15 changes: 8 additions & 7 deletions internal/experimental/depgraph/dependency_graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"strings"

tfslices "github.com/hashicorp/terraform-provider-aws/internal/slices"
"github.com/hashicorp/terraform-provider-aws/internal/types/stack"
"golang.org/x/exp/slices"
)

Expand Down Expand Up @@ -204,20 +205,20 @@ func depthFirstSearch(edges map[string][]string) func(s string) ([]string, error

inCurrentPath := make(map[string]struct{})
currentPath := make([]string, 0)
todo := newStack()
todo := stack.New[*todoValue]()

todo.push(&todoValue{
todo.Push(&todoValue{
node: s,
})

for todo.len() > 0 {
current := todo.peek().(*todoValue)
for todo.Len() > 0 {
current := todo.Peek().MustUnwrap()
node := current.node

if !current.processed {
// Visit edges.
if slices.Contains(visited, node) {
todo.pop()
todo.Pop()

continue
}
Expand All @@ -232,7 +233,7 @@ func depthFirstSearch(edges map[string][]string) func(s string) ([]string, error
nodeEdges := edges[node]

for i := len(nodeEdges) - 1; i >= 0; i-- {
todo.push(&todoValue{
todo.Push(&todoValue{
node: nodeEdges[i],
})
}
Expand All @@ -241,7 +242,7 @@ func depthFirstSearch(edges map[string][]string) func(s string) ([]string, error
} else {
// Edges have been visited.
// Unroll the stack.
todo.pop()
todo.Pop()
if n := len(currentPath); n > 0 {
currentPath = currentPath[:n-1]
}
Expand Down
56 changes: 0 additions & 56 deletions internal/experimental/depgraph/stack.go

This file was deleted.

12 changes: 9 additions & 3 deletions internal/flex/flex.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,17 @@ func StringToIntValue(v *string) int {
return i
}

// StringValueToInt64 converts a string to a Go int64 pointer value.
// StringValueToInt64 converts a string to a Go int64 pointer.
// Invalid integer strings are converted to 0.
func StringValueToInt64(v string) *int64 {
i, _ := strconv.Atoi(v)
return aws.Int64(int64(i))
return aws.Int64(StringValueToInt64Value(v))
}

// StringValueToInt64Value converts a string to a Go int64 value.
// Invalid integer strings are converted to 0.
func StringValueToInt64Value(v string) int64 {
i, _ := strconv.ParseInt(v, 0, 64)
return i
}

// Takes a string of resource attributes separated by the ResourceIdSeparator constant
Expand Down
48 changes: 24 additions & 24 deletions internal/generate/tags/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,18 +206,18 @@ type TemplateData struct {

// The following are specific to writing import paths in the `headerBody`;
// to include the package, set the corresponding field's value to true
ConnsPkg bool
FmtPkg bool
HelperSchemaPkg bool
InternalTypesPkg bool
LoggingPkg bool
NamesPkg bool
SkipAWSImp bool
SkipServiceImp bool
SkipTypesImp bool
TfLogPkg bool
TfResourcePkg bool
TimePkg bool
ConnsPkg bool
FmtPkg bool
HelperSchemaPkg bool
InternalOptionPkg bool
LoggingPkg bool
NamesPkg bool
SkipAWSImp bool
SkipServiceImp bool
SkipTypesImp bool
TfLogPkg bool
TfResourcePkg bool
TimePkg bool

IsDefaultListTags bool
IsDefaultUpdateTags bool
Expand Down Expand Up @@ -298,18 +298,18 @@ func main() {
ProviderNameUpper: providerNameUpper,
ServicePackage: servicePackage,

ConnsPkg: (*listTags && *listTagsFunc == defaultListTagsFunc) || (*updateTags && *updateTagsFunc == defaultUpdateTagsFunc),
FmtPkg: *updateTags,
HelperSchemaPkg: awsPkg == "autoscaling",
InternalTypesPkg: (*listTags && *listTagsFunc == defaultListTagsFunc) || *serviceTagsMap || *serviceTagsSlice,
LoggingPkg: *updateTags,
NamesPkg: *updateTags && !*skipNamesImp,
SkipAWSImp: *skipAWSImp,
SkipServiceImp: *skipServiceImp,
SkipTypesImp: *skipTypesImp,
TfLogPkg: *updateTags,
TfResourcePkg: (*getTag || *waitForPropagation),
TimePkg: *waitForPropagation,
ConnsPkg: (*listTags && *listTagsFunc == defaultListTagsFunc) || (*updateTags && *updateTagsFunc == defaultUpdateTagsFunc),
FmtPkg: *updateTags,
HelperSchemaPkg: awsPkg == "autoscaling",
InternalOptionPkg: (*listTags && *listTagsFunc == defaultListTagsFunc) || *serviceTagsMap || *serviceTagsSlice,
LoggingPkg: *updateTags,
NamesPkg: *updateTags && !*skipNamesImp,
SkipAWSImp: *skipAWSImp,
SkipServiceImp: *skipServiceImp,
SkipTypesImp: *skipTypesImp,
TfLogPkg: *updateTags,
TfResourcePkg: (*getTag || *waitForPropagation),
TimePkg: *waitForPropagation,

CreateTagsFunc: createTagsFunc,
GetTagFunc: *getTagFunc,
Expand Down
4 changes: 2 additions & 2 deletions internal/generate/tags/templates/v1/header_body.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ import (
{{- if .TfResourcePkg }}
"github.com/hashicorp/terraform-provider-aws/internal/tfresource"
{{- end }}
{{- if .InternalTypesPkg }}
"github.com/hashicorp/terraform-provider-aws/internal/types"
{{- if .InternalOptionPkg }}
"github.com/hashicorp/terraform-provider-aws/internal/types/option"
{{- end }}
{{- if .NamesPkg }}
"github.com/hashicorp/terraform-provider-aws/names"
Expand Down
2 changes: 1 addition & 1 deletion internal/generate/tags/templates/v1/list_tags_body.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (p *servicePackage) {{ .ListTagsFunc | Title }}(ctx context.Context, meta a
}

if inContext, ok := tftags.FromContext(ctx); ok {
inContext.TagsOut = types.Some(tags)
inContext.TagsOut = option.Some(tags)
}

return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func {{ .GetTagsInFunc }}(ctx context.Context) map[string]*string {
// {{ .SetTagsOutFunc }} sets {{ .ServicePackage }} service tags in Context.
func {{ .SetTagsOutFunc }}(ctx context.Context, tags map[string]*string) {
if inContext, ok := tftags.FromContext(ctx); ok {
inContext.TagsOut = types.Some({{ .KeyValueTagsFunc }}(ctx, tags))
inContext.TagsOut = option.Some({{ .KeyValueTagsFunc }}(ctx, tags))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,13 @@ func {{ .GetTagsInFunc }}(ctx context.Context) []*{{ .TagPackage }}.{{ .TagType
{{- if or ( .TagType2 ) ( .TagTypeAddBoolElem ) }}
func {{ .SetTagsOutFunc }}(ctx context.Context, tags any{{ if .TagTypeIDElem }}, identifier{{ if .TagResTypeElem }}, resourceType{{ end }} string{{ end }}) {
if inContext, ok := tftags.FromContext(ctx); ok {
inContext.TagsOut = types.Some({{ .KeyValueTagsFunc }}(ctx, tags{{ if .TagTypeIDElem }}, identifier{{ if .TagResTypeElem }}, resourceType{{ end }}{{ end }}))
inContext.TagsOut = option.Some({{ .KeyValueTagsFunc }}(ctx, tags{{ if .TagTypeIDElem }}, identifier{{ if .TagResTypeElem }}, resourceType{{ end }}{{ end }}))
}
}
{{- else }}
func {{ .SetTagsOutFunc }}(ctx context.Context, tags []*{{ .TagPackage }}.{{ .TagType }}) {
if inContext, ok := tftags.FromContext(ctx); ok {
inContext.TagsOut = types.Some({{ .KeyValueTagsFunc }}(ctx, tags))
inContext.TagsOut = option.Some({{ .KeyValueTagsFunc }}(ctx, tags))
}
}
{{- end }}
Expand Down
4 changes: 2 additions & 2 deletions internal/generate/tags/templates/v2/header_body.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ import (
{{- if .TfResourcePkg }}
"github.com/hashicorp/terraform-provider-aws/internal/tfresource"
{{- end }}
{{- if .InternalTypesPkg }}
"github.com/hashicorp/terraform-provider-aws/internal/types"
{{- if .InternalOptionPkg }}
"github.com/hashicorp/terraform-provider-aws/internal/types/option"
{{- end }}
{{- if .NamesPkg }}
"github.com/hashicorp/terraform-provider-aws/names"
Expand Down
2 changes: 1 addition & 1 deletion internal/generate/tags/templates/v2/list_tags_body.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (p *servicePackage) {{ .ListTagsFunc | Title }}(ctx context.Context, meta a
}

if inContext, ok := tftags.FromContext(ctx); ok {
inContext.TagsOut = types.Some(tags)
inContext.TagsOut = option.Some(tags)
}

return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func {{ .GetTagsInFunc }}(ctx context.Context) map[string]*string {
// {{ .SetTagsOutFunc }} sets {{ .ServicePackage }} service tags in Context.
func {{ .SetTagsOutFunc }}(ctx context.Context, tags map[string]*string) {
if inContext, ok := tftags.FromContext(ctx); ok {
inContext.TagsOut = types.Some({{ .KeyValueTagsFunc }}(ctx, tags))
inContext.TagsOut = option.Some({{ .KeyValueTagsFunc }}(ctx, tags))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,13 @@ func {{ .GetTagsInFunc }}(ctx context.Context) []awstypes.{{ .TagType }} {
{{- if or ( .TagType2 ) ( .TagTypeAddBoolElem ) }}
func {{ .SetTagsOutFunc }}(ctx context.Context, tags any{{ if .TagTypeIDElem }}, identifier{{ if .TagResTypeElem }}, resourceType{{ end }} string{{ end }}) {
if inContext, ok := tftags.FromContext(ctx); ok {
inContext.TagsOut = types.Some({{ .KeyValueTagsFunc }}(ctx, tags{{ if .TagTypeIDElem }}, identifier{{ if .TagResTypeElem }}, resourceType{{ end }}{{ end }}))
inContext.TagsOut = option.Some({{ .KeyValueTagsFunc }}(ctx, tags{{ if .TagTypeIDElem }}, identifier{{ if .TagResTypeElem }}, resourceType{{ end }}{{ end }}))
}
}
{{- else }}
func {{ .SetTagsOutFunc }}(ctx context.Context, tags []awstypes.{{ .TagType }}) {
if inContext, ok := tftags.FromContext(ctx); ok {
inContext.TagsOut = types.Some({{ .KeyValueTagsFunc }}(ctx, tags))
inContext.TagsOut = option.Some({{ .KeyValueTagsFunc }}(ctx, tags))
}
}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func {{ .GetTagsInFunc }}(ctx context.Context) map[string]string {
// {{ .SetTagsOutFunc }} sets {{ .ServicePackage }} service tags in Context.
func {{ .SetTagsOutFunc }}(ctx context.Context, tags map[string]string) {
if inContext, ok := tftags.FromContext(ctx); ok {
inContext.TagsOut = types.Some({{ .KeyValueTagsFunc }}(ctx, tags))
inContext.TagsOut = option.Some({{ .KeyValueTagsFunc }}(ctx, tags))
}
}

Expand Down
Loading

0 comments on commit b73f9aa

Please sign in to comment.