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

Empty value EC2 tag will fail terraform apply #102

Closed
cwyl02 opened this issue May 19, 2020 · 5 comments · Fixed by #119
Closed

Empty value EC2 tag will fail terraform apply #102

cwyl02 opened this issue May 19, 2020 · 5 comments · Fixed by #119

Comments

@cwyl02
Copy link

cwyl02 commented May 19, 2020

Hi guys,

This is my module definition:

module "service-auto-scaling-group" {
  source = "terraform-aws-modules/autoscaling/aws"
  version = "3.0.0"

  ...

  tags = [
   ...
    {
      key = "Reserve"
      value = ""
      propagate_at_launch = true
    }
  ]
}

This results in the following tf plan diff:

# blah.module.service-auto-scaling-group.aws_autoscaling_group.this[0] will be created
  + resource "aws_autoscaling_group" "this" {
      + ....
      + tags                      = [
          + {
              + "key"                 = "Reserve"
              + "propagate_at_launch" = "true"
            },
        ]
      + ...
    }

Notice that the "value" = "" is expected, but it's omitted for some reasons.

And when I run terraform apply, it spit out this error:

Error: blah-asg-blah: invalid tag attributes: value missing

 on blah.tf line 60, in resource "aws_autoscaling_group" "this":
  60: resource "aws_autoscaling_group" "this" {

09/28 edit:

Expected behavior:

in the example above,

+ resource "aws_autoscaling_group" "this" {
      + ....
      + tags                      = [
          + {
              + "key"                 = "Reserve"
              + "propagate_at_launch" = "true"
              + "value"                          =  ""    // empty value is correctly added
            },
        ]
      + ...
    }

Environment:
terraform 0.12.7
terraform-aws-modules/autoscaling/aws 3.0.0
OS: MacOS 10.13.6

@cwyl02
Copy link
Author

cwyl02 commented May 19, 2020

When I substitute tags to tags_as_map, still got the same behavior.

However, the null resource of tag is created correctly:

+ resource "null_resource" "tags_as_list_of_maps" {
      + id       = (known after apply)
      + triggers = {
          + "key"                 = "Reserve"
          + "propagate_at_launch" = "true"
          + "value"               = ""
        }
    }

@bryantbiggs
Copy link
Member

hi @cwyl02 - could you elaborate more on what issue you are looking to be solved? instead of passing an empty string can you just use a value like "none"?

@cwyl02
Copy link
Author

cwyl02 commented Sep 29, 2020

@bryantbiggs Sorry for the late response, I updated the expected behavior. We do have a requirement for this tag having this Reserve tag with empty value - it will be consumed by some AWS billing auditing tool.

@antonbabenko
Copy link
Member

This has been fixed in #119, so please make sure to use v3.7.0 which has been just released.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants