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

Automate running terraform docs 66 #67

Conversation

angela-lee1
Copy link
Member

@angela-lee1 angela-lee1 commented Apr 20, 2024

Fixes #66

We need to automate running Terraform Docs whenever a .tf file is changed inside of a Terraform directory. I have changed the region in terraform-incubator/people-depot/dev/main.tf to trigger. I will change back later.

@angela-lee1
Copy link
Member Author

@chelseybeck @freaky4wrld This is my first draft. Please take a look at it and give feedback for revision. Thank you.

@freaky4wrld
Copy link
Member

@awlFCCamp I'm not that much experienced with terraform, but I can definitely review it if you provide me details what changes you've made. Or if @chelseybeck tells me where to start from :)

@freaky4wrld
Copy link
Member

Hey @awlFCCamp I think the idea is to make changes to the terraform-plan.yml , and add the new GHA triggers to it... the file terraform-docs.yml looks fine to me. Moreover it can only be observed more when you have your test-environment ready for it!!

Though I'm not sure how you made changes to README.md of different projects, did you use terraform-docs to do it manually ?

@angela-lee1
Copy link
Member Author

@freaky4wrld Thank you! Chelsey suggested I put changes into a separate file for testing. I will ask her if I need to revert. I made all the changes through the terraform-docs.yml file. I set up testing in my branch, can you elaborate more on "when you have your test-environment ready for it!!" Sorry, My first GitHub action, I am excited but also a bit unsure.

@freaky4wrld
Copy link
Member

@freaky4wrld Thank you! Chelsey suggested I put changes into a separate file for testing. I will ask her if I need to revert. I made all the changes through the terraform-docs.yml file. I set up testing in my branch, can you elaborate more on "when you have your test-environment ready for it!!" Sorry, My first GitHub action, I am excited but also a bit unsure.

I was asking if you have tested the GHA in your local repo, if it works fine in the local repo.... it will work here as well, this is the link to the guide in case you need it https://github.com/hackforla/website/wiki/Hack-for-LA's-GitHub-Actions

@angela-lee1
Copy link
Member Author

@freaky4wrld Thank you. It worked last week https://github.com/awlFCCamp/incubator/actions/runs/8725012627, but it failed here. I will look into it later today.

@angela-lee1 angela-lee1 marked this pull request as draft April 22, 2024 19:24
@@ -9,7 +9,7 @@ terraform {
}

provider "aws" {
region = "us-west-2"
region = "us-east-2"
Copy link
Member

Choose a reason for hiding this comment

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

curious about this change. this is to a main.tf file, not a readme...and the region should prob be us-west-2

Copy link
Member Author

Choose a reason for hiding this comment

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

I changed it to trigger the workflow. I probably should have noted that in the PR.

- name: Generate Terraform docs terraform-modules
uses: terraform-docs/[email protected]
with:
working-dir: terraform-modules
Copy link
Member

Choose a reason for hiding this comment

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

we don't want to run terraform docs in directories that don't have a tf file. this is one of those instances, but we do want to run it inside of the other directories in terraform-modules. i wonder if there's a way to refactor this a little where we get a list of the directories and then loop through it

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you, Chelsey! Great idea, will look into it.

@angela-lee1
Copy link
Member Author

will make another one from a different branch

@angela-lee1 angela-lee1 closed this May 9, 2024
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.

Automate running Terraform Docs commands in CI/CD
3 participants