diff --git a/.changelog/21465.txt b/.changelog/21465.txt new file mode 100644 index 00000000000..74a2705a30c --- /dev/null +++ b/.changelog/21465.txt @@ -0,0 +1,3 @@ +```release-note:bug-fix +resource/aws_appstream_fleet: Use `image_arn` when specified +``` \ No newline at end of file diff --git a/internal/service/appstream/fleet.go b/internal/service/appstream/fleet.go index 759797d340f..9e8798263d2 100644 --- a/internal/service/appstream/fleet.go +++ b/internal/service/appstream/fleet.go @@ -229,6 +229,10 @@ func resourceFleetCreate(ctx context.Context, d *schema.ResourceData, meta inter input.ImageName = aws.String(v.(string)) } + if v, ok := d.GetOk("image_arn"); ok { + input.ImageArn = aws.String(v.(string)) + } + if v, ok := d.GetOk("iam_role_arn"); ok { input.IamRoleArn = aws.String(v.(string)) } diff --git a/internal/service/appstream/fleet_test.go b/internal/service/appstream/fleet_test.go index 941f6dd1387..755e90adc9b 100644 --- a/internal/service/appstream/fleet_test.go +++ b/internal/service/appstream/fleet_test.go @@ -318,6 +318,9 @@ func testAccFleetCompleteConfig(name, description, fleetType, instanceType strin return acctest.ConfigCompose( acctest.ConfigAvailableAZsNoOptIn(), fmt.Sprintf(` +data "aws_region" "current" {} +data "aws_partition" "current" {} + resource "aws_vpc" "test" { cidr_block = "10.0.0.0/16" } @@ -331,7 +334,7 @@ resource "aws_subnet" "test" { resource "aws_appstream_fleet" "test" { name = %[1]q - image_name = "Amazon-AppStream2-Sample-Image-02-04-2019" + image_arn = "arn:${data.aws_partition.current.partition}:appstream:${data.aws_region.current.name}::image/Amazon-AppStream2-Sample-Image-02-04-2019" compute_capacity { desired_instances = 1