diff --git a/hooks/terraform_wrapper_module_for_each.sh b/hooks/terraform_wrapper_module_for_each.sh index 24a3a465b..9d47cf599 100755 --- a/hooks/terraform_wrapper_module_for_each.sh +++ b/hooks/terraform_wrapper_module_for_each.sh @@ -394,9 +394,14 @@ EOF echo "$CONTENT_VARIABLES_TF" > "${output_dir}/variables.tf" - # If the root module has a versions.tf, use that; otherwise, create it + # If the root module has a versions.tf, use that; otherwise, create it. if [[ -f "${full_module_dir}/versions.tf" ]]; then cp "${full_module_dir}/versions.tf" "${output_dir}/versions.tf" + # Don't propagate redundant `provider_meta` attributes + # AWS-provider specific + hcledit attribute rm "terraform.provider_meta.${module_repo_provider}.user_agent" -f "${output_dir}/versions.tf" -u + # GCP-provider specific + hcledit attribute rm "terraform.provider_meta.${module_repo_provider}.module_name" -f "${output_dir}/versions.tf" -u else echo "$CONTENT_VERSIONS_TF" > "${output_dir}/versions.tf" fi