Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #28: As a DevOps, I would like to automate Azure infrastructure deployment using Terraform #29

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4a5b0b4
Issue #3: testing terraform pipeline workflow
SonOfLope Feb 1, 2024
97ddbe7
Issue #3: Set up terraform pipeline for our infra repo (gh) with Azur…
SonOfLope Feb 1, 2024
deaed31
Issue #3(gh-ai-cfia-infra): Update with branch trigger
SonOfLope Feb 1, 2024
abd27bb
Issue #3: testing with region typo fix
SonOfLope Feb 1, 2024
d71b21d
Issue #3: try with newer action version
SonOfLope Feb 1, 2024
51c5703
Issue #3: add proper workingDirectory for every steps
SonOfLope Feb 1, 2024
5a50344
Merge branch '3-create-a-kubernetes-cluster-for-azure-w-the-ingress-n…
SonOfLope Feb 1, 2024
021790c
Issue #28: added integration workflow for markdown, yaml, terraform l…
SonOfLope Feb 5, 2024
75e0e25
Issue #28: Approval workflow for terraform apply
SonOfLope Feb 5, 2024
52d3cba
Issue #28: Fix markdown lint checks on README,md
SonOfLope Feb 5, 2024
35f2ea5
Issue #28: Change to reusable workflow for tf linting, add tflint co…
SonOfLope Feb 5, 2024
f4329af
Issue #28: fix workflow input name
SonOfLope Feb 5, 2024
2fad951
Issue #28: format terraform. It was a test of workflow to shows that…
SonOfLope Feb 5, 2024
5ac5dfb
Issue #28: remove trailing space
SonOfLope Feb 5, 2024
69f21d9
Issue #28: remove Terraform code since it was just used as an example…
SonOfLope Feb 5, 2024
9521c0a
Issue #28: set azure info as variables
SonOfLope Feb 6, 2024
5a34470
Issue #28: environment name typo
SonOfLope Feb 6, 2024
3587c28
Issue #28: Add stage so that approval is only prompted for apply
SonOfLope Feb 6, 2024
1eb468a
Issue #28: Fix yaml lint errors
SonOfLope Feb 6, 2024
f06006a
Issue #28: remove duplicate stage
SonOfLope Feb 6, 2024
bb2dfbf
Issue #28: EOF line and change reference to reusable workflow that wa…
SonOfLope Feb 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:

Check warning on line 4 in .github/workflows/infra-ci-workflow.yaml

View workflow job for this annotation

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

4:1 [truthy] truthy value should be one of [false, true]

Check warning on line 4 in .github/workflows/infra-ci-workflow.yaml

View workflow job for this annotation

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

4:1 [truthy] truthy value should be one of [false, true]
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'
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"
}
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
# Infrastructure Repository for ACIA-CFIA AI-Lab

This repository is dedicated to the infrastructure management of the ACIA-CFIA AI-Lab. It contains scripts, configurations, and documentation pertinent to infrastructure and DevOps practices within the lab, facilitating setup, deployment, and management across multiple cloud platforms including AWS, GCP, and Azure.
This repository is dedicated to the infrastructure management of the ACIA-CFIA
AI-Lab. It contains scripts, configurations, and documentation pertinent to
infrastructure and DevOps practices within the lab, facilitating setup,
deployment, and management across multiple cloud platforms including AWS, GCP,
and Azure.

## Contents:
## Contents

Cross-Cloud Setup Scripts: Automation scripts for seamless configuration across AWS, GCP, and Azure, covering project initiation, billing account association, artifact repository orchestration, and service account setup.
GitHub Repository Creation Guide: Detailed instructions for creating new repositories in alignment with ACIA-CFIA standards.
Getting Started:
Cross-Cloud Setup Scripts: Automation scripts for seamless configuration across
AWS, GCP, and Azure, covering project initiation, billing account association,
artifact repository orchestration, and service account setup. GitHub Repository
Creation Guide: Detailed instructions for creating new repositories in alignment
with ACIA-CFIA standards. Getting Started:

## Clone this repository

## Clone this repository.
1. Navigate to the desired script or documentation.
2. Follow the provided instructions.
3. Related Repositories:

Dev-Rel-Docs: Contains introductory files and documentation related to developer relations at ACIA-CFIA AI-Lab.
Dev-Rel-Docs: Contains introductory files and documentation related to developer
relations at ACIA-CFIA AI-Lab.
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)'
Loading