diff --git a/patches/0031-Disable-SetTagsDiff-and-ensure-tagsAll-is-not-comput.patch b/patches/0031-Disable-SetTagsDiff-and-ensure-tagsAll-is-not-comput.patch deleted file mode 100644 index 9c900bb45dd..00000000000 --- a/patches/0031-Disable-SetTagsDiff-and-ensure-tagsAll-is-not-comput.patch +++ /dev/null @@ -1,159 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Anton Tayanovskyy -Date: Tue, 31 Oct 2023 12:42:59 -0400 -Subject: [PATCH 31/31] Disable SetTagsDiff and ensure tagsAll is not computed - at TF level - - -diff --git a/internal/verify/diff.go b/internal/verify/diff.go -index 5e9c779a28..87a57e6076 100644 ---- a/internal/verify/diff.go -+++ b/internal/verify/diff.go -@@ -5,103 +5,14 @@ package verify - - import ( - "context" -- "fmt" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -- "github.com/hashicorp/terraform-provider-aws/internal/conns" -- tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" - ) - --// Find JSON diff functions in the json.go file. -- --// SetTagsDiff sets the new plan difference with the result of --// merging resource tags on to those defined at the provider-level; --// returns an error if unsuccessful or if the resource tags are identical --// to those configured at the provider-level to avoid non-empty plans --// after resource READ operations as resource and provider-level tags --// will be indistinguishable when returned from an AWS API. - func SetTagsDiff(ctx context.Context, diff *schema.ResourceDiff, meta interface{}) error { -- defaultTagsConfig := meta.(*conns.AWSClient).DefaultTagsConfig -- ignoreTagsConfig := meta.(*conns.AWSClient).IgnoreTagsConfig -- -- resourceTags := tftags.New(ctx, diff.Get("tags").(map[string]interface{})) -- -- allTags := defaultTagsConfig.MergeTags(resourceTags).IgnoreConfig(ignoreTagsConfig) -- // To ensure "tags_all" is correctly computed, we explicitly set the attribute diff -- // when the merger of resource-level tags onto provider-level tags results in n > 0 tags, -- // otherwise we mark the attribute as "Computed" only when there is a known diff (excluding an empty map) -- // or a change for "tags_all". -- // Reference: https://github.com/hashicorp/terraform-provider-aws/issues/18366 -- // Reference: https://github.com/hashicorp/terraform-provider-aws/issues/19005 -- -- if !diff.GetRawPlan().GetAttr("tags").IsWhollyKnown() { -- if err := diff.SetNewComputed("tags_all"); err != nil { -- return fmt.Errorf("setting tags_all to computed: %w", err) -- } -- return nil -- } -- -- if diff.HasChange("tags") { -- _, n := diff.GetChange("tags") -- newTags := tftags.New(ctx, n.(map[string]interface{})) -- -- if newTags.HasZeroValue() { -- if err := diff.SetNewComputed("tags_all"); err != nil { -- return fmt.Errorf("setting tags_all to computed: %w", err) -- } -- } -- -- if len(allTags) > 0 && (!newTags.HasZeroValue() || !allTags.HasZeroValue()) { -- if err := diff.SetNew("tags_all", allTags.Map()); err != nil { -- return fmt.Errorf("setting new tags_all diff: %w", err) -- } -- } -- -- if len(allTags) == 0 { -- if err := diff.SetNewComputed("tags_all"); err != nil { -- return fmt.Errorf("setting tags_all to computed: %w", err) -- } -- } -- } else if !diff.HasChange("tags") { -- if len(allTags) > 0 && !allTags.HasZeroValue() { -- if err := diff.SetNew("tags_all", allTags.Map()); err != nil { -- return fmt.Errorf("setting new tags_all diff: %w", err) -- } -- return nil -- } -- -- var ta tftags.KeyValueTags -- if tagsAll, ok := diff.Get("tags_all").(map[string]interface{}); ok { -- ta = tftags.New(ctx, tagsAll) -- } -- if len(allTags) > 0 && !ta.DeepEqual(allTags) && allTags.HasZeroValue() { -- if err := diff.SetNewComputed("tags_all"); err != nil { -- return fmt.Errorf("setting tags_all to computed: %w", err) -- } -- return nil -- } -- } else if tagsAll, ok := diff.Get("tags_all").(map[string]interface{}); ok { -- ta := tftags.New(ctx, tagsAll) -- if !ta.DeepEqual(allTags) { -- if allTags.HasZeroValue() { -- if err := diff.SetNewComputed("tags_all"); err != nil { -- return fmt.Errorf("setting tags_all to computed: %w", err) -- } -- } -- } -- } else if len(diff.Get("tags_all").(map[string]interface{})) > 0 { -- if err := diff.SetNewComputed("tags_all"); err != nil { -- return fmt.Errorf("setting tags_all to computed: %w", err) -- } -- } else if diff.HasChange("tags_all") { -- if err := diff.SetNewComputed("tags_all"); err != nil { -- return fmt.Errorf("setting tags_all to computed: %w", err) -- } -- } -- - return nil - } - -diff --git a/shim/shim.go b/shim/shim.go -index 2af7c06925..2073270778 100644 ---- a/shim/shim.go -+++ b/shim/shim.go -@@ -17,6 +17,7 @@ type UpstreamProvider struct { - - func NewUpstreamProvider(ctx context.Context) (UpstreamProvider, error) { - primary, err := provider.New(ctx) -+ markTagsAllNotComputedForResources(primary) - if err != nil { - return UpstreamProvider{}, err - } -@@ -34,3 +35,31 @@ type TagIgnoreConfig = tags.IgnoreConfig - func NewTagConfig(ctx context.Context, i interface{}) TagConfig { - return TagConfig{Tags: tags.New(ctx, i)} - } -+ -+func markTagsAllNotComputedForResources(sdkV2Provider *schema.Provider) { -+ for rn, r := range sdkV2Provider.ResourcesMap { -+ -+ // Not skipping these resources results in an error: -+ // -+ // * resource aws_macie2_custom_data_identifier: No Update defined, must set ForceNew on: []string{"tags_all"} -+ // * resource aws_emrcontainers_job_template: No Update defined, must set ForceNew on: []string{"tags_all"} -+ // * resource aws_ivs_playback_key_pair: No Update defined, must set ForceNew on: []string{"tags_all"} -+ // * resource aws_ivs_recording_configuration: No Update defined, must set ForceNew on: []string{"tags_all"} -+ // * resource aws_ssm_activation: No Update defined, must set ForceNew on: []string{"tags_all"} -+ switch rn { -+ case "aws_macie2_custom_data_identifier", -+ "aws_emrcontainers_job_template", -+ "aws_ivs_playback_key_pair", -+ "aws_ivs_recording_configuration", -+ "aws_ssm_activation": -+ continue -+ } -+ -+ if tagsAll, ok := r.Schema["tags_all"]; ok { -+ tagsAll.Computed = false -+ if !(tagsAll.Required || tagsAll.Optional) { -+ tagsAll.Optional = true -+ } -+ } -+ } -+} diff --git a/patches/0035-Make-tags_all-attribute-no-longer-computed-for-Plugi.patch b/patches/0031-Do-not-compute-tags_all-at-TF-level.patch similarity index 55% rename from patches/0035-Make-tags_all-attribute-no-longer-computed-for-Plugi.patch rename to patches/0031-Do-not-compute-tags_all-at-TF-level.patch index 6e4be34bd57..0b4a5d0f8fb 100644 --- a/patches/0035-Make-tags_all-attribute-no-longer-computed-for-Plugi.patch +++ b/patches/0031-Do-not-compute-tags_all-at-TF-level.patch @@ -1,10 +1,41 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy -Date: Fri, 3 Nov 2023 16:12:47 -0400 -Subject: [PATCH 35/35] Make tags_all attribute no longer computed for Plugin - Framework +Date: Mon, 6 Nov 2023 11:17:16 -0500 +Subject: [PATCH 31/31] Do not compute tags_all at TF level +diff --git a/internal/framework/base.go b/internal/framework/base.go +index 34065d9285..5225f639af 100644 +--- a/internal/framework/base.go ++++ b/internal/framework/base.go +@@ -69,6 +69,12 @@ func (r *ResourceWithConfigure) Configure(_ context.Context, request resource.Co + + // SetTagsAll calculates the new value for the `tags_all` attribute. + func (r *ResourceWithConfigure) SetTagsAll(ctx context.Context, request resource.ModifyPlanRequest, response *resource.ModifyPlanResponse) { ++ ++ // Skip SetTagsAll in Pulumi because it is handled at Pulumi provider level. ++ if 1+1 == 2 { ++ return ++ } ++ + // If the entire plan is null, the resource is planned for destruction. + if request.Plan.Raw.IsNull() { + return +diff --git a/internal/provider/fwprovider/provider.go b/internal/provider/fwprovider/provider.go +index 85a814022b..b119e21c46 100644 +--- a/internal/provider/fwprovider/provider.go ++++ b/internal/provider/fwprovider/provider.go +@@ -413,8 +413,8 @@ func (p *fwprovider) Resources(ctx context.Context) []func() resource.Resource { + continue + } + if v, ok := schemaResponse.Schema.Attributes[names.AttrTagsAll]; ok { +- if !v.IsComputed() { +- errs = append(errs, fmt.Errorf("`%s` attribute must be Computed: %s", names.AttrTagsAll, typeName)) ++ if v.IsComputed() { ++ errs = append(errs, fmt.Errorf("`%s` attribute must not be Computed: %s", names.AttrTagsAll, typeName)) + continue + } + } else { diff --git a/internal/service/appconfig/environment.go b/internal/service/appconfig/environment.go index 258bb7c907..e129655da6 100644 --- a/internal/service/appconfig/environment.go @@ -200,3 +231,161 @@ index 33d374f4e2..b2e1c97096 100644 }, Blocks: map[string]schema.Block{ "timeouts": timeouts.Block(ctx, timeouts.Opts{ +diff --git a/internal/verify/diff.go b/internal/verify/diff.go +index 5e9c779a28..87a57e6076 100644 +--- a/internal/verify/diff.go ++++ b/internal/verify/diff.go +@@ -5,103 +5,14 @@ package verify + + import ( + "context" +- "fmt" + "strings" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +- "github.com/hashicorp/terraform-provider-aws/internal/conns" +- tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" + ) + +-// Find JSON diff functions in the json.go file. +- +-// SetTagsDiff sets the new plan difference with the result of +-// merging resource tags on to those defined at the provider-level; +-// returns an error if unsuccessful or if the resource tags are identical +-// to those configured at the provider-level to avoid non-empty plans +-// after resource READ operations as resource and provider-level tags +-// will be indistinguishable when returned from an AWS API. + func SetTagsDiff(ctx context.Context, diff *schema.ResourceDiff, meta interface{}) error { +- defaultTagsConfig := meta.(*conns.AWSClient).DefaultTagsConfig +- ignoreTagsConfig := meta.(*conns.AWSClient).IgnoreTagsConfig +- +- resourceTags := tftags.New(ctx, diff.Get("tags").(map[string]interface{})) +- +- allTags := defaultTagsConfig.MergeTags(resourceTags).IgnoreConfig(ignoreTagsConfig) +- // To ensure "tags_all" is correctly computed, we explicitly set the attribute diff +- // when the merger of resource-level tags onto provider-level tags results in n > 0 tags, +- // otherwise we mark the attribute as "Computed" only when there is a known diff (excluding an empty map) +- // or a change for "tags_all". +- // Reference: https://github.com/hashicorp/terraform-provider-aws/issues/18366 +- // Reference: https://github.com/hashicorp/terraform-provider-aws/issues/19005 +- +- if !diff.GetRawPlan().GetAttr("tags").IsWhollyKnown() { +- if err := diff.SetNewComputed("tags_all"); err != nil { +- return fmt.Errorf("setting tags_all to computed: %w", err) +- } +- return nil +- } +- +- if diff.HasChange("tags") { +- _, n := diff.GetChange("tags") +- newTags := tftags.New(ctx, n.(map[string]interface{})) +- +- if newTags.HasZeroValue() { +- if err := diff.SetNewComputed("tags_all"); err != nil { +- return fmt.Errorf("setting tags_all to computed: %w", err) +- } +- } +- +- if len(allTags) > 0 && (!newTags.HasZeroValue() || !allTags.HasZeroValue()) { +- if err := diff.SetNew("tags_all", allTags.Map()); err != nil { +- return fmt.Errorf("setting new tags_all diff: %w", err) +- } +- } +- +- if len(allTags) == 0 { +- if err := diff.SetNewComputed("tags_all"); err != nil { +- return fmt.Errorf("setting tags_all to computed: %w", err) +- } +- } +- } else if !diff.HasChange("tags") { +- if len(allTags) > 0 && !allTags.HasZeroValue() { +- if err := diff.SetNew("tags_all", allTags.Map()); err != nil { +- return fmt.Errorf("setting new tags_all diff: %w", err) +- } +- return nil +- } +- +- var ta tftags.KeyValueTags +- if tagsAll, ok := diff.Get("tags_all").(map[string]interface{}); ok { +- ta = tftags.New(ctx, tagsAll) +- } +- if len(allTags) > 0 && !ta.DeepEqual(allTags) && allTags.HasZeroValue() { +- if err := diff.SetNewComputed("tags_all"); err != nil { +- return fmt.Errorf("setting tags_all to computed: %w", err) +- } +- return nil +- } +- } else if tagsAll, ok := diff.Get("tags_all").(map[string]interface{}); ok { +- ta := tftags.New(ctx, tagsAll) +- if !ta.DeepEqual(allTags) { +- if allTags.HasZeroValue() { +- if err := diff.SetNewComputed("tags_all"); err != nil { +- return fmt.Errorf("setting tags_all to computed: %w", err) +- } +- } +- } +- } else if len(diff.Get("tags_all").(map[string]interface{})) > 0 { +- if err := diff.SetNewComputed("tags_all"); err != nil { +- return fmt.Errorf("setting tags_all to computed: %w", err) +- } +- } else if diff.HasChange("tags_all") { +- if err := diff.SetNewComputed("tags_all"); err != nil { +- return fmt.Errorf("setting tags_all to computed: %w", err) +- } +- } +- + return nil + } + +diff --git a/shim/shim.go b/shim/shim.go +index 2af7c06925..ce64074bfd 100644 +--- a/shim/shim.go ++++ b/shim/shim.go +@@ -20,6 +20,9 @@ func NewUpstreamProvider(ctx context.Context) (UpstreamProvider, error) { + if err != nil { + return UpstreamProvider{}, err + } ++ if primary != nil { ++ markTagsAllNotComputedForResources(primary) ++ } + pf := fwprovider.New(primary) + return UpstreamProvider{ + SDKV2Provider: primary, +@@ -34,3 +37,35 @@ type TagIgnoreConfig = tags.IgnoreConfig + func NewTagConfig(ctx context.Context, i interface{}) TagConfig { + return TagConfig{Tags: tags.New(ctx, i)} + } ++ ++// For resources with tags_all attribute, ensures that the schema of tags_all matches the schema of ++// tags. In particular, this makes sure tags_all is not computed and is ForceNew if necessary. The ++// rationale for this is that Pulumi copies tags to tags_all before it hits the TF layer, so these ++// attributes must match in schema. ++func markTagsAllNotComputedForResources(sdkV2Provider *schema.Provider) { ++ updatedResourcesMap := map[string]*schema.Resource{} ++ for rn, r := range sdkV2Provider.ResourcesMap { ++ if _, ok := r.Schema["tags_all"]; ok { ++ var updatedResource schema.Resource = *r ++ updatedResource.Schema = map[string]*schema.Schema{} ++ ++ for k, v := range r.Schema { ++ if k == "tags_all" { ++ if tagsSchema, ok := r.Schema["tags"]; ok { ++ tagsAll := *tagsSchema ++ updatedResource.Schema[k] = &tagsAll ++ } else { ++ panic("Unable to edit tagsAll schema for " + rn) ++ } ++ } else { ++ updatedResource.Schema[k] = v ++ } ++ } ++ ++ updatedResourcesMap[rn] = &updatedResource ++ } else { ++ updatedResourcesMap[rn] = r ++ } ++ } ++ sdkV2Provider.ResourcesMap = updatedResourcesMap ++} diff --git a/patches/0032-Handle-nil-err-carefully-in-markTagsAllNotComputedFo.patch b/patches/0032-Handle-nil-err-carefully-in-markTagsAllNotComputedFo.patch deleted file mode 100644 index 06da086e3d5..00000000000 --- a/patches/0032-Handle-nil-err-carefully-in-markTagsAllNotComputedFo.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Anton Tayanovskyy -Date: Tue, 31 Oct 2023 16:38:06 -0400 -Subject: [PATCH 32/33] Handle nil/err carefully in - markTagsAllNotComputedForResources - - -diff --git a/shim/shim.go b/shim/shim.go -index 2073270778..8c3e7c7a0b 100644 ---- a/shim/shim.go -+++ b/shim/shim.go -@@ -17,10 +17,12 @@ type UpstreamProvider struct { - - func NewUpstreamProvider(ctx context.Context) (UpstreamProvider, error) { - primary, err := provider.New(ctx) -- markTagsAllNotComputedForResources(primary) - if err != nil { - return UpstreamProvider{}, err - } -+ if primary != nil { -+ markTagsAllNotComputedForResources(primary) -+ } - pf := fwprovider.New(primary) - return UpstreamProvider{ - SDKV2Provider: primary, diff --git a/patches/0033-Avoid-race-conditions-when-changing-tagsAll-Computed.patch b/patches/0033-Avoid-race-conditions-when-changing-tagsAll-Computed.patch deleted file mode 100644 index 75307933fd5..00000000000 --- a/patches/0033-Avoid-race-conditions-when-changing-tagsAll-Computed.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Anton Tayanovskyy -Date: Wed, 1 Nov 2023 10:09:10 -0400 -Subject: [PATCH 33/33] Avoid race conditions when changing tagsAll Computed - value - - -diff --git a/shim/shim.go b/shim/shim.go -index 8c3e7c7a0b..f15010faff 100644 ---- a/shim/shim.go -+++ b/shim/shim.go -@@ -39,6 +39,7 @@ func NewTagConfig(ctx context.Context, i interface{}) TagConfig { - } - - func markTagsAllNotComputedForResources(sdkV2Provider *schema.Provider) { -+ updatedResourcesMap := map[string]*schema.Resource{} - for rn, r := range sdkV2Provider.ResourcesMap { - - // Not skipping these resources results in an error: -@@ -57,11 +58,28 @@ func markTagsAllNotComputedForResources(sdkV2Provider *schema.Provider) { - continue - } - -- if tagsAll, ok := r.Schema["tags_all"]; ok { -- tagsAll.Computed = false -- if !(tagsAll.Required || tagsAll.Optional) { -- tagsAll.Optional = true -+ if _, ok := r.Schema["tags_all"]; ok { -+ var updatedResource schema.Resource = *r -+ updatedResource.Schema = map[string]*schema.Schema{} -+ -+ for k, v := range r.Schema { -+ if k == "tags_all" { -+ var tagsAll schema.Schema -+ tagsAll = *v -+ tagsAll.Computed = false -+ if !(tagsAll.Required || tagsAll.Optional) { -+ tagsAll.Optional = true -+ } -+ updatedResource.Schema[k] = &tagsAll -+ } else { -+ updatedResource.Schema[k] = v -+ } - } -+ -+ updatedResourcesMap[rn] = &updatedResource -+ } else { -+ updatedResourcesMap[rn] = r - } - } -+ sdkV2Provider.ResourcesMap = updatedResourcesMap - } diff --git a/patches/0034-Copy-tags-schema-to-tags_all-schema-remove-exception.patch b/patches/0034-Copy-tags-schema-to-tags_all-schema-remove-exception.patch deleted file mode 100644 index ed4ea51f8e5..00000000000 --- a/patches/0034-Copy-tags-schema-to-tags_all-schema-remove-exception.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Anton Tayanovskyy -Date: Wed, 1 Nov 2023 10:54:08 -0400 -Subject: [PATCH 34/34] Copy tags schema to tags_all schema, remove exceptions - - -diff --git a/shim/shim.go b/shim/shim.go -index f15010faff..ce64074bfd 100644 ---- a/shim/shim.go -+++ b/shim/shim.go -@@ -38,39 +38,25 @@ func NewTagConfig(ctx context.Context, i interface{}) TagConfig { - return TagConfig{Tags: tags.New(ctx, i)} - } - -+// For resources with tags_all attribute, ensures that the schema of tags_all matches the schema of -+// tags. In particular, this makes sure tags_all is not computed and is ForceNew if necessary. The -+// rationale for this is that Pulumi copies tags to tags_all before it hits the TF layer, so these -+// attributes must match in schema. - func markTagsAllNotComputedForResources(sdkV2Provider *schema.Provider) { - updatedResourcesMap := map[string]*schema.Resource{} - for rn, r := range sdkV2Provider.ResourcesMap { -- -- // Not skipping these resources results in an error: -- // -- // * resource aws_macie2_custom_data_identifier: No Update defined, must set ForceNew on: []string{"tags_all"} -- // * resource aws_emrcontainers_job_template: No Update defined, must set ForceNew on: []string{"tags_all"} -- // * resource aws_ivs_playback_key_pair: No Update defined, must set ForceNew on: []string{"tags_all"} -- // * resource aws_ivs_recording_configuration: No Update defined, must set ForceNew on: []string{"tags_all"} -- // * resource aws_ssm_activation: No Update defined, must set ForceNew on: []string{"tags_all"} -- switch rn { -- case "aws_macie2_custom_data_identifier", -- "aws_emrcontainers_job_template", -- "aws_ivs_playback_key_pair", -- "aws_ivs_recording_configuration", -- "aws_ssm_activation": -- continue -- } -- - if _, ok := r.Schema["tags_all"]; ok { - var updatedResource schema.Resource = *r - updatedResource.Schema = map[string]*schema.Schema{} - - for k, v := range r.Schema { - if k == "tags_all" { -- var tagsAll schema.Schema -- tagsAll = *v -- tagsAll.Computed = false -- if !(tagsAll.Required || tagsAll.Optional) { -- tagsAll.Optional = true -+ if tagsSchema, ok := r.Schema["tags"]; ok { -+ tagsAll := *tagsSchema -+ updatedResource.Schema[k] = &tagsAll -+ } else { -+ panic("Unable to edit tagsAll schema for " + rn) - } -- updatedResource.Schema[k] = &tagsAll - } else { - updatedResource.Schema[k] = v - } diff --git a/patches/0036-Invert-the-assert-tags_all-must-not-be-Computed.patch b/patches/0036-Invert-the-assert-tags_all-must-not-be-Computed.patch deleted file mode 100644 index ffc334fe291..00000000000 --- a/patches/0036-Invert-the-assert-tags_all-must-not-be-Computed.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Anton Tayanovskyy -Date: Fri, 3 Nov 2023 16:42:02 -0400 -Subject: [PATCH 36/36] Invert the assert - tags_all must not be Computed - - -diff --git a/internal/provider/fwprovider/provider.go b/internal/provider/fwprovider/provider.go -index 85a814022b..b119e21c46 100644 ---- a/internal/provider/fwprovider/provider.go -+++ b/internal/provider/fwprovider/provider.go -@@ -413,8 +413,8 @@ func (p *fwprovider) Resources(ctx context.Context) []func() resource.Resource { - continue - } - if v, ok := schemaResponse.Schema.Attributes[names.AttrTagsAll]; ok { -- if !v.IsComputed() { -- errs = append(errs, fmt.Errorf("`%s` attribute must be Computed: %s", names.AttrTagsAll, typeName)) -+ if v.IsComputed() { -+ errs = append(errs, fmt.Errorf("`%s` attribute must not be Computed: %s", names.AttrTagsAll, typeName)) - continue - } - } else { diff --git a/patches/0037-Do-not-compute-tagsAll-for-PF-resources-at-TF-level.patch b/patches/0037-Do-not-compute-tagsAll-for-PF-resources-at-TF-level.patch deleted file mode 100644 index 563dda49832..00000000000 --- a/patches/0037-Do-not-compute-tagsAll-for-PF-resources-at-TF-level.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Anton Tayanovskyy -Date: Fri, 3 Nov 2023 16:45:37 -0400 -Subject: [PATCH 37/37] Do not compute tagsAll for PF resources at TF level - - -diff --git a/internal/framework/base.go b/internal/framework/base.go -index 34065d9285..89248e4569 100644 ---- a/internal/framework/base.go -+++ b/internal/framework/base.go -@@ -69,34 +69,7 @@ func (r *ResourceWithConfigure) Configure(_ context.Context, request resource.Co - - // SetTagsAll calculates the new value for the `tags_all` attribute. - func (r *ResourceWithConfigure) SetTagsAll(ctx context.Context, request resource.ModifyPlanRequest, response *resource.ModifyPlanResponse) { -- // If the entire plan is null, the resource is planned for destruction. -- if request.Plan.Raw.IsNull() { -- return -- } -- -- defaultTagsConfig := r.Meta().DefaultTagsConfig -- ignoreTagsConfig := r.Meta().IgnoreTagsConfig -- -- var planTags types.Map -- -- response.Diagnostics.Append(request.Plan.GetAttribute(ctx, path.Root(names.AttrTags), &planTags)...) -- -- if response.Diagnostics.HasError() { -- return -- } -- -- if !planTags.IsUnknown() { -- if !mapHasUnknownElements(planTags) { -- resourceTags := tftags.New(ctx, planTags) -- allTags := defaultTagsConfig.MergeTags(resourceTags).IgnoreConfig(ignoreTagsConfig) -- -- response.Diagnostics.Append(response.Plan.SetAttribute(ctx, path.Root(names.AttrTagsAll), flex.FlattenFrameworkStringValueMapLegacy(ctx, allTags.Map()))...) -- } else { -- response.Diagnostics.Append(response.Plan.SetAttribute(ctx, path.Root(names.AttrTagsAll), tftags.Unknown)...) -- } -- } else { -- response.Diagnostics.Append(response.Plan.SetAttribute(ctx, path.Root(names.AttrTagsAll), tftags.Unknown)...) -- } -+ return - } - - // WithImportByID is intended to be embedded in resources which import state via the "id" attribute. diff --git a/patches/0038-Do-not-compute-tagsAll-for-PF-resources-at-TF-level.patch b/patches/0038-Do-not-compute-tagsAll-for-PF-resources-at-TF-level.patch deleted file mode 100644 index b36b00c5c28..00000000000 --- a/patches/0038-Do-not-compute-tagsAll-for-PF-resources-at-TF-level.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Anton Tayanovskyy -Date: Fri, 3 Nov 2023 16:50:02 -0400 -Subject: [PATCH 38/38] Do not compute tagsAll for PF resources at TF level - - -diff --git a/internal/framework/base.go b/internal/framework/base.go -index 89248e4569..5225f639af 100644 ---- a/internal/framework/base.go -+++ b/internal/framework/base.go -@@ -69,7 +69,40 @@ func (r *ResourceWithConfigure) Configure(_ context.Context, request resource.Co - - // SetTagsAll calculates the new value for the `tags_all` attribute. - func (r *ResourceWithConfigure) SetTagsAll(ctx context.Context, request resource.ModifyPlanRequest, response *resource.ModifyPlanResponse) { -- return -+ -+ // Skip SetTagsAll in Pulumi because it is handled at Pulumi provider level. -+ if 1+1 == 2 { -+ return -+ } -+ -+ // If the entire plan is null, the resource is planned for destruction. -+ if request.Plan.Raw.IsNull() { -+ return -+ } -+ -+ defaultTagsConfig := r.Meta().DefaultTagsConfig -+ ignoreTagsConfig := r.Meta().IgnoreTagsConfig -+ -+ var planTags types.Map -+ -+ response.Diagnostics.Append(request.Plan.GetAttribute(ctx, path.Root(names.AttrTags), &planTags)...) -+ -+ if response.Diagnostics.HasError() { -+ return -+ } -+ -+ if !planTags.IsUnknown() { -+ if !mapHasUnknownElements(planTags) { -+ resourceTags := tftags.New(ctx, planTags) -+ allTags := defaultTagsConfig.MergeTags(resourceTags).IgnoreConfig(ignoreTagsConfig) -+ -+ response.Diagnostics.Append(response.Plan.SetAttribute(ctx, path.Root(names.AttrTagsAll), flex.FlattenFrameworkStringValueMapLegacy(ctx, allTags.Map()))...) -+ } else { -+ response.Diagnostics.Append(response.Plan.SetAttribute(ctx, path.Root(names.AttrTagsAll), tftags.Unknown)...) -+ } -+ } else { -+ response.Diagnostics.Append(response.Plan.SetAttribute(ctx, path.Root(names.AttrTagsAll), tftags.Unknown)...) -+ } - } - - // WithImportByID is intended to be embedded in resources which import state via the "id" attribute.