Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform aws provider profile ignored in some cases #40

Open
arraen opened this issue Dec 28, 2022 · 0 comments
Open

Terraform aws provider profile ignored in some cases #40

arraen opened this issue Dec 28, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@arraen
Copy link

arraen commented Dec 28, 2022

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 arraen added the bug Something isn't working label Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant