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.
152
152
| user\_ data\_ runcmd | Additional runcmd section of cloud-init | ` list ` | ` [] ` | no |
153
153
| user\_ data\_ write\_ files | Additional write\_ files section of cloud-init | ` list ` | ` [] ` | no |
154
154
| vpc\_ id | ID of the VPC | ` string ` | n/a | yes |
155
+ | eip_creation | Whether to create an eip | ` bool ` | ` true ` | no |
155
156
156
157
## Outputs
157
158
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ resource "aws_network_interface" "this" {
32
32
}
33
33
34
34
resource "aws_eip" "this" {
35
- count = var. enabled ? 1 : 0
35
+ count = var. enabled ? var . eip_creation ? 1 : 0 : 0
36
36
network_interface = aws_network_interface. this . id
37
37
tags = local. common_tags
38
38
}
Original file line number Diff line number Diff line change 1
1
output "eip_id" {
2
2
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 : " " : " "
4
4
}
5
5
6
6
output "eip_public_ip" {
7
7
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 : " " : " "
9
9
}
10
10
11
11
output "eni_id" {
Original file line number Diff line number Diff line change @@ -71,6 +71,11 @@ variable "user_data_runcmd" {
71
71
type = list
72
72
default = []
73
73
}
74
+ variable "eip_creation" {
75
+ description = " Whether to create an elastic ip"
76
+ type = bool
77
+ default = true
78
+ }
74
79
75
80
locals {
76
81
// Generate common tags by merging variables and default Name
You can’t perform that action at this time.
0 commit comments