Skip to content

Commit

Permalink
Ensure terraform cli exists in the runner
Browse files Browse the repository at this point in the history
  • Loading branch information
kwiatekus committed Dec 16, 2024
1 parent f67d4c5 commit 764548b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/actions/create-sap-btp-kyma/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ inputs:
description: 'Minimum numbers of worker nodes the new kyma environment shoud start with'
required: false
default: '3'
btp_kyma_administrators:
description: 'String representation of the kyma admin list'
required: false
default: "[]"

outputs:
subaccount_id:
Expand All @@ -46,6 +50,24 @@ outputs:
runs:
using: 'composite'
steps:
- name: ensure terraform cli
shell: bash
run: |
if ! which terraform; then
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common
wget -O- https://apt.releases.hashicorp.com/gpg | \
gpg --dearmor | \
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null
gpg --no-default-keyring \
--keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg \
--fingerprint
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \
https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \
sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update
sudo apt-get install terraform
fi
terraform -help
- name: Create btp resources
id: create-btp-resources
run: |
Expand All @@ -68,4 +90,5 @@ runs:
TF_VAR_BTP_KYMA_REGION: ${{ inputs.btp_kyma_region }}
TF_VAR_BTP_KYMA_MODULES_STRINGIFIED: ${{ inputs.btp_kyma_modules }}
TF_VAR_BTP_KYMA_AUTOSCALER_MIN: ${{ inputs.btp_kyma_autoscaler_min }}
TF_VAR_BTP_KYMA_CUSTOM_ADMINISTRATORS: ${{ inputs.btp_kyma_administrators }}

1 change: 1 addition & 0 deletions .github/actions/create-sap-btp-kyma/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module "kyma" {
BTP_NEW_SUBACCOUNT_REGION = var.BTP_NEW_SUBACCOUNT_REGION
BTP_KYMA_MODULES = jsondecode(var.BTP_KYMA_MODULES_STRINGIFIED)
BTP_KYMA_AUTOSCALER_MIN = var.BTP_KYMA_AUTOSCALER_MIN
BTP_KYMA_CUSTOM_ADMINISTRATORS = jsondecode(var.BTP_KYMA_CUSTOM_ADMINISTRATORS)
}

output "subaccount_id" {
Expand Down
5 changes: 5 additions & 0 deletions .github/actions/create-sap-btp-kyma/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,9 @@ variable "BTP_KYMA_MODULES_STRINGIFIED" {
variable "BTP_KYMA_AUTOSCALER_MIN" {
type = number
default = 3
}

variable "BTP_KYMA_CUSTOM_ADMINISTRATORS" {
type = string
description = "Emails of kyma admins stringified array"
}

0 comments on commit 764548b

Please sign in to comment.