version: 2.1 common_env_vars: &common_env_vars AWS_REGION: us-west-2 parameters: manual: type: boolean default: false jobs: dev_plan: docker: - image: cimg/ruby:3.1.0 environment: *common_env_vars steps: - checkout - run: .circleci/bin/install - run: terraspace plan demo dev_up: docker: - image: cimg/ruby:3.1.0 environment: *common_env_vars steps: - checkout - run: .circleci/bin/install - run: terraspace up demo -y # Manually triggered: TS_ENV=prod prod_plan: docker: - image: cimg/ruby:3.1.0 environment: *common_env_vars steps: - checkout - run: .circleci/bin/install - run: TS_ENV=prod terraspace plan demo prod_up: docker: - image: cimg/ruby:3.1.0 environment: *common_env_vars steps: - checkout - run: .circleci/bin/install - run: TS_ENV=prod terraspace up demo -y workflows: # use different dev_plan and dev_up workflows so it shows up on the CircleCI dashboard dev_plan: when: not: << pipeline.parameters.manual >> jobs: - dev_plan: filters: branches: ignore: main dev_up: when: not: << pipeline.parameters.manual >> jobs: - dev_up: filters: branches: only: main prod_with_approval: when: << pipeline.parameters.manual >> jobs: - prod_plan - hold: type: approval requires: - prod_plan - prod_up: requires: - hold