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
|
2023-08-09 02:39:22 -04:00
|
|
|
kubernetesVersion:
|
|
|
|
description: "Kubernetes version to create the cluster from."
|
2023-08-09 10:22:37 -04:00
|
|
|
required: false
|
2023-04-13 06:02:19 -04:00
|
|
|
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
|
|
|
|
|
|
|
|
runs:
|
|
|
|
using: "composite"
|
|
|
|
steps:
|
2023-08-09 02:39:22 -04:00
|
|
|
- name: Generate config
|
|
|
|
id: generate-config
|
2023-02-21 06:47:14 -05:00
|
|
|
shell: bash
|
2023-08-09 02:39:22 -04:00
|
|
|
# TODO(katexochen): Remove the generate-config flag once v2.10 is released.
|
2023-02-21 06:47:14 -05:00
|
|
|
run: |
|
2023-06-29 09:46:36 -04:00
|
|
|
output=$(constellation iam create --help)
|
|
|
|
if [[ $output == *"generate-config"* ]]; then
|
2023-08-09 02:39:22 -04:00
|
|
|
echo "flag=--generate-config" | tee -a "$GITHUB_OUTPUT"
|
|
|
|
exit 0
|
2023-06-29 09:46:36 -04:00
|
|
|
fi
|
|
|
|
|
2023-08-09 10:22:37 -04:00
|
|
|
kubernetesFlag=""
|
|
|
|
if [[ ! -z "${{ inputs.kubernetesVersion }}" ]]; then
|
|
|
|
kubernetesFlag="--kubernetes=${{ inputs.kubernetesVersion }}"
|
|
|
|
fi
|
|
|
|
|
2023-08-09 02:39:22 -04:00
|
|
|
echo "flag=--update-config" | tee -a "$GITHUB_OUTPUT"
|
2023-08-09 10:22:37 -04:00
|
|
|
constellation config generate ${{ inputs.cloudProvider }} ${kubernetesFlag}
|
2023-08-09 02:39:22 -04:00
|
|
|
|
|
|
|
- name: Constellation iam create aws
|
|
|
|
shell: bash
|
|
|
|
if: inputs.cloudProvider == 'aws'
|
|
|
|
run: |
|
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-08-09 02:39:22 -04:00
|
|
|
${{ steps.generate-config.outputs.flag }} \
|
2023-08-28 03:01:03 -04:00
|
|
|
--tf-log=DEBUG \
|
2023-08-09 02:39:22 -04:00
|
|
|
--yes
|
2023-02-21 06:47:14 -05:00
|
|
|
|
2023-08-09 10:22:37 -04:00
|
|
|
- name: Constellation iam create azure
|
2023-02-21 06:47:14 -05:00
|
|
|
shell: bash
|
|
|
|
if: inputs.cloudProvider == 'azure'
|
|
|
|
run: |
|
|
|
|
constellation iam create azure \
|
|
|
|
--region=${{ inputs.azureRegion }} \
|
2023-04-13 06:02:19 -04:00
|
|
|
--resourceGroup="${{ inputs.namePrefix }}-rg" \
|
|
|
|
--servicePrincipal="${{ inputs.namePrefix }}-sp" \
|
2023-08-09 02:39:22 -04:00
|
|
|
${{ steps.generate-config.outputs.flag }} \
|
2023-08-28 03:01:03 -04:00
|
|
|
--tf-log=DEBUG \
|
2023-08-09 02:39:22 -04:00
|
|
|
--yes
|
2023-02-21 06:47:14 -05:00
|
|
|
|
|
|
|
- name: Constellation iam create gcp
|
|
|
|
shell: bash
|
|
|
|
if: inputs.cloudProvider == 'gcp'
|
|
|
|
run: |
|
|
|
|
constellation iam create gcp \
|
|
|
|
--projectID=${{ inputs.gcpProjectID }} \
|
|
|
|
--zone=${{ inputs.gcpZone }} \
|
2023-04-13 06:02:19 -04:00
|
|
|
--serviceAccountID="${{ inputs.namePrefix }}-sa" \
|
2023-08-09 02:39:22 -04:00
|
|
|
${{ steps.generate-config.outputs.flag }} \
|
2023-08-28 03:01:03 -04:00
|
|
|
--tf-log=DEBUG \
|
2023-08-09 02:39:22 -04:00
|
|
|
--yes
|