I have a longstanding Terraform config that’s working well using “terraform apply” and is able to authenticate the AWS provider using the Vault provider:
data "vault_aws_access_credentials" "aws_creds" {
backend = "aws"
role = "XXX"
}
provider "aws" {
region = var.aws_region
access_key = data.vault_aws_access_credentials.aws_creds.access_key
secret_key = data.vault_aws_access_credentials.aws_creds.secret_key
}
However, when I use “terraform import” I get:
Error: error configuring Terraform AWS Provider: error validating provider credentials: error calling sts:GetCallerIdentity: operation error STS: GetCallerIdentity, https response error StatusCode: 403, RequestID: XXX, api error InvalidClientTokenId: The security token included in the request is invalid.
I’m not sure why “apply” can authenticate the AWS provider but “import” can’t. Any advice is greatly appreciated.
Versions:
- terraform: 1.0.11
- aws provider: 4.0.0
- vault provider: 3.25.0