Cloud
Infrastructure as Code: From the Iron Age to the Cloud Age
/etc/hosts
files on every server in your non-production estate, making it impossible to ssh into any of them鈥娾斺妎r to run the tool again to fix the error? I have.
# STAGING ENVIRONMENT
resource 鈥渁ws_vpc鈥 鈥渟taging_vpc鈥 {
听听cidr_block = 鈥10.0.0.0/16鈥
}
resource 鈥渁ws_subnet鈥 鈥渟taging_subnet鈥 {
听听vpc_id = 鈥${aws_vpc.staging_vpc.id}鈥
听听cidr_block = 鈥10.0.1.0/24鈥
}
resource 鈥渁ws_security_group鈥 鈥渟taging_access鈥 {
听听name = 鈥渟taging_access鈥
听听vpc_id = 鈥${aws_vpc.staging_vpc.id}鈥
}
resource 鈥渁ws_instance鈥 鈥渟taging_server鈥 {
听听instance_type = 鈥渢2.micro鈥
听听ami = 鈥渁mi-ac772edf鈥
听听vpc_security_group_ids = [鈥${aws_security_group.staging_access.id}鈥漖
听听subnet_id = 鈥${aws_subnet.staging_subnet.id}鈥
}
# PRODUCTION ENVIRONMENT
resource 鈥渁ws_vpc鈥 鈥減roduction_vpc鈥 {
听听cidr_block = 鈥10.0.0.0/16鈥
}
resource 鈥渁ws_subnet鈥 鈥減roduction_subnet鈥 {
听听vpc_id = 鈥${aws_vpc.production_vpc.id}鈥
听听cidr_block = 鈥10.0.1.0/24鈥
}
resource 鈥渁ws_security_group鈥 鈥減roduction_access鈥 {
听听name = 鈥減roduction_access鈥
听听vpc_id = 鈥${aws_vpc.production_vpc.id}鈥
}
resource 鈥渁ws_instance鈥 鈥減roduction_server鈥 {
听听instance_type = 鈥渢2.micro鈥
听听ami = 鈥渁mi-ac772edf鈥
听听vpc_security_group_ids = [鈥${aws_security_group.production_access.id}鈥漖
听听subnet_id = 鈥${aws_subnet.production_subnet.id}鈥
}
./our-project/staging/main.tf
./our-project/production/main.tf
aws s3 sync ./our-project/ s3://our-project-repository/1.0.123/
aws s3 sync 鈥 delete
听听s3://our-project-repository/1.0.123/
听听s3://our-project-repository/staging/
Disclaimer: The statements and opinions expressed in this article are those of the author(s) and do not necessarily reflect the positions of 魅影直播.