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
|
terraform {
required_version = ">= 1.15.0, < 2.0.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 6.0, < 7.0"
}
}
}
provider "aws" {
region = "ap-south-1"
}
module "ec2_node" {
source = "../../modules/ec2-node"
name_prefix = "iptest"
instances = {
node-a = {
name_suffix = "node-a"
ami_id = "ami-057be83ec79c51287"
instance_type = "t3.micro"
subnet_id = "subnet-0a1ab504311dae1c3"
security_group_ids = ["sg-0a1f705f08895b7f9"]
associate_public_ip = false
primary_private_ip = "172.31.32.10"
secondary_private_ips = ["172.31.32.11"]
root_volume = {
size = 8
}
}
}
tags = {
purpose = "secondary-ip-live-attach-test"
}
}
output "instance_ids" {
description = "Instance IDs keyed by instance key."
value = module.ec2_node.instance_ids
}
output "instance_arns" {
description = "Instance ARNs keyed by instance key."
value = module.ec2_node.instance_arns
}
output "primary_private_ips" {
description = "Primary private IP addresses keyed by instance key."
value = module.ec2_node.primary_private_ips
}
output "secondary_private_ips" {
description = "Secondary private IP addresses keyed by instance key."
value = module.ec2_node.secondary_private_ips
}
output "public_ips" {
description = "Public IP addresses keyed by instance key. Null if not assigned."
value = module.ec2_node.public_ips
}
output "private_dns" {
description = "Private DNS names keyed by instance key."
value = module.ec2_node.private_dns
}
output "network_interface_ids" {
description = "Primary network interface IDs keyed by instance key."
value = module.ec2_node.network_interface_ids
}
output "ami_ids" {
description = "AMI ID in use keyed by instance key."
value = module.ec2_node.ami_ids
}
output "key_pair_ids" {
description = "Key pair IDs keyed by key pair key."
value = module.ec2_node.key_pair_ids
}
output "data_volume_ids" {
description = "EBS data volume IDs keyed by data volume key."
value = module.ec2_node.data_volume_ids
}
output "data_volume_attachments" {
description = "Attached data volume IDs keyed by data volume key."
value = module.ec2_node.data_volume_attachments
}
|