Last active
November 25, 2015 02:35
-
-
Save conorgil/76f8959d674270228f0c to your computer and use it in GitHub Desktop.
VPC with mixed instance tenancy
This file contains hidden or 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
provider "aws" { | |
region = "us-east-1" | |
} | |
resource "aws_vpc" "main" { | |
cidr_block = "10.1.0.0/16" | |
instance_tenancy = "default" | |
tags { | |
Name = "test_please_delete_me" | |
environment_name = "test" | |
} | |
} | |
resource "aws_subnet" "public" { | |
vpc_id = "${aws_vpc.main.id}" | |
cidr_block = "10.1.1.0/20" | |
availability_zone = "us-east-1a" | |
map_public_ip_on_launch = true | |
tags { | |
Name = "test_please_delete_me" | |
environment_name = "test" | |
} | |
} | |
resource "aws_instance" "nat" { | |
# Ubuntu 14.04 ami | |
ami = "ami-d05e75b8" | |
instance_type = "m3.medium" | |
subnet_id = "${aws_subnet.public.id}" | |
tenancy = "default" | |
tags { | |
Name = "test_nat_please_delete_me" | |
environment_name = "test" | |
} | |
} | |
resource "aws_instance" "test" { | |
# Ubuntu 14.04 ami | |
ami = "ami-d05e75b8" | |
instance_type = "m3.medium" | |
subnet_id = "${aws_subnet.public.id}" | |
tenancy = "dedicated" | |
tags { | |
Name = "test_instance_please_delete_me" | |
environment_name = "test" | |
} | |
} |
This file contains hidden or 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
aws_vpc.main: Creating... | |
cidr_block: "" => "10.1.0.0/16" | |
default_network_acl_id: "" => "<computed>" | |
default_security_group_id: "" => "<computed>" | |
dhcp_options_id: "" => "<computed>" | |
enable_dns_hostnames: "" => "<computed>" | |
enable_dns_support: "" => "<computed>" | |
instance_tenancy: "" => "default" | |
main_route_table_id: "" => "<computed>" | |
tags.#: "" => "2" | |
tags.Name: "" => "test_please_delete_me" | |
tags.environment_name: "" => "test" | |
aws_vpc.main: Creation complete | |
aws_subnet.public: Creating... | |
availability_zone: "" => "us-east-1a" | |
cidr_block: "" => "10.1.1.0/20" | |
map_public_ip_on_launch: "" => "1" | |
tags.#: "" => "2" | |
tags.Name: "" => "test_please_delete_me" | |
tags.environment_name: "" => "test" | |
vpc_id: "" => "vpc-93a827f7" | |
aws_subnet.public: Creation complete | |
aws_instance.nat: Creating... | |
ami: "" => "ami-d05e75b8" | |
availability_zone: "" => "<computed>" | |
ebs_block_device.#: "" => "<computed>" | |
ephemeral_block_device.#: "" => "<computed>" | |
instance_type: "" => "m3.medium" | |
key_name: "" => "<computed>" | |
placement_group: "" => "<computed>" | |
private_dns: "" => "<computed>" | |
private_ip: "" => "<computed>" | |
public_dns: "" => "<computed>" | |
public_ip: "" => "<computed>" | |
root_block_device.#: "" => "<computed>" | |
security_groups.#: "" => "<computed>" | |
source_dest_check: "" => "1" | |
subnet_id: "" => "subnet-cc6993ba" | |
tags.#: "" => "2" | |
tags.Name: "" => "test_nat_please_delete_me" | |
tags.environment_name: "" => "test" | |
tenancy: "" => "default" | |
vpc_security_group_ids.#: "" => "<computed>" | |
aws_instance.test: Creating... | |
ami: "" => "ami-d05e75b8" | |
availability_zone: "" => "<computed>" | |
ebs_block_device.#: "" => "<computed>" | |
ephemeral_block_device.#: "" => "<computed>" | |
instance_type: "" => "m3.medium" | |
key_name: "" => "<computed>" | |
placement_group: "" => "<computed>" | |
private_dns: "" => "<computed>" | |
private_ip: "" => "<computed>" | |
public_dns: "" => "<computed>" | |
public_ip: "" => "<computed>" | |
root_block_device.#: "" => "<computed>" | |
security_groups.#: "" => "<computed>" | |
source_dest_check: "" => "1" | |
subnet_id: "" => "subnet-cc6993ba" | |
tags.#: "" => "2" | |
tags.Name: "" => "test_instance_please_delete_me" | |
tags.environment_name: "" => "test" | |
tenancy: "" => "dedicated" | |
vpc_security_group_ids.#: "" => "<computed>" | |
aws_instance.test: Creation complete | |
aws_instance.nat: Creation complete | |
Apply complete! Resources: 4 added, 0 changed, 0 destroyed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that the VPC has
instance_tenancy
set todefault
and the firstaws_instance
resource hastenancy
set todefault
while the secondaws_instance
resource hastenancy
set todedicated
.