-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
When stopping and starting a pre-existing instance previously created with terraform, the security onion appliance does not pick up a new public IPv4 address:

Seen above both a windows and ubuntu instance pick up new IPv4 addresses as expected from the vpc.tf subnet creation:
# subnet creation
resource "aws_subnet" "default" {
vpc_id = aws_vpc.terraform.id
cidr_block = "172.16.163.0/24"
availability_zone = var.availability_zone
*map_public_ip_on_launch = true*
}
As a testing step I added associate_public_ip_address = true to so.tf but the instance still does not get a new public IPv4 address on stopping and starting the instance.
resource "aws_instance" "securityonion" {
depends_on = [ aws_internet_gateway.default ]
count = var.onions
instance_type = var.instance_type
ami = data.aws_ami.latest_so.id != "" ? data.aws_ami.latest_so.id : var.ami
tags = {
Name = "security-onion-${count.index}"
so-lab = "True"
}
subnet_id = aws_subnet.default.id
vpc_security_group_ids = [aws_security_group.securityonion.id]
key_name = aws_key_pair.auth.key_name
private_ip = "172.16.163.1${count.index}"
**associate_public_ip_address = true**
root_block_device {
delete_on_termination = true
volume_size = 250
}
}
The reason for stopping instances is cost savings in a lab environment, without having to run through so-setup each time it's required.
Steps to reproduce:
terraform apply --auto-approve- Connect to instance as usual and run through so-setup
- Stop instances via ec2 dashboard
- Start instances via ec2 dashboard
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels