File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 13
13
sensitive = true
14
14
}
15
15
16
+ variable "dedicated_host_id" {
17
+ description = " Dedicated host ID: (leave blank to create a new one)"
18
+ default = false
19
+ type = string
20
+ }
21
+
16
22
variable "secret_key" {
17
23
description = << EOT
18
24
AWS Secret Key
21
27
}
22
28
23
29
resource "aws_ec2_host" "dedicated" {
30
+ count = var. dedicated_host_id == " " ? 1 : 0
24
31
instance_type = " mac1.metal"
25
32
availability_zone = " us-west-2a"
26
33
host_recovery = " off"
85
92
resource "aws_instance" "dev" {
86
93
ami = data. aws_ami . mac . id
87
94
availability_zone = " us-west-2a"
88
- host_id = aws_ec2_host. dedicated . id
95
+ host_id = var . dedicated_host_id == " " ? aws_ec2_host. dedicated [ 0 ] . id : var . dedicated_host_id
89
96
instance_type = " mac1.metal"
90
97
count = 1
91
98
You can’t perform that action at this time.
0 commit comments