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

aws_autoscaling_group tags not recognised #208

Closed
GJKrupa opened this issue Feb 11, 2020 · 4 comments
Closed

aws_autoscaling_group tags not recognised #208

GJKrupa opened this issue Feb 11, 2020 · 4 comments
Assignees
Labels
bug waiting for confirmation Workaround/Fix applied, waiting for confirmation

Comments

@GJKrupa
Copy link

GJKrupa commented Feb 11, 2020

Description :
When testing for the presence of tags, aws_autoscaling_group tags are not recognised and cause test failures.

To Reproduce

  1. Example terraform code
resource "aws_autoscaling_group" "thing" {
  name_prefix               = "thing"
  vpc_zone_identifier       = [var.subnets[0].id]
  desired_capacity          = 3
  min_size                  = 1
  max_size                  = 3
  health_check_grace_period = 300
  health_check_type         = "EC2"
  force_delete              = true
  launch_configuration      = aws_launch_configuration.thing.name
  placement_group           = aws_placement_group.thing.id

  timeouts {
    delete = "15m"
  }

  lifecycle {
    create_before_destroy = true
  }

  tags = [{
    key                 = "Name"
    value               = "thing"
    propagate_at_launch = true
    }, {
    key                 = "Environment"
    value               = "dev"
    propagate_at_launch = true
    }, {
    key                 = "Capability"
    value               = "thing"
    propagate_at_launch = true
  }]
}
  1. terraform-compliance -p plan -f features
  2. Run via Python package
  3. Failure: module.thing.aws_autoscaling_group.thing (aws_autoscaling_group) does not have Capability property.
  4. <Your feature/scenario/steps>
  Scenario Outline: All the things have tags
    Given I have resource that supports tags defined
    Then it must contain <tags>

    Examples:
      | tags        |
      | Capability  |
      | Environment |

Expected behavior :
Test should pass

Tested versions :

  • terraform-compliance v1.1.3
  • terraform v0.12.10
  • Python 3.7.2

Additional context
The structure of tags for aws_autoscaling_group is different because of the ability to propagate the tags to created instances. In the plan JSON they look like the following:

{
              "address": "module.thing.aws_autoscaling_group.thing",
               ...
                "tags": [
                  {
                    "key": "Name",
                    "propagate_at_launch": "true",
                    "value": "thing"
                  },
                  {
                    "key": "Environment",
                    "propagate_at_launch": "true",
                    "value": "dev"
                  },
                  {
                    "key": "Capability",
                    "propagate_at_launch": "true",
                    "value": "thing"
                  }
                ],
                ...
}
@eerkunt
Copy link
Member

eerkunt commented Feb 11, 2020

Ah yes, this is because of the ASG's nature.

We are looking for Capability key, but actually the key is key in this case. :(

I will think of something about this within the tool, not sure how we should approach this though.

@eerkunt
Copy link
Member

eerkunt commented Feb 23, 2020

Hello @GJKrupa,

Can you please have a try with 1.1.8 and let me know if it works for you ?

Thanks! 🎉

@eerkunt eerkunt added the waiting for confirmation Workaround/Fix applied, waiting for confirmation label Feb 23, 2020
@GJKrupa
Copy link
Author

GJKrupa commented Mar 3, 2020

Looks good to me. I tried both positive and negative cases with 1.1.9 and it gives the results I expected.
Thanks.

@GJKrupa GJKrupa closed this as completed Mar 3, 2020
@ghost
Copy link

ghost commented Mar 3, 2020

This issue's conversation is now locked. If you want to continue this discussion please open a new issue.

@ghost ghost locked and limited conversation to collaborators Mar 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug waiting for confirmation Workaround/Fix applied, waiting for confirmation
Projects
None yet
Development

No branches or pull requests

2 participants