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

Fix the error when "create_security_group" is set to false #75

Merged

Conversation

legal90
Copy link
Contributor

@legal90 legal90 commented Oct 23, 2019

If the create_security_group var is set to false, then aws_security_group.this[0] is not defined, which causes errors (reproduced on terraform v0.12.12):

../terraform-aws-rds-aurora/outputs.tf line 57, in output "this_security_group_id":
  57:   value       = aws_security_group.this[0].id
    |----------------
    | aws_security_group.this is empty tuple
../terraform-aws-rds-aurora/main.tf line 48, in resource "aws_rds_cluster" "this":
  48:   vpc_security_group_ids              = compact(concat([aws_security_group.this[0].id], var.vpc_security_group_ids))
    |----------------
    | aws_security_group.this is empty tuple

This PR fixes that in a similar way how it's done in https://github.com/terraform-aws-modules/terraform-aws-vpc

If the `create_security_group` var is set to `false`, then 
`aws_security_group.this[0]` is not defined.
It should be properly worked around.
@legal90
Copy link
Contributor Author

legal90 commented Nov 7, 2019

@antonbabenko Could you please review this PR?

@antonbabenko antonbabenko merged commit 6510b3d into terraform-aws-modules:master Nov 8, 2019
@antonbabenko
Copy link
Member

Thanks, Mikhail!

I've just released v2.7.0 of this module.

@legal90 legal90 deleted the fix/create-sg-disabled branch November 8, 2019 18:56
@github-actions
Copy link

I'm going to lock this pull request 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 related to this change, 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 Apr 15, 2023
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 this pull request may close these issues.

2 participants