Add optional param iam_instance_profile to resource_aws_launch_configuration to support role based AC

This commit is contained in:
Xu Wang 2014-10-06 20:46:25 -07:00
parent 28cd738edc
commit df37e82f5b
1 changed files with 14 additions and 7 deletions

View File

@ -25,6 +25,10 @@ func resource_aws_launch_configuration_create(
var err error var err error
createLaunchConfigurationOpts := autoscaling.CreateLaunchConfiguration{} createLaunchConfigurationOpts := autoscaling.CreateLaunchConfiguration{}
if rs.Attributes["iam_instance_profile"] != "" {
createLaunchConfigurationOpts.IamInstanceProfile = rs.Attributes["iam_instance_profile"]
}
if rs.Attributes["image_id"] != "" { if rs.Attributes["image_id"] != "" {
createLaunchConfigurationOpts.ImageId = rs.Attributes["image_id"] createLaunchConfigurationOpts.ImageId = rs.Attributes["image_id"]
} }
@ -124,6 +128,7 @@ func resource_aws_launch_configuration_diff(
b := &diff.ResourceBuilder{ b := &diff.ResourceBuilder{
Attrs: map[string]diff.AttrType{ Attrs: map[string]diff.AttrType{
"iam_instance_profile": diff.AttrTypeCreate,
"image_id": diff.AttrTypeCreate, "image_id": diff.AttrTypeCreate,
"instance_id": diff.AttrTypeCreate, "instance_id": diff.AttrTypeCreate,
"instance_type": diff.AttrTypeCreate, "instance_type": diff.AttrTypeCreate,
@ -145,6 +150,7 @@ func resource_aws_launch_configuration_update_state(
s *terraform.InstanceState, s *terraform.InstanceState,
lc *autoscaling.LaunchConfiguration) (*terraform.InstanceState, error) { lc *autoscaling.LaunchConfiguration) (*terraform.InstanceState, error) {
s.Attributes["iam_instance_profile"] = lc.IamInstanceProfile
s.Attributes["image_id"] = lc.ImageId s.Attributes["image_id"] = lc.ImageId
s.Attributes["instance_type"] = lc.InstanceType s.Attributes["instance_type"] = lc.InstanceType
s.Attributes["key_name"] = lc.KeyName s.Attributes["key_name"] = lc.KeyName
@ -199,6 +205,7 @@ func resource_aws_launch_configuration_validation() *config.Validator {
"instance_type", "instance_type",
}, },
Optional: []string{ Optional: []string{
"iam_instance_profile",
"key_name", "key_name",
"security_groups.*", "security_groups.*",
"user_data", "user_data",