aws-ia / terraform-aws-control_tower_account_factory

AWS Control Tower Account Factory
Apache License 2.0
644 stars 446 forks source link

Error: reading ZIP file while deploying AFT #475

Open lironsi opened 4 months ago

lironsi commented 4 months ago

Hello, I'm trying to deploy AFT in my organization and get the following error -

 │ Error: reading ZIP file (.terraform/modules/aft/modules/aft-archives/../../src/aft_lambda/aft_builder.zip): open .terraform/modules/aft/modules/aft-archives/../../src/aft_lambda/aft_builder.zip: no such file or directory
│ 
│   with module.aft.module.aft_lambda_layer.aws_lambda_function.codebuild_trigger,
│   on .terraform/modules/aft/modules/aft-lambda-layer/lambda.tf line 6, in resource "aws_lambda_function" "codebuild_trigger":
│    6: resource "aws_lambda_function" "codebuild_trigger" {

the module source I set is "github.com/aws-ia/terraform-aws-control_tower_account_factory"

Please advise, this is a real blocker.. Thanks Liron

cyrildmoses commented 3 months ago

Hi @lironsi,

I encountered the same error while deploying AFT through CodePipeline. Have you found a solution for this issue?

Thanks!

robinbihun commented 1 month ago

Hey all, the zips are created in the terraform plan stage so if you are running plan and apply in separate ci/cd stages and running terraform apply {plan-file} then you also need to be sure to pass the zips from the plan artifacts to the apply stage.

For example, if you are using gitlab pipelines something like the following should work for you:

  artifacts:
    paths:
      - "${CI_PROJECT_DIR}/.terraform/modules/aft/src/aft_lambda/*.zip"
    expire_in: 1 day