terragrunt
terragrunt copied to clipboard
terragrunt does not pass -backend=false to terraform
Looks like terragrunt swallows the -backend=false flag during init ops. We need this to run linting against the codebase on an execution env that has no credentials.
~ terragrunt init -backend=false
╷
│ Error: Backend initialization required, please run "terraform init"
│
│ Reason: Initial configuration of the requested backend "s3"
[...]
~ terragrunt init -backend=false --terragrunt-no-auto-init
╷
│ Error: Backend initialization required, please run "terraform init"
│
│ Reason: Initial configuration of the requested backend "s3"
[...]
However, with terraform directly:
~ terraform init -backend=false
Initializing modules...
- bastion in ../../modules/bastion
Initializing provider plugins...
- Finding latest version of hashicorp/template...
- Finding latest version of hashicorp/aws...
- Installing hashicorp/aws v4.11.0...
- Installed hashicorp/aws v4.11.0 (signed by HashiCorp)
- Installing hashicorp/template v2.2.0...
- Installed hashicorp/template v2.2.0 (signed by HashiCorp)
[...]
Terraform has been successfully initialized!
[...]
You can achieve the same result using an environment variable and the remote_state.disable_init attribute.
As per the documentation:

Running into the same and the disable_init option doesn't fix it. I'll have to prolly add the credentials just to be able to validate which sucks as it works out of the box with plain terraform.
ERRO[0007] Module /home/runner/terraform/my-app has finished with an error: Error finding AWS credentials (did you set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables?): NoCredentialProviders: no valid providers in chain. Deprecated.
For verbose messaging see aws.Config.CredentialsChainVerboseErrors prefix=[/home/runner/terraform/my-app]
ERRO[0007] 1 error occurred:
* Error finding AWS credentials (did you set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables?): NoCredentialProviders: no valid providers in chain. Deprecated.
For verbose messaging see aws.Config.CredentialsChainVerboseErrors
ERRO[0007] Unable to determine underlying exit code, so Terragrunt will exit with error code 1