Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ena_support #5395

Merged
merged 1 commit into from
Aug 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions aws/resource_aws_ami.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func resourceAwsAmiCreate(d *schema.ResourceData, meta interface{}) error {
RootDeviceName: aws.String(d.Get("root_device_name").(string)),
SriovNetSupport: aws.String(d.Get("sriov_net_support").(string)),
VirtualizationType: aws.String(d.Get("virtualization_type").(string)),
EnaSupport: aws.Bool(d.Get("ena_support").(bool)),
}

if kernelId := d.Get("kernel_id").(string); kernelId != "" {
Expand Down Expand Up @@ -196,6 +197,7 @@ func resourceAwsAmiRead(d *schema.ResourceData, meta interface{}) error {
d.Set("root_snapshot_id", amiRootSnapshotId(image))
d.Set("sriov_net_support", image.SriovNetSupport)
d.Set("virtualization_type", image.VirtualizationType)
d.Set("ena_support", image.EnaSupport)

var ebsBlockDevs []map[string]interface{}
var ephemeralBlockDevs []map[string]interface{}
Expand Down Expand Up @@ -569,5 +571,10 @@ func resourceAwsAmiCommonSchema(computed bool) map[string]*schema.Schema {
Computed: true,
ForceNew: true,
},
"ena_support": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI this new argument needs to be documented in website/docs/r/ami.html.markdown as well.

Type: schema.TypeBool,
Optional: true,
ForceNew: true,
},
}
}
3 changes: 3 additions & 0 deletions aws/resource_aws_ami_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ func TestAccAWSAMI_basic(t *testing.T) {
"aws_ami.foo", "name", fmt.Sprintf("tf-testing-%d", rInt)),
resource.TestMatchResourceAttr(
"aws_ami.foo", "root_snapshot_id", regexp.MustCompile("^snap-")),
resource.TestCheckResourceAttr(
"aws_ami.foo", "ena_support", "true"),
),
},
},
Expand Down Expand Up @@ -231,6 +233,7 @@ resource "aws_ami" "foo" {
device_name = "/dev/sda1"
snapshot_id = "${aws_ebs_snapshot.foo.id}"
}
ena_support = true
}
`, rInt)
}
Expand Down