Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tagsSchema should not set Computed to true #730

Closed
ojongerius opened this issue Jan 3, 2015 · 1 comment · Fixed by #731
Closed

tagsSchema should not set Computed to true #730

ojongerius opened this issue Jan 3, 2015 · 1 comment · Fixed by #731

Comments

@ojongerius
Copy link
Contributor

When there are no tags for a resource (I've tested it with resource aws_route_table), tags in master (at bb3bbcc) will alway plan changes to modify or add tag # with <computed>, in my tests this just resulted in a tag with key # and value "".

     tags.#: "" => "<computed>"

Debugging shows there are no changes, but NewComputed is set to true. An apply sets or keeps the value for tag # to/at "". A new planning session takes us back to where we were.

Debugging line showing the diff:

    "tags.#":*terraform.ResourceAttrDiff{
      Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Type:0x0
      },

Removing Computed: true from the schema in tags.go will trigger, AFAICS, correct behaviour:

  • if there are no tags, create tags.# with value 0
  • if there are any tags to add, add them and increment value.# accordingly.
  • if there are any tags to remove, remove them and decrease value.# accordingly.
diff --git a/builtin/providers/aws/tags.go b/builtin/providers/aws/tags.go
index a188eaf..b45875c 100644
--- a/builtin/providers/aws/tags.go
+++ b/builtin/providers/aws/tags.go
@@ -12,7 +12,6 @@ func tagsSchema() *schema.Schema {
        return &schema.Schema{
                Type:     schema.TypeMap,
                Optional: true,
-               Computed: true,
        }
 }
@ghost
Copy link

ghost commented May 4, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators May 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants