cloudposse / terraform-aws-security-group

Terraform module to provision an AWS Security Group
https://cloudposse.com/accelerate
Apache License 2.0
36 stars 35 forks source link

Small fixes #36

Closed nitrocode closed 2 years ago

nitrocode commented 2 years ago

what

why

│ Error: Invalid index
│
│   on .terraform/modules/sftp.security_group/main.tf line 36, in locals:
│   36:   cbd_security_group_id = local.create_security_group ? one(aws_security_group.cbd[*].id) : var.target_security_group_id[0]
│     ├────────────────
│     │ var.target_security_group_id is empty list of string

references

nitrocode commented 2 years ago

/test all

Nuru commented 2 years ago

If local.create_security_group is false then this module is not creating a security group and it is therefore an error to not supply a target_security_group_id. This is intentional.

nitrocode commented 2 years ago

What variable in the sg export should be mapped to the target_security_group_id ?

Nuru commented 2 years ago

What variable in the sg export should be mapped to the target_security_group_id ?

None. Other Cloud Posse modules using this module should, in general, either create a security group or accept an already configured security group. If another module were to accept a security group ID and then use this module to modify the security group, this would likely cause flapping between the configuration of the security group in that module and the configuration in whatever module created the security group.

Every Cloud Posse module should output enough information for the user to configure any security group they want to work with the resources created by that module. If we find a use case where it is appropriate for the module to modify the security group it is given, we can address that as a special case.