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:
- Try to run terraform with aws provider profile variable set to "env-qa" (AWS_PROFILE env not set)
- Terraform will try to to apply to "env-prod" env actually
- run
AWS_PROFILE=env-qa terraform apply
- 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"
}
}
}
Describe the bug
Different results with aws provider profile and AWS_PROFILE env variable
System (please complete the following information):
To Reproduce
Steps to reproduce the behavior:
AWS_PROFILE=env-qa terraform applyExpected 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"
}
}
}