vegas-credentials icon indicating copy to clipboard operation
vegas-credentials copied to clipboard

Terraform aws provider profile ignored in some cases

Open arraen opened this issue 2 years ago • 0 comments

Describe the bug Different results with aws provider profile and AWS_PROFILE env variable

System (please complete the following information):

  • OS: Linux
  • OS Version: 5.15.79.1
  • Tool Version: 0.14.4
  • Tool Installation Method: manual
  • Credential Process invoked via: terraform

To Reproduce Steps to reproduce the behavior:

  1. Try to run terraform with aws provider profile variable set to "env-qa" (AWS_PROFILE env not set)
  2. Terraform will try to to apply to "env-prod" env actually
  3. run AWS_PROFILE=env-qa terraform apply
  4. Terraform will try to to apply to "env-qa" env

Expected behavior As I understand it should work in the same way

Additional context terraform config:

variable "aws_profile" { default = "env-qa" }

terraform { required_version = ">= 1.2.3" required_providers { aws = { source = "hashicorp/aws" version = "4.23.0" } } backend "s3" { profile = "env-prod" encrypt = true dynamodb_table = "terraform-lock" bucket = "env-terraform" key = "infra/main.tf" region = "region" } }

provider "aws" { profile = var.aws_profile default_tags { tags = { Service = "service" Environment = local.env Owner = "terraform" } } }

arraen avatar Dec 28 '22 13:12 arraen