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

Reusable GHA for Terraform deploy #323

Merged
merged 74 commits into from
Oct 17, 2024
Merged

Reusable GHA for Terraform deploy #323

merged 74 commits into from
Oct 17, 2024

Conversation

derekadombek
Copy link
Collaborator

@derekadombek derekadombek commented Oct 16, 2024

Description

This is so we can finally automate the Terraform apply process with Github Actions rather than from my personal command line. This will be added to the combined deployment.

Screenshots (if applicable)

Related Issues

[Link any related issues or tasks from your project management system.]

Checklist

  • The title of this PR is descriptive and concise.
  • My changes follow the style guidelines of this project.
  • I have added or updated test cases to cover my changes.
  • I've let the team know about this PR by linking it in the review channel

@derekadombek derekadombek self-assigned this Oct 16, 2024
@derekadombek derekadombek linked an issue Oct 16, 2024 that may be closed by this pull request
@derekadombek derekadombek marked this pull request as draft October 16, 2024 13:58
storage_account_name = "tfstaterv2024"
container_name = "rv-tfstate"
key = "dev.terraform.tfstate"
use_oidc = true
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

these are just auto formating changes

@derekadombek derekadombek marked this pull request as ready for review October 16, 2024 21:20
storage_account_name = "tfstaterv2024"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Assuming these are for each of the different dev environments?

Copy link
Collaborator Author

@derekadombek derekadombek Oct 17, 2024

Choose a reason for hiding this comment

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

thats correct! so with TF you can store the configuration state files either locally on our computers or a in a central location. these config files basically create and update these files in a global AZ Resource Group in the same account subscription. the benefit of separating them out into individual files like this is so we can use the -backend-config=config/${{ inputs.deploy-env }}.config flag in the terraform cli. We are no using that here in a reusable GHA:

terraform init -backend-config=config/${{ inputs.deploy-env }}.config

In the future however, I would like to research and find out if this is for sure the best and most appropriate way of doing this but for now, this allows for a bunch of flexibility.

Copy link
Collaborator

@arinkulshi-skylight arinkulshi-skylight left a comment

Choose a reason for hiding this comment

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

LGTM! Would love to test out the e2e flow when it is ready.

@derekadombek
Copy link
Collaborator Author

LGTM! Would love to test out the e2e flow when it is ready.

💯 ! Getting very close for sure.

@derekadombek derekadombek added this pull request to the merge queue Oct 17, 2024
Merged via the queue into main with commit a753cbe Oct 17, 2024
1 check passed
@derekadombek derekadombek deleted the reusable-gha-tf-deploy branch October 17, 2024 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Terraform deploy as reusable workflow
2 participants