added vpc tenancy argument

This commit is contained in:
Sneha Somwanshi 2014-12-10 16:09:14 +05:30
parent f1cb297c59
commit 89f1a38f5b
3 changed files with 38 additions and 0 deletions

View File

@ -24,6 +24,12 @@ func resourceAwsVpc() *schema.Resource {
ForceNew: true,
},
"instance_tenancy": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"enable_dns_hostnames": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
@ -52,6 +58,7 @@ func resourceAwsVpcCreate(d *schema.ResourceData, meta interface{}) error {
// Create the VPC
createOpts := &ec2.CreateVpc{
CidrBlock: d.Get("cidr_block").(string),
InstanceTenancy: d.Get("instance_tenancy").(string),
}
log.Printf("[DEBUG] VPC create config: %#v", createOpts)
vpcResp, err := ec2conn.CreateVpc(createOpts)

View File

@ -30,6 +30,26 @@ func TestAccVpc_basic(t *testing.T) {
})
}
func TestAccVpc_dedicatedTenancy(t *testing.T) {
var vpc ec2.VPC
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckVpcDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccVpcDedicatedConfig,
Check: resource.ComposeTestCheckFunc(
testAccCheckVpcExists("aws_vpc.bar", &vpc),
resource.TestCheckResourceAttr(
"aws_vpc.bar", "instance_tenancy", "dedicated"),
),
},
},
})
}
func TestAccVpc_tags(t *testing.T) {
var vpc ec2.VPC
@ -189,3 +209,11 @@ resource "aws_vpc" "foo" {
}
}
`
const testAccVpcDedicatedConfig = `
resource "aws_vpc" "bar" {
instance_tenancy = "dedicated"
cidr_block = "10.2.0.0/16"
}
`

View File

@ -25,6 +25,7 @@ Basic usage with tags:
```
resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
instance_tenancy = "dedicated"
tags {
Name = "main"
@ -37,6 +38,7 @@ resource "aws_vpc" "main" {
The following arguments are supported:
* `cidr_block` - (Required) The CIDR block for the VPC.
* `instance_tenancy` - (Optional) A tenancy option for instances launched into the VPC
* `enable_dns_support` - (Optional) A boolean flag to enable/disable DNS support in the VPC. Defaults true.
* `enable_dns_hostnames` - (Optional) A boolean flag to enable/disable DNS hostnames in the VPC. Defaults false.
* `tags` - (Optional) A mapping of tags to assign to the resource.
@ -47,6 +49,7 @@ The following attributes are exported:
* `id` - The ID of the VPC
* `cidr_block` - The CIDR block of the VPC
* `instance_tenancy` - Tenancy of instances spin up within VPC.
* `enable_dns_support` - Whether or not the VPC has DNS support
* `enable_dns_hostnames` - Whether or not the VPC has DNS hostname support
* `main_route_table_id` - The ID of the main route table associated with