-
-
Save spinx/047afb19996b91795dd5 to your computer and use it in GitHub Desktop.
Terraform AWS EC2 classic launch in VPC
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
# Define VPC id and VPC subnets | |
variable "vpc_id" { | |
default = "vpc-6d408308" | |
} | |
variable "vpc_subnets" { | |
default = "subnet-fdda6a98,subnet-17914860,subnet-71708228" | |
} | |
# Use VPC id for SG | |
resource "aws_security_group" "consul" { | |
vpc_id = "${var.vpc_id}" | |
} | |
# Use subnet ids | |
resource "aws_instance" "consul_server" { | |
subnet_id = "${ element(split(",", var.vpc_subnets), count.index) }" # you don't need availability_zone if you have one subnet per AZ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment