Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate local definition or Duplicate variable #57

Open
esacteksab opened this issue Feb 4, 2025 · 0 comments
Open

Duplicate local definition or Duplicate variable #57

esacteksab opened this issue Feb 4, 2025 · 0 comments

Comments

@esacteksab
Copy link

🐛 Summary

Running packer_validate always returns failed. Passing --verbose to pre-commit doesn't show anything further.

Running Packer v1.11.2
Running pre-commit 4.0.1
Running 0.3.0 of pre-commit-packer
Running on x86 MacOS (latest release)

There are 10 Packer files in the root of the directory.

To reproduce

Steps to reproduce the behavior:

Can run PACKER_LOG=1 pre-commit run --all-files and I get an output like this

Local variable "timestamp" is defined twice in your templates. Other definition
found at "aws-amz-linux-2023.pkr.hcl:24,15-56"

Error: Duplicate local definition

  on host1.pkr.hcl line 25, in locals:
  25:   timestamp = regex_replace(timestamp(), "[- TZ:]", "")

Local variable "timestamp" is defined twice in your templates. Other definition
found at "aws-amz-linux-2023.pkr.hcl:24,15-56"

Error: Duplicate local definition

  on host3.pkr.hcl line 24, in locals:
  24:   timestamp = regex_replace(timestamp(), "[- TZ:]", "")

Local variable "timestamp" is defined twice in your templates. Other definition
found at "aws-amz-linux-2023.pkr.hcl:24,15-56"

Error: Duplicate local definition

  on host4.pkr.hcl line 24, in locals:
  24:   timestamp = regex_replace(timestamp(), "[- TZ:]", "")

Local variable "timestamp" is defined twice in your templates. Other definition
found at "aws-amz-linux-2023.pkr.hcl:24,15-56"

Error: Duplicate local definition

  on host5.pkr.hcl line 24, in locals:
  24:   timestamp = regex_replace(timestamp(), "[- TZ:]", "")

Local variable "timestamp" is defined twice in your templates. Other definition
found at "aws-amz-linux-2023.pkr.hcl:24,15-56"

Error: Duplicate local definition

  on host6.pkr.hcl line 24, in locals:
  24:   timestamp = regex_replace(timestamp(), "[- TZ:]", "")

Local variable "timestamp" is defined twice in your templates. Other definition
found at "aws-amz-linux-2023.pkr.hcl:24,15-56"

2025/02/04 15:55:47 [INFO] (telemetry) Finalizing.
2025/02/04 15:55:47 waiting for all plugin processes to complete...

Expected behavior

for file in $(ls |grep pkr.hcl); do packer validate $file; done
The configuration is valid.
The configuration is valid.
The configuration is valid.
The configuration is valid.
The configuration is valid.
The configuration is valid.
The configuration is valid.
The configuration is valid.
The configuration is valid.
The configuration is valid.

Any helpful log output or screenshots

Paste the results here:

See above I believe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant