Giter Club home page Giter Club logo

onsdigital.es-concourse-secrets-management's Introduction


AWS Secrets Management with Concourse CI

Table of Contents

About The Project

This project contains a POC Concourse YAML pipeline that shows AWS secrets being retrieved

Prerequisites

  1. AWS CLI configured with credentials to access AWS Secrets
  2. Concourse CI running locally and configured with AWS account in #1
  3. fly cli (same version as Concourse CI above)

Usage

  1. Configure Concourse
  2. Create a secret
  3. Modify pipeline to echo the secret created

Configure Concourse

This assumes that you have fly CLI and a Concourse CI installation available.

The Concourse CI web nodes must be running with the AWS credentials specified like so:

CONCOURSE_AWS_SECRETSMANAGER_REGION="us-east-1"
CONCOURSE_AWS_SECRETSMANAGER_ACCESS_KEY="xxxxxxxxxx"
CONCOURSE_AWS_SECRETSMANAGER_SECRET_KEY="xxxxxxxxxx"

The above can also be specified inline while executing the web nodes.

If you using a docker-compose to run Concourse CI locally, add the last three env vars as below:

  concourse:
    image: concourse/concourse:5.2.0
    command: quickstart
    privileged: true
    depends_on: [concourse-db]
    ports: ["8080:8080"]
    environment:
      - CONCOURSE_POSTGRES_HOST=concourse-db
      - CONCOURSE_POSTGRES_USER=concourse_user
      - CONCOURSE_POSTGRES_PASSWORD=concourse_pass
      - CONCOURSE_POSTGRES_DATABASE=concourse
      - CONCOURSE_EXTERNAL_URL
      - CONCOURSE_ADD_LOCAL_USER=admin:admin
      - CONCOURSE_MAIN_TEAM_LOCAL_USER=admin
      - CONCOURSE_AWS_SECRETSMANAGER_REGION=eu-west-2
      - CONCOURSE_AWS_SECRETSMANAGER_ACCESS_KEY=xxxxxxxxxxx
      - CONCOURSE_AWS_SECRETSMANAGER_SECRET_KEY=xxxxxxxxxxx

It is required that the AWS user account used above has access to AWS Secrets In an upcoming PR, this will be changed so that an account is used with assume role.

Create a secret

Note that the path must be /concourse/$TEAM_NAME/$SECRET_NAME

aws secretsmanager create-secret --name  "/concourse/main/random-secret" --secret-string "test1234"

Modify pipeline.yml

Modify the value of NAME, i.e. the secret being echoed, in pipeline.yml to whatever you created above, sans the path:

          run:
            path: /bin/hello-world
            args: []
          params:
            NAME: ((random-secret))

Finally, run the commands to set the pipeline and execute a build.

  1. This should build a docker image (if needed) from https://github.com/ONSdigital/echo-param/blob/master/docker/Dockerfile
  2. Push the above image to a newly created docker hub account - This demoes using credentials for a docker-image resource type
  3. Pulls the above image and executes it passing in the name of a secret which is then echoed in the container created from this docker image.

onsdigital.es-concourse-secrets-management's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.