hashicorp / aws-service-catalog-engine-for-tfc

Use to provision HashiCorp Terraform Cloud products in AWS Service Catalog
https://docs.aws.amazon.com/servicecatalog/latest/adminguide/getstarted-terraform-engine-cloud.html
Mozilla Public License 2.0
21 stars 15 forks source link

Path of the token rotation lambda needs update #23

Closed yukikgiants closed 7 months ago

yukikgiants commented 7 months ago

The path of the source_file in the data block for token rotation lambda is not using ${path.module}, which is inconsistent with other archive_file data blocks.

Data block for token rotation lambda https://github.com/hashicorp/aws-service-catalog-engine-for-tfc/blob/9dd1ac25535ec013106f876d9002c5e7af2d21dc/engine/token_rotation.tf#L105-L109

Data block for provision handler lambda https://github.com/hashicorp/aws-service-catalog-engine-for-tfc/blob/9dd1ac25535ec013106f876d9002c5e7af2d21dc/engine/handler_lambdas.tf#L4-L8

Because of this, you get an error when trying to use engine directory as a module.

Example code snippet calling module

# sourcing only the engine
module "terraform_cloud_reference_engine" {
  source = "git::https://github.com/hashicorp/aws-service-catalog-engine-for-tfc.git//engine?ref=v1.0.0"

  (variables omitted)
}

Error produced from terraform plan

│ Error: Archive creation error
│
│ with module.terraform_cloud_reference_engine.data.archive_file.rotate_token_handler,
│ on .terraform/modules/terraform_cloud_reference_engine/engine/[token_rotation.tf](http://token_rotation.tf/) line 105, in data "archive_file" "rotate_token_handler":
│ 105: data "archive_file" "rotate_token_handler" {
│
│ error creating archive: error archiving file: could not archive missing
│ file: engine/lambda-functions/token-rotation/main