This repository was archived by the owner on Jul 20, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +9
-3
lines changed Expand file tree Collapse file tree 4 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,7 @@ No requirements.
152152| user\_ data\_ runcmd | Additional runcmd section of cloud-init | ` list ` | ` [] ` | no |
153153| user\_ data\_ write\_ files | Additional write\_ files section of cloud-init | ` list ` | ` [] ` | no |
154154| vpc\_ id | ID of the VPC | ` string ` | n/a | yes |
155+ | eip_creation | Whether to create an eip | ` bool ` | ` true ` | no |
155156
156157## Outputs
157158
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ resource "aws_network_interface" "this" {
3232}
3333
3434resource "aws_eip" "this" {
35- count = var. enabled ? 1 : 0
35+ count = var. enabled ? var . eip_creation ? 1 : 0 : 0
3636 network_interface = aws_network_interface. this . id
3737 tags = local. common_tags
3838}
Original file line number Diff line number Diff line change 11output "eip_id" {
22 description = " ID of the Elastic IP"
3- value = var. enabled ? aws_eip. this [0 ]. id : " "
3+ value = var. enabled ? var . eip_creation ? aws_eip. this [0 ]. id : " " : " "
44}
55
66output "eip_public_ip" {
77 description = " Public IP of the Elastic IP for the NAT instance"
8- value = var. enabled ? aws_eip. this [0 ]. public_ip : " "
8+ value = var. enabled ? var . eip_creation ? aws_eip. this [0 ]. public_ip : " " : " "
99}
1010
1111output "eni_id" {
Original file line number Diff line number Diff line change @@ -71,6 +71,11 @@ variable "user_data_runcmd" {
7171 type = list
7272 default = []
7373}
74+ variable "eip_creation" {
75+ description = " Whether to create an elastic ip"
76+ type = bool
77+ default = true
78+ }
7479
7580locals {
7681 // Generate common tags by merging variables and default Name
You can’t perform that action at this time.
0 commit comments