It looks like we need to send additional parameters for terraform.
1
$ bin/dry-run.rb terraform vega-corporation/solomon-gamigin --dir=terraform/manifests/vpc
warning: parser/current is loading parser/ruby26, which recognizes
warning: 2.6.4-compliant syntax, but you are running 2.6.2.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
=> fetching dependency files
=> dumping fetched dependency files: ./dry-run/vega-corporation/solomon-gamigin/terraform/manifests/vpc
Initialized empty Git repository in /home/dependabot/dependabot-core/dry-run/vega-corporation/solomon-gamigin/terraform/manifests/vpc/.git/
* Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'dependabot@21be5d37e14a.(none)')
=> parsing dependency files
Traceback (most recent call last):
12: from bin/dry-run.rb:283:in <main>'
11: from bin/dry-run.rb:185:incached_read'
10: from bin/dry-run.rb:283:in block in <main>'
9: from /home/dependabot/dependabot-core/terraform/lib/dependabot/terraform/file_parser.rb:24:inparse'
8: from /home/dependabot/dependabot-core/terraform/lib/dependabot/terraform/file_parser.rb:24:in each'
7: from /home/dependabot/dependabot-core/terraform/lib/dependabot/terraform/file_parser.rb:25:inblock in parse'
6: from /home/dependabot/dependabot-core/terraform/lib/dependabot/terraform/file_parser.rb:222:in parsed_file'
5: from /home/dependabot/dependabot-core/common/lib/dependabot/shared_helpers.rb:34:inin_a_temporary_directory'
4: from /usr/lib/ruby/2.6.0/tmpdir.rb:93:in mktmpdir'
3: from /home/dependabot/dependabot-core/common/lib/dependabot/shared_helpers.rb:37:inblock in in_a_temporary_directory'
2: from /home/dependabot/dependabot-core/common/lib/dependabot/shared_helpers.rb:37:in chdir'
1: from /home/dependabot/dependabot-core/common/lib/dependabot/shared_helpers.rb:37:inblock (2 levels) in in_a_temporary_directory'
/home/dependabot/dependabot-core/terraform/lib/dependabot/terraform/file_parser.rb:231:in block in parsed_file': unable to parse HCL: At 35:26: Unknown token: 35:26 IDENT var.vpc_name (Dependabot::SharedHelpers::HelperSubprocessFailed)
7: from bin/dry-run.rb:283:in'
6: from bin/dry-run.rb:185:in cached_read'
5: from bin/dry-run.rb:283:inblock in '
4: from /home/dependabot/dependabot-core/terraform/lib/dependabot/terraform/file_parser.rb:24:in parse'
3: from /home/dependabot/dependabot-core/terraform/lib/dependabot/terraform/file_parser.rb:24:ineach'
2: from /home/dependabot/dependabot-core/terraform/lib/dependabot/terraform/file_parser.rb:25:in block in parse'
1: from /home/dependabot/dependabot-core/terraform/lib/dependabot/terraform/file_parser.rb:219:inparsed_file'
/home/dependabot/dependabot-core/terraform/lib/dependabot/terraform/file_parser.rb:245:in `rescue in parsed_file': unable to parse HCL: At 35:26: Unknown token: 35:26 IDENT var.vpc_name (Dependabot::DependencyFileNotParseable)
2
$ bin/dry-run.rb terraform vega-corporation/solomon-gamigin --dir=terraform/manifests/eks
warning: parser/current is loading parser/ruby26, which recognizes
warning: 2.6.4-compliant syntax, but you are running 2.6.2.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
=> fetching dependency files
=> dumping fetched dependency files: ./dry-run/vega-corporation/solomon-gamigin/terraform/manifests/eks
Reinitialized existing Git repository in /home/dependabot/dependabot-core/dry-run/vega-corporation/solomon-gamigin/terraform/manifests/eks/.git/
* Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'dependabot@21be5d37e14a.(none)')
=> parsing dependency files
Traceback (most recent call last):
12: from bin/dry-run.rb:283:in <main>'
11: from bin/dry-run.rb:185:incached_read'
10: from bin/dry-run.rb:283:in block in <main>'
9: from /home/dependabot/dependabot-core/terraform/lib/dependabot/terraform/file_parser.rb:24:inparse'
8: from /home/dependabot/dependabot-core/terraform/lib/dependabot/terraform/file_parser.rb:24:in each'
7: from /home/dependabot/dependabot-core/terraform/lib/dependabot/terraform/file_parser.rb:25:inblock in parse'
6: from /home/dependabot/dependabot-core/terraform/lib/dependabot/terraform/file_parser.rb:222:in parsed_file'
5: from /home/dependabot/dependabot-core/common/lib/dependabot/shared_helpers.rb:34:inin_a_temporary_directory'
4: from /usr/lib/ruby/2.6.0/tmpdir.rb:93:in mktmpdir'
3: from /home/dependabot/dependabot-core/common/lib/dependabot/shared_helpers.rb:37:inblock in in_a_temporary_directory'
2: from /home/dependabot/dependabot-core/common/lib/dependabot/shared_helpers.rb:37:in chdir'
1: from /home/dependabot/dependabot-core/common/lib/dependabot/shared_helpers.rb:37:inblock (2 levels) in in_a_temporary_directory'
/home/dependabot/dependabot-core/terraform/lib/dependabot/terraform/file_parser.rb:231:in block in parsed_file': unable to parse HCL: At 36:31: Unknown token: 36:31 IDENT data.terraform_remote_state.vpc.outputs.cluster_name (Dependabot::SharedHelpers::HelperSubprocessFailed)
7: from bin/dry-run.rb:283:in'
6: from bin/dry-run.rb:185:in cached_read'
5: from bin/dry-run.rb:283:inblock in '
4: from /home/dependabot/dependabot-core/terraform/lib/dependabot/terraform/file_parser.rb:24:in parse'
3: from /home/dependabot/dependabot-core/terraform/lib/dependabot/terraform/file_parser.rb:24:ineach'
2: from /home/dependabot/dependabot-core/terraform/lib/dependabot/terraform/file_parser.rb:25:in block in parse'
1: from /home/dependabot/dependabot-core/terraform/lib/dependabot/terraform/file_parser.rb:219:inparsed_file'
/home/dependabot/dependabot-core/terraform/lib/dependabot/terraform/file_parser.rb:245:in `rescue in parsed_file': unable to parse HCL: At 36:31: Unknown token: 36:31 IDENT data.terraform_remote_state.vpc.outputs.cluster_name (Dependabot::DependencyFileNotParseable)
We keep the tfvar and tfstate file in a separate directory and use environment variables to determine which environment values to read.
$ terraform plan -state "../../data/<module_name>/<env_name>.tfstate" \
-var-file="../../data/<env_name>.tfvars" \
-var-file="../../data/<module_name>/common.tfvars" \
-var-file="../../data/<module_name>/<env_name>.tfvars"
Most helpful comment
HCL 2 is no longer experimental! https://github.com/hashicorp/hcl/wiki/Version-Selection