Skip to content

terraform state location not working #63

@goseinthemachine

Description

@goseinthemachine

The Problem

First I made sure I was logged in properly.

  1. Ran aws configure sso --profile BWTC-Developer
  2. ran aws sso login --profile BWTC-Developer

Then I tried to run terraform init and was not able to as I was getting this error.

Error refreshing state: AccessDenied: Access Denied
        status code: 403, request id: N7XHKNMYFE4YSDJ2, host id: OCFqyTMQgBoAS4I9CYEcnNiekCyV0LHxOtyFzCPjq39MK+yP3Qn4/8w1PIAMPo3bHjoh88MJISk=
terraform {
  backend "s3" {
    bucket  = "shift3-terraform-state" //Does not exist in BWTC-Client-Sandbox and BWTC-Developer-Sandbox
    key     = "stemtaught-test-server/terraform.tfstate"
    region  = "us-west-2"
    profile = "BWTC-Developer" //Would have to use profile pointing to the old original account for this too work
  }


  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 4.0"
    }
  }
}

Solutions

  • Add shift3-terraform-state bucket to each account.
  • Specify that two different accounts are needed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions