Terraform AWS Profile Confusion

Ahh, terraform. What a useful tool. Unfortunately, there appears to be some confusion around the AWS profile, when using one. If you export the AWS_DEFAULT_PROFILE, you must also export the AWS_PROFILE to get the proper permissions…

$ terraform -v
Terraform v0.12.2
+ provider.aws v2.7.0

$ terraform plan
...
Error: AccessDeniedException: User: arn:aws:iam::xxxxxxxxxx:user/${user} is not authorized to perform: ds:DescribeDirectories
Error: Error retrieving ALB: ValidationError:...
Error: Error describing SSM document: AccessDeniedException:...
Error: Error retrieving Target Group: ValidationError:...
Error: Error retrieving ALB: ValidationError:...
Error: Error retrieving Target Group: ValidationError:
...
$ export AWS_DEFAULT_PROFILE=${my_aws_profile}
$ export AWS_PROFILE=${my_aws_profile}

Leave a Reply

Your email address will not be published. Required fields are marked *