hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.61k stars 9k forks source link

Cannot use shared image for AppStream 2.0 ImageBuilder #25875

Open PatriQ1414 opened 1 year ago

PatriQ1414 commented 1 year ago

Error when trying to create AppStream 2.0 ImageBuilder using an Appstream image shared from another AWS account

TF code

resource "aws_appstream_image_builder" "appstream" {
  name                           = "Imagebuilder-v1"
  description                    = "Imagebuilder-19072022"
  display_name                   = "Imagebuilder-v1"
  enable_default_internet_access = false
  image_name                     = "ALL_V1.38_08072022"
  instance_type                  = "stream.standard.medium"

  vpc_config {
    subnet_ids         = [aws_subnet.private[0].id]
    security_group_ids = [aws_security_group.test.id]
  }

  access_endpoint {
    endpoint_type = "STREAMING"
    vpce_id       = aws_vpc.main.id
  }

  tags = merge(
    {
      Name = format("%s-%s-%s-%s-%s", local.name, var.product, local.environment, var.appstream, var.imagebuilder_suffix),

    },
    local.tags
  )
}

Error

Error: error creating Appstream ImageBuilder (Imagebuilder-v1): ResourceNotFoundException: The image ALL_V1.38_08072022 for account XXXXXXXXXXX does not exist.

Affected Resource(s)

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

resource "aws_appstream_image_builder" "appstream" {
  name                           = "Imagebuilder-v1"
  description                    = "Imagebuilder-19072022"
  display_name                   = "Imagebuilder-v1"
  enable_default_internet_access = false
  image_name                     = "ALL_V1.38_08072022"
  instance_type                  = "stream.standard.medium"

  vpc_config {
    subnet_ids         = [aws_subnet.private[0].id]
    security_group_ids = [aws_security_group.test.id]
  }

  access_endpoint {
    endpoint_type = "STREAMING"
    vpce_id       = aws_vpc.main.id
  }

  tags = merge(
    {
      Name = format("%s-%s-%s-%s-%s", local.name, var.product, local.environment, var.appstream, var.imagebuilder_suffix),

    },
    local.tags
  )
}

Debug Output

Error: error creating Appstream ImageBuilder (Imagebuilder-v1): ResourceNotFoundException: The image ALL_V1.38_08072022 for account XXXXXXXXXXX does not exist.

Panic Output

Expected Behavior

Actual Behavior

Error: error creating Appstream ImageBuilder (Imagebuilder-v1): ResourceNotFoundException: The image ALL_V1.38_08072022 for account XXXXXXXXXXX does not exist.

Steps to Reproduce

  1. terraform apply

Important Factoids

References

justinretzolk commented 1 year ago

Hey @PatriQ1414 👋 Thank you for taking the time to raise this! The error that you're receiving here is coming directly from AWS; the image_name argument is passed directly to the CreateImageBuilder function, so it seems based on that error that the image is not being found on the AWS side. Is it possible that an image by that name is not present in the account?

PatriQ1414 commented 1 year ago

Hey @PatriQ1414 👋 Thank you for taking the time to raise this! The error that you're receiving here is coming directly from AWS; the image_name argument is passed directly to the CreateImageBuilder function, so it seems based on that error that the image is not being found on the AWS side. Is it possible that an image by that name is not present in the account?

Hi @justinretzolk thanks for helping me look into this. I just want to confirm that the image was shared from a different AWS account, and is "Available" under the image registry of the external account. The correct image name as listed in the image registry was used in the "image_name" argument.

liamraeAL commented 1 year ago

I'm running into this same issue when trying to create a fleet with an image shared from another account via Terraform. However, it works via the console (where the shared image is visible). Yet to confirm if it works via CLI.

nngabriel commented 9 months ago

Hi, I'm seeing this issue was reported more than one year ago, and it's still happening. I can confirm that the "shared image" is present and also works from the AWS Console. But when trying to create an Appstream ImageBuilder using the shared image, it reports with ResourceNotFoundException. Thanks for taking care of this :)