providers/aws/aws_instance: key_name

This commit is contained in:
Mitchell Hashimoto 2014-07-14 17:52:29 -07:00
parent 735c909264
commit 72b7e2c11a

View File

@ -28,6 +28,7 @@ func resource_aws_instance_create(
runOpts := &ec2.RunInstances{ runOpts := &ec2.RunInstances{
ImageId: rs.Attributes["ami"], ImageId: rs.Attributes["ami"],
InstanceType: rs.Attributes["instance_type"], InstanceType: rs.Attributes["instance_type"],
KeyName: rs.Attributes["key_name"],
SubnetId: rs.Attributes["subnet_id"], SubnetId: rs.Attributes["subnet_id"],
} }
log.Printf("[DEBUG] Run configuration: %#v", runOpts) log.Printf("[DEBUG] Run configuration: %#v", runOpts)
@ -149,6 +150,7 @@ func resource_aws_instance_diff(
"ami": diff.AttrTypeCreate, "ami": diff.AttrTypeCreate,
"availability_zone": diff.AttrTypeCreate, "availability_zone": diff.AttrTypeCreate,
"instance_type": diff.AttrTypeCreate, "instance_type": diff.AttrTypeCreate,
"key_name": diff.AttrTypeCreate,
"subnet_id": diff.AttrTypeCreate, "subnet_id": diff.AttrTypeCreate,
"source_dest_check": diff.AttrTypeUpdate, "source_dest_check": diff.AttrTypeUpdate,
}, },
@ -202,6 +204,7 @@ func resource_aws_instance_update_state(
s *terraform.ResourceState, s *terraform.ResourceState,
instance *ec2.Instance) (*terraform.ResourceState, error) { instance *ec2.Instance) (*terraform.ResourceState, error) {
s.Attributes["availability_zone"] = instance.AvailZone s.Attributes["availability_zone"] = instance.AvailZone
s.Attributes["key_name"] = instance.KeyName
s.Attributes["public_dns"] = instance.DNSName s.Attributes["public_dns"] = instance.DNSName
s.Attributes["public_ip"] = instance.PublicIpAddress s.Attributes["public_ip"] = instance.PublicIpAddress
s.Attributes["private_dns"] = instance.PrivateDNSName s.Attributes["private_dns"] = instance.PrivateDNSName