Skip to content

Commit

Permalink
Issue #45: Update pipeline with aks credentials to apply kubernetes m…
Browse files Browse the repository at this point in the history
…anifest from terraform
  • Loading branch information
SonOfLope committed Feb 17, 2024
1 parent e8458f5 commit 4bf3105
Showing 1 changed file with 48 additions and 6 deletions.
54 changes: 48 additions & 6 deletions apply-terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,31 @@ stages:
- job: TerraformInitPlan
displayName: "Terraform Init and Plan"
steps:
- task: AzureCLI@2
displayName: "Azure CLI Login"
inputs:
azureSubscription: $(serviceConnectionName)
scriptType: "bash"
scriptLocation: "inlineScript"
inlineScript: |
echo "Successfully logged in with Azure CLI"
- task: AzureCLI@2
displayName: "Get AKS Credentials"
inputs:
azureSubscription: $(serviceConnectionName)
scriptType: "bash"
scriptLocation: "inlineScript"
inlineScript: |
az aks get-credentials --name <YourAKSClusterName> --resource-group <YourResourceGroupName> --admin --file ~/.kube/config

Check failure on line 38 in apply-terraform.yml

View workflow job for this annotation

GitHub Actions / yaml-check / yaml-lint-check

38:121 [line-length] line too long (137 > 120 characters)
echo "AKS credentials configured for kubectl"
- task: DownloadSecureFile@1
name: DownloadSecureVars
displayName: 'Download staging.tfvars'
displayName: "Download staging.tfvars"
inputs:
secureFile: 'staging.tfvars'
secureFile: "staging.tfvars"

- task: TerraformTaskV2@2
displayName: Terra Init
inputs:
Expand All @@ -35,12 +55,13 @@ stages:
backendAzureRmStorageAccountName: "$(storageAccountName)"
backendAzureRmContainerName: "$(containerName)"
backendAzureRmKey: "$(stateKey)"

- task: TerraformTaskV2@2
displayName: Terra Plan
inputs:
provider: "azurerm"
command: "plan"
commandOptions: '-var-file=$(DownloadSecureVars.SecureFilePath)'
commandOptions: "-var-file=$(DownloadSecureVars.SecureFilePath)"
workingDirectory: "$(System.DefaultWorkingDirectory)/terraform/staging"
environmentServiceNameAzureRM: "$(serviceConnectionName)"

Expand All @@ -59,11 +80,32 @@ stages:
deploy:
steps:
- checkout: self

- task: AzureCLI@2
displayName: "Azure CLI Login"
inputs:
azureSubscription: $(serviceConnectionName)
scriptType: "bash"
scriptLocation: "inlineScript"
inlineScript: |
echo "Successfully logged in with Azure CLI"
- task: AzureCLI@2
displayName: "Get AKS Credentials"
inputs:
azureSubscription: $(serviceConnectionName)
scriptType: "bash"
scriptLocation: "inlineScript"
inlineScript: |
az aks get-credentials --name $(aks-name) --resource-group $(resource-group) --admin --file ~/.kube/config

Check failure on line 100 in apply-terraform.yml

View workflow job for this annotation

GitHub Actions / yaml-check / yaml-lint-check

100:121 [line-length] line too long (128 > 120 characters)
echo "AKS credentials configured for kubectl"
- task: DownloadSecureFile@1
name: DownloadSecureVars
displayName: 'Download staging.tfvars'
displayName: "Download staging.tfvars"
inputs:
secureFile: 'staging.tfvars'
secureFile: "staging.tfvars"

- task: TerraformTaskV2@2
displayName: Terra Init
inputs:
Expand All @@ -80,6 +122,6 @@ stages:
inputs:
provider: "azurerm"
command: "apply"
commandOptions: '-var-file=$(DownloadSecureVars.SecureFilePath)'
commandOptions: "-var-file=$(DownloadSecureVars.SecureFilePath)"
workingDirectory: "$(System.DefaultWorkingDirectory)/terraform/staging"
environmentServiceNameAzureRM: "$(serviceConnectionName)"

0 comments on commit 4bf3105

Please sign in to comment.