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_security_group -> ingress description #7177

Closed
masterjg opened this issue Jan 17, 2019 · 3 comments
Closed

aws_security_group -> ingress description #7177

masterjg opened this issue Jan 17, 2019 · 3 comments
Labels
service/ec2 Issues and PRs that pertain to the ec2 service. stale Old or inactive issues managed by automation, if no further action taken these will get closed. upstream-terraform Addresses functionality related to the Terraform core binary.

Comments

@masterjg
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Affected Resource(s)

  • aws_security_group
  • template_file

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

Debug Output

Panic Output

Expected Behavior

When we add description to ingress/egress blocks we are able to use lookup on their properties.

Actual Behavior

When description is added lookup doesn't find any properties of either ingress or egress objects and produces this error:

Error: Error running plan: 1 error(s) occurred:

* module.rabbitmq.data.template_file.port: 3 error(s) occurred:

* module.rabbitmq.data.template_file.port[2]: lookup: lookup failed to find 'description' in:

${format("%s/%s", lookup(aws_security_group.rabbitmq.ingress[count.index], "description"), lookup(aws_security_group.rabbitmq.ingress[count.index], "protocol"))}
* module.rabbitmq.data.template_file.port[0]: lookup: lookup failed to find 'description' in:

${format("%s/%s", lookup(aws_security_group.rabbitmq.ingress[count.index], "description"), lookup(aws_security_group.rabbitmq.ingress[count.index], "protocol"))}
* module.rabbitmq.data.template_file.port[1]: lookup: lookup failed to find 'description' in:

${format("%s/%s", lookup(aws_security_group.rabbitmq.ingress[count.index], "description"), lookup(aws_security_group.rabbitmq.ingress[count.index], "protocol"))}

Steps to Reproduce

  1. Create aws_security_group resource (for example):
resource "aws_security_group" "rabbitmq" {
  name = "rabbitmq"
  description = "RabbitMQ server access rules"
  ingress {
    description = "SSH"
    from_port = 22
    to_port = 22
    protocol = "tcp"
    cidr_blocks = [
      "0.0.0.0/0"
    ]
  }
  ingress {
    description = "RabbitMQ"
    from_port = 5672
    to_port = 5672
    protocol = "tcp"
    cidr_blocks = [
      "0.0.0.0/0"
    ]
  }
  ingress {
    description = "RabbitMQ web administration"
    from_port = 15672
    to_port = 15672
    protocol = "tcp"
    cidr_blocks = [
      "0.0.0.0/0"
    ]
  }
  egress {
    description = "Allow all outbound connections"
    from_port = 0
    to_port = 0
    protocol = "-1"
    cidr_blocks = [
      "0.0.0.0/0"
    ]
  }
  tags {
    Name = "rabbitmq"
  }
}
  1. Create data source for formatted template:
data "template_file" "port" {
  count = "${length(aws_security_group.rabbitmq.ingress)}"
  template = "${format("%s/%s", lookup(aws_security_group.rabbitmq.ingress[count.index], "from_port"), lookup(aws_security_group.rabbitmq.ingress[count.index], "protocol"))}"
}
  1. terraform apply

Important Factoids

References

  • #0000
@masterjg
Copy link
Author

masterjg commented Jan 17, 2019

It may be related to these issues: hashicorp/terraform#4149, hashicorp/terraform#12570

@bflad bflad added upstream-terraform Addresses functionality related to the Terraform core binary. service/ec2 Issues and PRs that pertain to the ec2 service. labels Jan 17, 2019
@github-actions
Copy link

github-actions bot commented Jan 6, 2021

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Jan 6, 2021
@github-actions github-actions bot closed this as completed Feb 6, 2021
@ghost
Copy link

ghost commented Mar 9, 2021

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Mar 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/ec2 Issues and PRs that pertain to the ec2 service. stale Old or inactive issues managed by automation, if no further action taken these will get closed. upstream-terraform Addresses functionality related to the Terraform core binary.
Projects
None yet
Development

No branches or pull requests

2 participants