Skip to content

Commit

Permalink
issue #1: fixed EOF and completing the merge from main
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasCardin committed Feb 7, 2024
2 parents 4c6f99c + 4fef77e commit a3b942b
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 31 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/infra-ci-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Infra integration workflow

on:
pull_request:
types:
- opened
- closed
- synchronize

jobs:

markdown-check:
uses:
ai-cfia/github-workflows/.github/workflows/workflow-markdown-check.yml@76-as-a-devops-i-would-like-to-fix-the-markdown-lint-workflow

yaml-check:
uses:
ai-cfia/github-workflows/.github/workflows/workflow-yaml-check.yml@main

repo-standard:
uses:
ai-cfia/github-workflows/.github/workflows/workflow-repo-standards-validation.yml@main
secrets: inherit

terraform-check:
uses:
ai-cfia/github-workflows/.github/workflows/workflow-terraform-check.yml@main
with:
config-file-path: '.tflint.hcl'
4 changes: 2 additions & 2 deletions .mlc_config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"aliveStatusCodes": [999,200,403]
}
"aliveStatusCodes": [200,403]
}
22 changes: 22 additions & 0 deletions .tflint.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
plugin "terraform" {
enabled = true
preset = "recommended"
}

plugin "azurerm" {
enabled = true
version = "0.25.1"
source = "github.com/terraform-linters/tflint-ruleset-azurerm"
}

plugin "aws" {
enabled = true
version = "0.29.0"
source = "github.com/terraform-linters/tflint-ruleset-aws"
}

plugin "google" {
enabled = true
version = "0.26.0"
source = "github.com/terraform-linters/tflint-ruleset-google"
}
82 changes: 55 additions & 27 deletions apply-terraform.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,61 @@
---
trigger:
branches:
include:
- 3-create-a-kubernetes-cluster-for-azure-w-the-ingress-nginx
- main

pool:
vmImage: 'ubuntu-latest'
steps:
- task: TerraformTaskV1@0
displayName: Terra Init
inputs:
provider: 'azurerm'
command: 'init'
workingDirectory: '$(System.DefaultWorkingDirectory)/terraform'
backendServiceArm: 'CFSC-AiLabChatbot-Sub-SP'
backendAzureRmResourceGroupName: 'rg-ai-cfia-terraform-state'
backendAzureRmStorageAccountName: 'tfcfiastate'
backendAzureRmContainerName: 'infra-terraform-state'
backendAzureRmKey: 'tf/terraform.tfstate'
- task: TerraformTaskV1@0
displayName: Terra Plan
inputs:
provider: 'azurerm'
command: 'plan'
workingDirectory: $(System.DefaultWorkingDirectory)
environmentServiceNameAzureRM: 'CFSC-AiLabChatbot-Sub-SP'
- task: TerraformTaskV1@0
displayName: Terra Apply
inputs:
provider: 'azurerm'
command: 'apply'
workingDirectory: $(System.DefaultWorkingDirectory)
environmentServiceNameAzureRM: 'CFSC-AiLabChatbot-Sub-SP'

variables:
- group: terraform-backend-settings

stages:
- stage: InitAndPlan
displayName: 'Initialize and Plan'
jobs:
- job: TerraformInitPlan
displayName: 'Terraform Init and Plan'
steps:
- task: TerraformTaskV2@2
displayName: Terra Init
inputs:
provider: 'azurerm'
command: 'init'
workingDirectory: '$(System.DefaultWorkingDirectory)/terraform'
backendServiceArm: '$(serviceConnectionName)'
backendAzureRmResourceGroupName: '$(resourceGroupName)'
backendAzureRmStorageAccountName: '$(storageAccountName)'
backendAzureRmContainerName: '$(containerName)'
backendAzureRmKey: '$(stateKey)'

- task: TerraformTaskV1@0
displayName: Terra Plan
inputs:
provider: 'azurerm'
command: 'plan'
workingDirectory: '$(System.DefaultWorkingDirectory)/terraform'
environmentServiceNameAzureRM: '$(serviceConnectionName)'

- stage: Apply
displayName: 'Apply Terraform Plan'
dependsOn: InitAndPlan
condition: succeeded()
jobs:
- deployment: TerraformApply
displayName: 'Terraform Apply'
pool:
vmImage: 'ubuntu-latest'
environment: 'ProductionApproval'
strategy:
runOnce:
deploy:
steps:
- task: TerraformTaskV1@0
displayName: 'Terra Apply'
inputs:
provider: 'azurerm'
command: 'apply'
workingDirectory:
'$(System.DefaultWorkingDirectory)/terraform'
environmentServiceNameAzureRM: '$(serviceConnectionName)'
4 changes: 2 additions & 2 deletions kubernetes/apps/demo/nginx-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:

---
apiVersion: v1
kind: Service
kind: Service
metadata:
name: nginx
namespace: nginx
Expand Down Expand Up @@ -85,4 +85,4 @@ spec:
# value: "/"
# backendRefs:
# - name: nginx
# port: 80
# port: 80

0 comments on commit a3b942b

Please sign in to comment.