forked from terraform-aws-modules/terraform-aws-ec2-instance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
outputs.tf
232 lines (205 loc) · 6.8 KB
/
outputs.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
output "id" {
description = "The ID of the instance"
value = try(
aws_instance.this[0].id,
aws_instance.ignore_ami[0].id,
aws_spot_instance_request.this[0].id,
null,
)
}
output "arn" {
description = "The ARN of the instance"
value = try(
aws_instance.this[0].arn,
aws_instance.ignore_ami[0].arn,
aws_spot_instance_request.this[0].arn,
null,
)
}
output "capacity_reservation_specification" {
description = "Capacity reservation specification of the instance"
value = try(
aws_instance.this[0].capacity_reservation_specification,
aws_instance.ignore_ami[0].capacity_reservation_specification,
aws_spot_instance_request.this[0].capacity_reservation_specification,
null,
)
}
output "instance_state" {
description = "The state of the instance"
value = try(
aws_instance.this[0].instance_state,
aws_instance.ignore_ami[0].instance_state,
aws_spot_instance_request.this[0].instance_state,
null,
)
}
output "outpost_arn" {
description = "The ARN of the Outpost the instance is assigned to"
value = try(
aws_instance.this[0].outpost_arn,
aws_instance.ignore_ami[0].outpost_arn,
aws_spot_instance_request.this[0].outpost_arn,
null,
)
}
output "password_data" {
description = "Base-64 encoded encrypted password data for the instance. Useful for getting the administrator password for instances running Microsoft Windows. This attribute is only exported if `get_password_data` is true"
value = try(
aws_instance.this[0].password_data,
aws_instance.ignore_ami[0].password_data,
aws_spot_instance_request.this[0].password_data,
null,
)
}
output "primary_network_interface_id" {
description = "The ID of the instance's primary network interface"
value = try(
aws_instance.this[0].primary_network_interface_id,
aws_instance.ignore_ami[0].primary_network_interface_id,
aws_spot_instance_request.this[0].primary_network_interface_id,
null,
)
}
output "private_dns" {
description = "The private DNS name assigned to the instance. Can only be used inside the Amazon EC2, and only available if you've enabled DNS hostnames for your VPC"
value = try(
aws_instance.this[0].private_dns,
aws_instance.ignore_ami[0].private_dns,
aws_spot_instance_request.this[0].private_dns,
null,
)
}
output "public_dns" {
description = "The public DNS name assigned to the instance. For EC2-VPC, this is only available if you've enabled DNS hostnames for your VPC"
value = try(
aws_instance.this[0].public_dns,
aws_instance.ignore_ami[0].public_dns,
aws_spot_instance_request.this[0].public_dns,
null,
)
}
output "public_ip" {
description = "The public IP address assigned to the instance, if applicable."
value = try(
aws_eip.this[0].public_ip,
aws_instance.this[0].public_ip,
aws_instance.ignore_ami[0].public_ip,
aws_spot_instance_request.this[0].public_ip,
null,
)
}
output "private_ip" {
description = "The private IP address assigned to the instance"
value = try(
aws_instance.this[0].private_ip,
aws_instance.ignore_ami[0].private_ip,
aws_spot_instance_request.this[0].private_ip,
null,
)
}
output "ipv6_addresses" {
description = "The IPv6 address assigned to the instance, if applicable"
value = try(
aws_instance.this[0].ipv6_addresses,
aws_instance.ignore_ami[0].ipv6_addresses,
aws_spot_instance_request.this[0].ipv6_addresses,
[],
)
}
output "tags_all" {
description = "A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block"
value = try(
aws_instance.this[0].tags_all,
aws_instance.ignore_ami[0].tags_all,
aws_spot_instance_request.this[0].tags_all,
{},
)
}
output "spot_bid_status" {
description = "The current bid status of the Spot Instance Request"
value = try(aws_spot_instance_request.this[0].spot_bid_status, null)
}
output "spot_request_state" {
description = "The current request state of the Spot Instance Request"
value = try(aws_spot_instance_request.this[0].spot_request_state, null)
}
output "spot_instance_id" {
description = "The Instance ID (if any) that is currently fulfilling the Spot Instance request"
value = try(aws_spot_instance_request.this[0].spot_instance_id, null)
}
output "ami" {
description = "AMI ID that was used to create the instance"
value = try(
aws_instance.this[0].ami,
aws_instance.ignore_ami[0].ami,
aws_spot_instance_request.this[0].ami,
null,
)
}
output "availability_zone" {
description = "The availability zone of the created instance"
value = try(
aws_instance.this[0].availability_zone,
aws_instance.ignore_ami[0].availability_zone,
aws_spot_instance_request.this[0].availability_zone,
null,
)
}
################################################################################
# IAM Role / Instance Profile
################################################################################
output "iam_role_name" {
description = "The name of the IAM role"
value = try(aws_iam_role.this[0].name, null)
}
output "iam_role_arn" {
description = "The Amazon Resource Name (ARN) specifying the IAM role"
value = try(aws_iam_role.this[0].arn, null)
}
output "iam_role_unique_id" {
description = "Stable and unique string identifying the IAM role"
value = try(aws_iam_role.this[0].unique_id, null)
}
output "iam_instance_profile_arn" {
description = "ARN assigned by AWS to the instance profile"
value = try(aws_iam_instance_profile.this[0].arn, null)
}
output "iam_instance_profile_id" {
description = "Instance profile's ID"
value = try(aws_iam_instance_profile.this[0].id, null)
}
output "iam_instance_profile_unique" {
description = "Stable and unique string identifying the IAM instance profile"
value = try(aws_iam_instance_profile.this[0].unique_id, null)
}
################################################################################
# Block Devices
################################################################################
output "root_block_device" {
description = "Root block device information"
value = try(
aws_instance.this[0].root_block_device,
aws_instance.ignore_ami[0].root_block_device,
aws_spot_instance_request.this[0].root_block_device,
null
)
}
output "ebs_block_device" {
description = "EBS block device information"
value = try(
aws_instance.this[0].ebs_block_device,
aws_instance.ignore_ami[0].ebs_block_device,
aws_spot_instance_request.this[0].ebs_block_device,
null
)
}
output "ephemeral_block_device" {
description = "Ephemeral block device information"
value = try(
aws_instance.this[0].ephemeral_block_device,
aws_instance.ignore_ami[0].ephemeral_block_device,
aws_spot_instance_request.this[0].ephemeral_block_device,
null
)
}