X EC2 (or 1 ASG X:X); X external volumes; X network interfaces; KMS key for volumes; Key pair
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

211 lines
4.7KB

  1. ####
  2. # Global
  3. ####
  4. output "availability_zones" {
  5. value = compact(concat(aws_instance.this.*.availability_zone, tolist(element(concat(aws_autoscaling_group.this.*.availability_zones, [[""]]), 0)), [""]))
  6. }
  7. output "subnet_ids" {
  8. value = compact(concat(aws_instance.this.*.subnet_id, tolist(element(concat(aws_autoscaling_group.this.*.vpc_zone_identifier, [[""]]), 0)), [""]))
  9. }
  10. ####
  11. # Launch template
  12. ####
  13. output "launch_template_id" {
  14. value = concat(aws_launch_template.this.*.id, [""])[0]
  15. }
  16. output "launch_template_arn" {
  17. value = concat(aws_launch_template.this.*.arn, [""])[0]
  18. }
  19. output "launch_template_default_version" {
  20. value = concat(aws_launch_template.this.*.default_version, [""])[0]
  21. }
  22. output "launch_template_latest_version" {
  23. value = concat(aws_launch_template.this.*.latest_version, [""])[0]
  24. }
  25. ####
  26. # AutoScaling Group
  27. ####
  28. output "autoscaling_group_id" {
  29. value = concat(aws_autoscaling_group.this.*.id, [""])[0]
  30. }
  31. output "autoscaling_group_arn" {
  32. value = concat(aws_autoscaling_group.this.*.arn, [""])[0]
  33. }
  34. ####
  35. # EC2
  36. ####
  37. output "ec2_arn" {
  38. value = concat(aws_instance.this.*.arn, [""])[0]
  39. }
  40. output "ec2_id" {
  41. value = concat(aws_instance.this.*.id, [""])[0]
  42. }
  43. output "ec2_private_ip" {
  44. value = concat(aws_instance.this.*.private_ip, [""])[0]
  45. }
  46. output "ec2_primary_network_interface_id" {
  47. value = concat(aws_instance.this.*.primary_network_interface_id, [""])[0]
  48. }
  49. output "ec2_private_dns" {
  50. value = concat(aws_instance.this.*.private_dns, [""])[0]
  51. }
  52. output "ec2_public_dns" {
  53. value = concat(aws_instance.this.*.public_dns, [""])[0]
  54. }
  55. output "ec2_public_ip" {
  56. value = concat(aws_instance.this.*.public_ip, [""])[0]
  57. }
  58. ####
  59. # KMS
  60. ####
  61. output "kms_key_id" {
  62. value = concat([var.volume_kms_key_arn], aws_kms_key.this_volume.*.arn, [""])[0]
  63. }
  64. ####
  65. # Instance Profile
  66. ####
  67. output "iam_instance_profile_id" {
  68. value = local.should_create_instance_profile ? concat(aws_iam_instance_profile.this.*.id, [""])[0] : ""
  69. }
  70. output "iam_instance_profile_arn" {
  71. value = local.should_create_instance_profile ? concat(aws_iam_instance_profile.this.*.arn, [""])[0] : ""
  72. }
  73. output "iam_instance_profile_unique_id" {
  74. value = local.should_create_instance_profile ? concat(aws_iam_instance_profile.this.*.unique_id, [""])[0] : ""
  75. }
  76. output "iam_instance_profile_iam_role_arn" {
  77. value = local.should_create_instance_profile ? concat(aws_iam_role.this_instance_profile.*.arn, [""])[0] : ""
  78. }
  79. output "iam_instance_profile_iam_role_id" {
  80. value = local.should_create_key_pair ? concat(aws_iam_role.this_instance_profile.*.id, [""])[0] : ""
  81. }
  82. output "iam_instance_profile_iam_role_unique_id" {
  83. value = local.should_create_key_pair ? concat(aws_iam_role.this_instance_profile.*.unique_id, [""])[0] : ""
  84. }
  85. ####
  86. # Key Pair
  87. ####
  88. output "key_pair_name" {
  89. value = local.should_create_key_pair ? concat(aws_key_pair.this.*.key_name, [""])[0] : ""
  90. }
  91. output "key_pair_id" {
  92. value = concat(aws_key_pair.this.*.id, [""])[0]
  93. }
  94. output "key_pair_fingerprint" {
  95. value = concat(aws_key_pair.this.*.fingerprint, [""])[0]
  96. }
  97. ####
  98. # Elastic IP
  99. ####
  100. output "eip_ids" {
  101. value = {
  102. primary = aws_eip.this_primary.*.id
  103. extra = aws_eip.this_extra.*.id
  104. }
  105. }
  106. output "eip_public_ips" {
  107. value = {
  108. primary = aws_eip.this_primary.*.public_ip
  109. extra = aws_eip.this_extra.*.public_ip
  110. }
  111. }
  112. output "eip_public_dns" {
  113. value = {
  114. primary = aws_eip.this_primary.*.public_dns
  115. extra = aws_eip.this_extra.*.public_dns
  116. }
  117. }
  118. output "eip_network_interface_ids" {
  119. value = {
  120. primary = aws_eip_association.this_primary.*.network_interface_id
  121. extra = aws_eip_association.this_extra.*.network_interface_id
  122. }
  123. }
  124. ####
  125. # EBS
  126. ####
  127. output "extra_volume_ids" {
  128. value = aws_ebs_volume.this_extra.*.id
  129. }
  130. output "extra_volume_arns" {
  131. value = aws_ebs_volume.this_extra.*.arn
  132. }
  133. ####
  134. # Network Interfaces
  135. ####
  136. output "network_interface_ids" {
  137. value = {
  138. primary = aws_network_interface.this_primary.*.id
  139. extra = aws_network_interface.this_extra.*.id
  140. }
  141. }
  142. output "network_interface_mac_addresses" {
  143. value = {
  144. primary = aws_network_interface.this_primary.*.mac_address
  145. extra = aws_network_interface.this_extra.*.mac_address
  146. }
  147. }
  148. output "network_interface_private_dns_names" {
  149. value = {
  150. primary = aws_network_interface.this_primary.*.private_dns_name
  151. extra = aws_network_interface.this_extra.*.private_dns_name
  152. }
  153. }
  154. output "network_interface_private_ips" {
  155. value = {
  156. primary = aws_network_interface.this_primary.*.private_ips
  157. extra = aws_network_interface.this_extra.*.private_ips
  158. }
  159. }
  160. output "network_interface_eips" {
  161. value = {
  162. primary = aws_eip_association.this_primary.*.allocation_id
  163. extra = aws_eip_association.this_extra.*.allocation_id
  164. }
  165. }