-
Notifications
You must be signed in to change notification settings - Fork 4
57 lines (55 loc) · 2.19 KB
/
deploy-aks-linux.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
on: push
name: ProvisionKubernetesClusterOnAzure
jobs:
deploy-kubernetes-cluster:
runs-on: ubuntu-latest
steps:
- name: Install az
run: |
sudo apt-get update
sudo apt-get install curl
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
- name: Install terraform
run: |
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
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
- name: Install Git
run: |
sudo apt-get update
sudo apt-get install git
- name: Verify installation of Git
run: git --version
- name: Get az version
run: az --version
- name: Log in with Azure
uses: azure/login@v1
with:
creds: '${{ secrets.AZURE_SUBSCRIPTION_AZUREWORKSHOP }}'
- name: Clone the repository
run: |
git clone https://github.com/patkoch/iac_terraform_azure.git
- name: Login with Service Principal
run: |
az login --service-principal -u ${{ secrets.CLIENT_ID }} -p ${{ secrets.CLIENT_SECRET }} --tenant ${{ secrets.TENANT_ID }}
- name: Conduct Terraform init
run: |
cd iac_terraform_azure/aks/linux/github-actions-demo
export ARM_CLIENT_ID=${{ secrets.CLIENT_ID }}
export ARM_CLIENT_SECRET=${{ secrets.CLIENT_SECRET }}
export ARM_TENANT_ID=${{ secrets.TENANT_ID }}
terraform init
- name: Conduct Terraform validate
run: |
cd iac_terraform_azure/aks/linux/github-actions-demo
terraform validate
- name: Conduct Terraform apply
run: |
cd iac_terraform_azure/aks/linux/github-actions-demo
terraform apply -auto-approve