2023-02-21 06:47:14 -05:00
|
|
|
name: Constellation IAM create
|
|
|
|
description: Create IAM configuration for a Constellation cluster.
|
|
|
|
|
|
|
|
inputs:
|
|
|
|
cloudProvider:
|
2023-04-13 06:02:19 -04:00
|
|
|
description: "Either 'aws', 'azure' or 'gcp'."
|
|
|
|
required: true
|
|
|
|
namePrefix:
|
|
|
|
description: "Name prefix to use for resources."
|
|
|
|
required: true
|
2023-02-21 06:47:14 -05:00
|
|
|
#
|
|
|
|
# AWS specific inputs
|
|
|
|
#
|
|
|
|
awsZone:
|
|
|
|
description: "AWS zone to deploy Constellation in."
|
|
|
|
required: false
|
|
|
|
#
|
|
|
|
# Azure specific inputs
|
|
|
|
#
|
|
|
|
azureRegion:
|
|
|
|
description: "Azure region to deploy Constellation in."
|
|
|
|
required: false
|
|
|
|
#
|
|
|
|
# GCP specific inputs
|
|
|
|
#
|
|
|
|
gcpProjectID:
|
|
|
|
description: "The GCP project ID to deploy Constellation in."
|
|
|
|
required: false
|
|
|
|
gcpZone:
|
|
|
|
description: "The GCP zone to deploy Constellation in."
|
|
|
|
required: false
|
|
|
|
|
|
|
|
outputs:
|
|
|
|
existingConfig:
|
|
|
|
description: "Whether a configuration file has been created to be used in the next step."
|
|
|
|
value: ${{ steps.setExistingConfig.outputs.existingConfig }}
|
|
|
|
|
|
|
|
runs:
|
|
|
|
using: "composite"
|
|
|
|
steps:
|
|
|
|
- name: Constellation iam create aws
|
|
|
|
shell: bash
|
|
|
|
if: inputs.cloudProvider == 'aws'
|
|
|
|
run: |
|
2023-06-28 08:47:44 -04:00
|
|
|
constellation config generate aws
|
2023-02-21 06:47:14 -05:00
|
|
|
constellation iam create aws \
|
|
|
|
--zone=${{ inputs.awsZone }} \
|
2023-04-13 06:02:19 -04:00
|
|
|
--prefix=${{ inputs.namePrefix }} \
|
2023-06-28 08:47:44 -04:00
|
|
|
--update-config --yes
|
2023-02-21 06:47:14 -05:00
|
|
|
|
|
|
|
- name: Constellation iam create azure
|
|
|
|
shell: bash
|
|
|
|
if: inputs.cloudProvider == 'azure'
|
|
|
|
run: |
|
2023-04-28 05:25:45 -04:00
|
|
|
output=$(constellation --help)
|
|
|
|
if [[ $output == *"tf-log"* ]]; then
|
|
|
|
TFFLAG="--tf-log=DEBUG"
|
|
|
|
fi
|
2023-06-28 08:47:44 -04:00
|
|
|
constellation config generate azure
|
2023-02-21 06:47:14 -05:00
|
|
|
constellation iam create azure \
|
|
|
|
--region=${{ inputs.azureRegion }} \
|
2023-04-13 06:02:19 -04:00
|
|
|
--resourceGroup="${{ inputs.namePrefix }}-rg" \
|
|
|
|
--servicePrincipal="${{ inputs.namePrefix }}-sp" \
|
2023-06-28 08:47:44 -04:00
|
|
|
--update-config --yes ${TFFLAG:-}
|
2023-02-21 06:47:14 -05:00
|
|
|
|
|
|
|
- name: Constellation iam create gcp
|
|
|
|
shell: bash
|
|
|
|
if: inputs.cloudProvider == 'gcp'
|
|
|
|
run: |
|
2023-06-28 08:47:44 -04:00
|
|
|
constellation config generate gcp
|
2023-02-21 06:47:14 -05:00
|
|
|
constellation iam create gcp \
|
|
|
|
--projectID=${{ inputs.gcpProjectID }} \
|
|
|
|
--zone=${{ inputs.gcpZone }} \
|
2023-04-13 06:02:19 -04:00
|
|
|
--serviceAccountID="${{ inputs.namePrefix }}-sa" \
|
2023-06-28 08:47:44 -04:00
|
|
|
--update-config --yes
|
2023-02-21 06:47:14 -05:00
|
|
|
|
|
|
|
- name: Set existing config
|
|
|
|
id: setExistingConfig
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2023-04-14 12:25:53 -04:00
|
|
|
echo "existingConfig=true" | tee -a $GITHUB_OUTPUT
|