Created
August 19, 2019 11:04
-
-
Save afcastano/6cf5936236efa48b4e0a7686b53f048c to your computer and use it in GitHub Desktop.
AWS Public Instances
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
#### EC2 INSTANCES ################# | |
# bastion ############################ | |
resource "aws_instance" "bastion" { | |
ami = "${data.aws_ami.ubuntu.id}" | |
vpc_security_group_ids = [ | |
"${aws_security_group.bastion.id}" | |
] | |
instance_type = "${var.aws_instance_type}" | |
subnet_id = "${aws_subnet.pub_subnet_1.id}" | |
key_name = "${aws_key_pair.demo_keys.key_name}" | |
tags { | |
Name = "WordPress Bastion" | |
SELECTOR = "bastion" | |
} | |
} | |
resource "aws_eip" "bastion_eip" { | |
depends_on = ["aws_internet_gateway.app_igw", "aws_vpc_dhcp_options_association.dns_resolver"] | |
} | |
resource "aws_eip_association" "bastion_eip_assoc" { | |
instance_id = "${aws_instance.bastion.id}" | |
allocation_id = "${aws_eip.bastion_eip.id}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment