title: AWS CodeBuild /codebuild/output/tmp/script.sh: terraform: Exec format error
body: <p>I am using AWS Codebuild to build infrastructure through terraform. I created this buildspec.yaml file.</p>
  <pre><code>version: 0.2
  
  phases: 
    install:
      commands:
        - &quot;apt install unzip -y&quot;
        - &quot;wget https://releases.hashicorp.com/terraform/1.1.8/terraform_1.1.8_linux_arm64.zip&quot;
        - &quot;unzip terraform_1.1.8_linux_arm64.zip&quot;
        - &quot;mv terraform /usr/local/bin/&quot;
  
    pre_build:
      commands:
        - terraform init
  
    build:
      commands:
        - terraform plan
        - terraform apply -auto-approve
    post_build:
      commands:
        - echo &quot;terraform apply completed on `date`&quot;
  
  </code></pre>
  <p>I am able to install terraform successfully but not able to run terraform init and initialize the code. I am getting this error:</p>
  <pre><code>[Container] 2022/06/23 10:25:29 Phase complete: INSTALL State: SUCCEEDED
  [Container] 2022/06/23 10:25:29 Phase context status code:  Message: 
  [Container] 2022/06/23 10:25:29 Entering phase PRE_BUILD
  [Container] 2022/06/23 10:25:29 Running command terraform init
  /codebuild/output/tmp/script.sh: 4: /codebuild/output/tmp/script.sh: terraform: Exec format error
  </code></pre>
  <p>This is my terraform setup.</p>
  <pre><code>terraform {
    required_providers {
      aws = {
        source  = &quot;hashicorp/aws&quot;
        version = &quot;~&gt; 4.0&quot;
      }
    }
    backend &quot;s3&quot; { }
  }
  </code></pre>
  <p>I tried different things such changing aws provider version. I turned on and off  &quot;privileged&quot; flag on codebuild project. Can someone please suggest what I am doing wrong?</p>