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

fixing enabled flag #93

Merged
merged 5 commits into from
Aug 12, 2020
Merged

fixing enabled flag #93

merged 5 commits into from
Aug 12, 2020

Conversation

jamengual
Copy link
Contributor

what

  • Fixing resource creation when enabled flag is = false

why

  • Some resources were still created even when the enabled flag was false

@jamengual jamengual requested a review from a team as a code owner August 11, 2020 19:51
@jamengual jamengual requested review from adamcrews and nitrocode and removed request for a team August 11, 2020 19:51
@jamengual
Copy link
Contributor Author

/test all

@jamengual
Copy link
Contributor Author

/rebuild-readme

@jamengual
Copy link
Contributor Author

/test all

1 similar comment
@jamengual
Copy link
Contributor Author

/test all

@jamengual
Copy link
Contributor Author

/test all

nat_instance_count = var.nat_instance_enabled && ! local.use_existing_eips ? length(var.availability_zones) : 0
nat_instance_eip_count = local.use_existing_eips ? 0 : local.nat_instance_count
instance_eip_allocations = local.use_existing_eips ? data.aws_eip.nat_ips.*.id : aws_eip.nat_instance.*.id
}

resource "aws_security_group" "nat_instance" {
count = local.nat_instance_enabled
count = var.enabled ? local.nat_instance_enabled : 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be much more readable and consistent than using the current local variable.

Suggested change
count = var.enabled ? local.nat_instance_enabled : 0
count = var.enabled && var.nat_instance_enabled ? 1 : 0

@jamengual jamengual merged commit 537bf7b into master Aug 12, 2020
@jamengual jamengual deleted the enabled_fix branch August 12, 2020 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants