title: How can I upload terraform state to s3 bucket?
body: <p>I have a project whose infra is managed by <code>terraform</code>. I'd like to push the state to a s3 bucket so other teams can use the state. Below is the backend configuration:</p>
  
  <pre><code>terraform {
    backend "s3" {
      bucket = "MY_BUCKET"
      key    = "tfstate"
      region  = "ap-southeast-2"
    }
  }
  </code></pre>
  
  <p>when I run <code>terraform init</code> I got below error:</p>
  
  <pre><code>    AccessDenied: Access Denied
          status code: 403, request id: 107E6007C9C64805, host id: kWASxeq1msxvGPZIKdi+7htg3yncMFxW9PQuXdC8ouwsEHMhx8ZPu6dKGUGWzDtblC6WRg1P1ew=
  
  Terraform failed to load the default state from the "s3" backend.
  State migration cannot occur unless the state can be loaded. Backend
  modification and state migration has been aborted. The state in both the
  source and the destination remain unmodified. Please resolve the
  above error and try again.
  </code></pre>
  
  <p>It seems that <code>terraform</code> tries to load state from <code>s3</code> bucket rather than push to <code>s3</code> bucket. How can I configure <code>terraform</code> to push state to s3?</p>
  
  <p>I have configured aws profile on a tf file:</p>
  
  <pre><code>provider "aws" {
    region  = "ap-southeast-2"
    profile = "me"
  }
  </code></pre>
  
  <p>The credential for the current user has admin permission on the bucket. </p>