title: Load in CodeBuild environment variables from a file that's not checked into source control
body: <p>I have an environment file that I use locally but that I don't have checked into source control. It looks similar to this:</p>
  
  <p><strong>env.ts</strong></p>
  
  <pre><code>const config = {
    prod: {
      serviceA: {
        varA: 'xyz',
        varB: 'xyz',
        varC: 'xyz',
        varD: 'xyz',
      },
      serviceB: {
        varA: 'xyz',
        varB: 'xyz',
        varC: 'xyz',
        varD: 'xyz',
      },
    },
    test: {
      serviceA: {
        varA: 'xyz',
        varB: 'xyz',
        varC: 'xyz',
        varD: 'xyz',
      },
      serviceB: {
        varA: 'xyz',
        varB: 'xyz',
        varC: 'xyz',
        varD: 'xyz',
      },
    },
  };
  
  export default config;
  
  </code></pre>
  
  <p>Using Webpack, I can load in the appropriate environment variables for a particular service when building locally. A module can access these environment variables like this:</p>
  
  <pre><code>import config from '@env';
  
    const {
      varA,
      varB,
      varC,
      varD,
    } = config[process.env.NODE_ENV].serviceA;
  </code></pre>
  
  <p>I have this project set up with an AWS CodePipeline and CodeBuild, and I realized that tests and building won't work because my <strong>env.ts</strong> file is not checked into source control because it contains sensitive credentials.</p>
  
  <p>I can add environment variables inside the CodePipeline / CodeBuild consoles, but I don't think this will work since the code is referencing a file called env.ts that's not checked into source control.</p>
  
  <p>Is it possible to maybe have this <strong>env.ts</strong> kept in something like S3 and then have it pulled into the pipeline to be used in the cloud during builds? Maybe I could load this file somehow in the buildspec? Here is my current buildspec for reference:</p>
  
  <pre class="lang-yaml prettyprint-override"><code>version: 0.2
  
  phases:
    install:
      commands:
        - echo installing packages...
        - npm install --global yarn
        - yarn install
        # &lt;-- load in env.ts file here somehow?
    build:
      commands:
        - echo running tests...
        - yarn jest
        - echo building...
        - yarn build
  
  artifacts:
    files:
      - $CODEBUILD_SRC_DIR/dist/prod/*
  </code></pre>