magenx / Magento-2-aws-cluster-terraform

Magento 2 AWS autoscaling cluster with Terraform and Packer or ImageBuilder. Adobe Commerce Cloud alternative. The best ecommerce infrastructure. Drive more sales online. Transparent billing. Developer-friendly. No hidden bottlenecks.
https://www.magenx.com
123 stars 41 forks source link

Imagebuilder doesn't support instance metadata on builds #30

Closed youanden closed 2 months ago

youanden commented 2 years ago

I traced this to the terraform aws provider not supporting metadata and added a ticket: https://github.com/hashicorp/terraform-provider-aws/issues/24006

But after manually updating in GUI and building images, the same thing happens. When I looked at the build server that was created, it had "Access to tags in instance metadata" disabled.

I think it's best to refactor to use parameters in imagebuilder.

To the build.yml:

parameters:
  - PARAMETERSTORE_NAME:
      type: string
      description: Project name
  - INSTANCE_NAME:
      type: string
      description: Instance name (e.g. admin/frontend)
#...
PARAMETERSTORE_NAME={{ PARAMETERSTORE_NAME }}
_INSTANCE_NAME={{ INSTANCE_NAME }}

To the imagebuilder.tf:

    parameter {
      name        = "PARAMETERSTORE_NAME"
      value       = "${local.project}-env"
    }

    parameter {
      name        = "INSTANCE_NAME"
      value       = "${each.key}"
    }
magenx commented 2 years ago

yes this was planned to update