Last active
November 15, 2023 18:10
-
-
Save iwahbe/d11ab2a962a69394741150e8ce0e7694 to your computer and use it in GitHub Desktop.
An equivalent HCL program to demonstrate that a replace is caused when changing `secondary_allocation_ids`.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
terraform { | |
required_providers { | |
aws = { | |
source = "hashicorp/aws" | |
version = ">= 5" | |
} | |
} | |
required_version = ">= 1.2.0" | |
} | |
# provider "google" { | |
# project = "pulumi-development" | |
# } | |
# resource "random_password" "db" { | |
# length = 10 | |
# } | |
provider "aws" { | |
# Configure the AWS Provider | |
region = "us-east-1" | |
} | |
# Default VPC | |
data "aws_vpc" "default" { | |
default = true | |
} | |
# Default VPC Subnets | |
data "aws_subnets" "default" { | |
filter { | |
name = "vpc-id" | |
values = [data.aws_vpc.default.id] | |
} | |
} | |
# Two EIPs | |
resource "aws_eip" "one" { | |
domain = "vpc" | |
} | |
resource "aws_eip" "two" { | |
domain = "vpc" | |
} | |
# NAT Gateway | |
resource "aws_nat_gateway" "ng" { | |
allocation_id = aws_eip.one.id | |
// after a first run to create the NAT Gateway, uncomment the following line to | |
// reproduce the replace: | |
// secondary_allocation_ids = [aws_eip.two.id] | |
subnet_id = tolist(data.aws_subnets.default.ids)[0] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment