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

Conversation

SonOfLope
Copy link
Contributor

@SonOfLope SonOfLope commented Feb 1, 2024

This pull request introduces the necessary configurations on the testing repository from our Azure Devops Repository AI-LAB to establish an integration between our Azure infrastructure and our source control management on GitHub. By using an Azure Service Principal and a GitHub service connector previously configured on our Azure Devops, we are able to execute Terraform workflows within the Azure DevOps AI-LAB repository while using this repository (infra) as source code for the workflows.

I suggest we use this solution as of now to migrate our services to GCP to Azure while I open a ticket with the Cloud team to provide a new service principal providing permissions to this repository (infra) to execute directly to our Azure subscription without the use of the middle-man (AI-LAB repository).

The following code simply creates a ressource group as an example to prove that the workflow works :

  • Azure test resource group :
    Azure test resource group
  • Successful pipeline :
    image

This allows us to move on to the next step of migrating our services to our Azure subscription.

TODO

  • Change reusable workflow Terraform linting reference to main branch once this gets merged.

@SonOfLope SonOfLope requested a review from a team February 1, 2024 22:27
@SonOfLope SonOfLope self-assigned this Feb 1, 2024
@SonOfLope SonOfLope marked this pull request as draft February 1, 2024 22:28
@SonOfLope
Copy link
Contributor Author

Set in draft to discuss about trigger steps for this workflow

@rngadam
Copy link

rngadam commented Feb 4, 2024

do we want to add https://github.com/ai-cfia/github-workflows/blob/main/.github/workflows/workflow-yaml-check.md and a terraform linter?

@SonOfLope
Copy link
Contributor Author

SonOfLope commented Feb 5, 2024

@SonOfLope
Copy link
Contributor Author

SonOfLope commented Feb 5, 2024

I also added an approval process for terraform apply step. It waits for an approval on Azure Devops AI-Lab repository (where we got access to the Azure service connector and where the Azure pipeline terraform-apply.yml is being applied from). Once one of the listed approvers (Thomas or me) accepts the Terraform plan, the job to apply the plan gets executed. Once I document this process I will set the PR ready for review

@SonOfLope
Copy link
Contributor Author

I also added an approval process for terraform apply step. It waits for an approval on Azure Devops AI-Lab repository (where we got access to the Azure service connector and where the Azure pipeline terraform-apply.yml is being applied from). Once one of the listed approvers (Thomas or me) accepts the Terraform plan, the job to apply the plan gets executed. Once I document this process I will set the PR ready for review

Documentation added to our internal wiki.

@SonOfLope SonOfLope marked this pull request as ready for review February 5, 2024 19:49
Copy link
Member

@ThomasCardin ThomasCardin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link

@rngadam rngadam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved minus the missing newline EOF (which should have been caught by a github workflow)

.tflint.hcl Outdated Show resolved Hide resolved
@SonOfLope
Copy link
Contributor Author

approved minus the missing newline EOF (which should have been caught by a github workflow)

I dont think we lint hcl files in our workflows.

Copy link
Member

@ThomasCardin ThomasCardin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like jonathan said, we don't lint .hcl file, maybe we could use https://github.com/super-linter/super-linter. I'll write an issue about it.

@SonOfLope SonOfLope merged commit 4fef77e into main Feb 7, 2024
4 of 6 checks passed
@rngadam
Copy link

rngadam commented Feb 7, 2024

@ThomasCardin @SonOfLope

...this is part of the generic standards validation workflow that should apply to ALL files:

https://github.com/ai-cfia/github-workflows/blob/8521ad203de073af433485a150dc00597ca0380b/.github/workflows/workflow-repo-standards-validation.yml#L174

I see it seems to be running, so is this broken or misconfigured?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

As a Devops, I would like to automate Azure infrastructure deployment using Terraform
3 participants