AFT Version:
- AFT upgrade:
1.20.0 → 1.21.1
Terraform Version & Provider Versions
terraform version
terraform providers
aws = {
source = "hashicorp/aws"
version = "~> 6.0"
}
Bug Description
Upgrading AFT from 1.20.0 to 1.21.1 fails during terraform apply because generated Lambda ZIP files are missing:
Error: reading ZIP file
(.terraform/modules/aft/src/aft_lambda/aft_account_request_framework.zip):
no such file or directory
The same error occurs for:
aft_account_request_framework.zip
aft_customizations.zip
aft_feature_options.zip
AFT 1.20.0 changed these packages from data.archive_file to resource archive_file to support multi-stage pipelines (#555).
However, existing archive resources are refreshed (and their ZIPs generated) during the plan job. Changes inside source_dir
do not cause an archive resource replacement.
The saved plan updates the affected Lambda functions, but contains no apply-time action that recreates the ZIPs.
When the plan is applied in a clean job, the AWS provider cannot read the missing files.
The three missing archives correspond exactly to the Lambda source directories changed between AFT 1.20.0 and 1.21.1.
To Reproduce
- Deploy AFT
1.20.0.
- Run
terraform plan -out=tfplan in job A.
- Pass only the saved plan to a clean job B.
- Upgrade the module reference to
1.21.1.
- Run
terraform apply tfplan in job B.
- Observe the missing ZIP errors.
Expected behavior
AFT should recreate changed Lambda archives during apply without requiring consumers to persist internal files from .terraform/modules.
Workaround
Persist .terraform/modules/aft/src/aft_lambda/*.zip between plan and apply, or run both stages in the same filesystem.
Suggested fix
Make an AFT version or source-content digest participate in an archive_file argument that forces replacement when
Lambda source contents change. This would ensure the archive is generated during the apply stage.
Related: #555
AFT Version:
1.20.0→1.21.1Terraform Version & Provider Versions
terraform versionterraform providersBug Description
Upgrading AFT from 1.20.0 to 1.21.1 fails during terraform apply because generated Lambda ZIP files are missing:
The same error occurs for:
aft_account_request_framework.zipaft_customizations.zipaft_feature_options.zipAFT 1.20.0 changed these packages from data.archive_file to resource archive_file to support multi-stage pipelines (#555).
However, existing archive resources are refreshed (and their ZIPs generated) during the plan job. Changes inside source_dir
do not cause an archive resource replacement.
The saved plan updates the affected Lambda functions, but contains no apply-time action that recreates the ZIPs.
When the plan is applied in a clean job, the AWS provider cannot read the missing files.
The three missing archives correspond exactly to the Lambda source directories changed between AFT 1.20.0 and 1.21.1.
To Reproduce
1.20.0.terraform plan -out=tfplanin job A.1.21.1.terraform apply tfplanin job B.Expected behavior
AFT should recreate changed Lambda archives during apply without requiring consumers to persist internal files from
.terraform/modules.Workaround
Persist
.terraform/modules/aft/src/aft_lambda/*.zipbetween plan and apply, or run both stages in the same filesystem.Suggested fix
Make an AFT version or source-content digest participate in an
archive_fileargument that forces replacement whenLambda source contents change. This would ensure the archive is generated during the apply stage.
Related: #555