Open cesarpball opened 3 years ago
Quick update:
Calling the child module:
module "test" {
providers = {
aws = aws.prod
}
source = "git::myrepo"
...
...
}
Inside of child module:
provider "aws" {
alias = "src"
region = "eu-west-1"
}
provider "aws" {
alias = "dst"
region = "eu-west-1"
}
terraform validate Success! The configuration is valid.
Now... back to the original and calling the provider aws.src instead of aws
module "test" {
providers = {
**aws.src** = aws.prod
}
source = "git::myrepo"
...
...
}
terraform validate
Error: Missing required argument
The argument "region" is required, but was not set.
Then if I
AWS_DEFAULT_REGION=eu-west-1 terraform validate
Success! The configuration is valid.
but If I
AWS_DEFAULT_REGION=eu-west-1 terraform plan
Error: No valid credential sources found for AWS Provider.
Please see https://terraform.io/docs/providers/aws/index.html for more information on
providing credentials for the AWS Provider
on <empty> line 0:
(source code not available)
Releasing state lock. This may take a few moments...
Testing also with terraform Terraform v0.14.8 and following this guidelines :
I came across this post for solutions but I found a solutions that seems to helped me out. so just wanted to sharing it here. Error: configuring Terraform AWS Provider: error validating provider credentials: error calling sts:GetCallerIdentity: operation error STS: GetCallerIdentity, https response error StatusCode: 403 . Similar error:- This is pertaining to terraform cloud aws setup. Solution: run echo "export AWS_REGION=us-east-1" | tee -a ~/.bash_profile export AWS_REGION=us-east-1 and run below cmd to check if its set aws sts get-caller-identity for more refer this article : https://aws-quickstart.github.io/workshop-terraform-modules/40_setup_cloud9_ide/41_setup_creds_in_c9.html#:~:text=AWS%20Terraform%20Workshop%20%3E%20Setup%20AWS%20Cloud9%20%3E,that%20you%20downloaded%20in%20the%20Getting%20Started%20Section.
Community Note
Terraform CLI and Terraform AWS Provider Version
terraform -v Terraform v0.13.5
Affected Resource(s)
Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.
Calling the child module
On the child module my repo:
Debug Output
Panic Output
Expected Behavior
terraform plan and terraform apply executed succesfully
Actual Behavior
Steps to Reproduce
terraform init
terraform plan
References