provider/aws: Remove unsafe ptr dereferencing from ami data source (#8513)
This commit is contained in:
parent
2e70fe0c6c
commit
ed39b8634f
|
@ -303,39 +303,39 @@ func mostRecentAmi(images []*ec2.Image) *ec2.Image {
|
||||||
func amiDescriptionAttributes(d *schema.ResourceData, image *ec2.Image) error {
|
func amiDescriptionAttributes(d *schema.ResourceData, image *ec2.Image) error {
|
||||||
// Simple attributes first
|
// Simple attributes first
|
||||||
d.SetId(*image.ImageId)
|
d.SetId(*image.ImageId)
|
||||||
d.Set("architecture", *image.Architecture)
|
d.Set("architecture", image.Architecture)
|
||||||
d.Set("creation_date", *image.CreationDate)
|
d.Set("creation_date", image.CreationDate)
|
||||||
if image.Description != nil {
|
if image.Description != nil {
|
||||||
d.Set("description", *image.Description)
|
d.Set("description", image.Description)
|
||||||
}
|
}
|
||||||
d.Set("hypervisor", *image.Hypervisor)
|
d.Set("hypervisor", image.Hypervisor)
|
||||||
d.Set("image_id", *image.ImageId)
|
d.Set("image_id", image.ImageId)
|
||||||
d.Set("image_location", *image.ImageLocation)
|
d.Set("image_location", image.ImageLocation)
|
||||||
if image.ImageOwnerAlias != nil {
|
if image.ImageOwnerAlias != nil {
|
||||||
d.Set("image_owner_alias", *image.ImageOwnerAlias)
|
d.Set("image_owner_alias", image.ImageOwnerAlias)
|
||||||
}
|
}
|
||||||
d.Set("image_type", *image.ImageType)
|
d.Set("image_type", image.ImageType)
|
||||||
if image.KernelId != nil {
|
if image.KernelId != nil {
|
||||||
d.Set("kernel_id", *image.KernelId)
|
d.Set("kernel_id", image.KernelId)
|
||||||
}
|
}
|
||||||
d.Set("name", *image.Name)
|
d.Set("name", image.Name)
|
||||||
d.Set("owner_id", *image.OwnerId)
|
d.Set("owner_id", image.OwnerId)
|
||||||
if image.Platform != nil {
|
if image.Platform != nil {
|
||||||
d.Set("platform", *image.Platform)
|
d.Set("platform", image.Platform)
|
||||||
}
|
}
|
||||||
d.Set("public", *image.Public)
|
d.Set("public", image.Public)
|
||||||
if image.RamdiskId != nil {
|
if image.RamdiskId != nil {
|
||||||
d.Set("ramdisk_id", *image.RamdiskId)
|
d.Set("ramdisk_id", image.RamdiskId)
|
||||||
}
|
}
|
||||||
if image.RootDeviceName != nil {
|
if image.RootDeviceName != nil {
|
||||||
d.Set("root_device_name", *image.RootDeviceName)
|
d.Set("root_device_name", image.RootDeviceName)
|
||||||
}
|
}
|
||||||
d.Set("root_device_type", *image.RootDeviceType)
|
d.Set("root_device_type", image.RootDeviceType)
|
||||||
if image.SriovNetSupport != nil {
|
if image.SriovNetSupport != nil {
|
||||||
d.Set("sriov_net_support", *image.SriovNetSupport)
|
d.Set("sriov_net_support", image.SriovNetSupport)
|
||||||
}
|
}
|
||||||
d.Set("state", *image.State)
|
d.Set("state", image.State)
|
||||||
d.Set("virtualization_type", *image.VirtualizationType)
|
d.Set("virtualization_type", image.VirtualizationType)
|
||||||
// Complex types get their own functions
|
// Complex types get their own functions
|
||||||
if err := d.Set("block_device_mappings", amiBlockDeviceMappings(image.BlockDeviceMappings)); err != nil {
|
if err := d.Set("block_device_mappings", amiBlockDeviceMappings(image.BlockDeviceMappings)); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue