Merge pull request #546 from tmtk75/dev/enable-associate-public-ip

support associate_public_ip_address for aws_launch_configuration
This commit is contained in:
Seth Vargo 2014-11-24 09:58:26 -05:00
commit eb729d17c7
2 changed files with 10 additions and 0 deletions

View File

@ -75,6 +75,12 @@ func resourceAwsLaunchConfiguration() *schema.Resource {
return hashcode.String(v.(string)) return hashcode.String(v.(string))
}, },
}, },
"associate_public_ip_address": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
Default: false,
},
}, },
} }
} }
@ -90,6 +96,7 @@ func resourceAwsLaunchConfigurationCreate(d *schema.ResourceData, meta interface
createLaunchConfigurationOpts.InstanceType = d.Get("instance_type").(string) createLaunchConfigurationOpts.InstanceType = d.Get("instance_type").(string)
createLaunchConfigurationOpts.KeyName = d.Get("key_name").(string) createLaunchConfigurationOpts.KeyName = d.Get("key_name").(string)
createLaunchConfigurationOpts.UserData = d.Get("user_data").(string) createLaunchConfigurationOpts.UserData = d.Get("user_data").(string)
createLaunchConfigurationOpts.AssociatePublicIpAddress = d.Get("associate_public_ip_address").(bool)
if v, ok := d.GetOk("security_groups"); ok { if v, ok := d.GetOk("security_groups"); ok {
createLaunchConfigurationOpts.SecurityGroups = expandStringList( createLaunchConfigurationOpts.SecurityGroups = expandStringList(

View File

@ -28,6 +28,8 @@ func TestAccAWSLaunchConfiguration(t *testing.T) {
"aws_launch_configuration.bar", "name", "foobar-terraform-test"), "aws_launch_configuration.bar", "name", "foobar-terraform-test"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"aws_launch_configuration.bar", "instance_type", "t1.micro"), "aws_launch_configuration.bar", "instance_type", "t1.micro"),
resource.TestCheckResourceAttr(
"aws_launch_configuration.bar", "associate_public_ip_address", "true"),
), ),
}, },
}, },
@ -124,5 +126,6 @@ resource "aws_launch_configuration" "bar" {
image_id = "ami-21f78e11" image_id = "ami-21f78e11"
instance_type = "t1.micro" instance_type = "t1.micro"
user_data = "foobar-user-data" user_data = "foobar-user-data"
associate_public_ip_address = true
} }
` `