-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
358 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: "ModTest: dev" | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| modtest: | ||
| if : ${{ github.event_name }} == "pull_request" | ||
| uses: HappyPathway/centralized-actions/.github/workflows/modtest.yml@main | ||
| with: | ||
| workspace: dev | ||
| workspace_repo: github-repos | ||
| workspace_branch: main | ||
| repo_clone_type: https | ||
| mod_source: repo/github | ||
|
|
||
| github_server: ${{vars.GH_SERVER}} | ||
| github_org: ${{ github.repository_owner }} | ||
| branch: ${{ github.head_ref }} | ||
| terraform_version: ${{vars.TERRAFORM_VERSION}} | ||
| terraform_api_token_name: ${{ vars.TERRAFORM_API_TOKEN_NAME }} | ||
| terraform_api: ${{vars.TERRAFORM_API}} | ||
|
|
||
| secrets: | ||
| TFE_TOKEN: ${{ secrets.TFE_TOKEN }} | ||
| GH_TOKEN: ${{ secrets.GH_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| name: "Terraform Doc" | ||
|
|
||
| on: | ||
| pull_request: | ||
|
|
||
| env: | ||
| GITHUB_OWNER: ${{ vars.GH_ORG }} | ||
| GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
| GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }} | ||
| TF_WORKSPACE: happypathway | ||
| TFE_TOKEN: ${{ secrets.TFE_TOKEN }} | ||
|
|
||
| jobs: | ||
| tf-doc: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v4 | ||
| id: checkout | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.ref }} | ||
|
|
||
| - name: Setup Terraform | ||
| uses: hashicorp/setup-terraform@v3.1.2 | ||
| with: | ||
| terraform_version: ${{ vars.terraform_version }} | ||
| cli_config_credentials_token: ${{ secrets.TFE_TOKEN }} | ||
| cli_config_credentials_hostname: ${{ vars.terraform_api }} | ||
|
|
||
| - name: terraform init | ||
| run: terraform init -upgrade | ||
|
|
||
| - name: Render terraform docs inside the README.md and push changes back to PR branch | ||
| uses: terraform-docs/gh-actions@v1.2.0 | ||
| with: | ||
| working-dir: . | ||
| output-file: README.md | ||
| output-method: inject | ||
| git-push: "true" | ||
|
|
||
| # terraform-docs/gh-actions@v1.0.0 modifies .git files with owner root:root, and the following steps fail with | ||
| # insufficient permission for adding an object to repository database .git/objects | ||
| # since the expected user is runner:docker. See https://github.com/terraform-docs/gh-actions/issues/90 | ||
| - name: Fix .git owner | ||
| run: sudo chown runner:docker -R .git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| name: "Terraform Validate" | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| env: | ||
| GITHUB_OWNER: ${{ vars.GH_ORG }} | ||
| GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
| GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }} | ||
| TF_WORKSPACE: happypathway | ||
| TFE_TOKEN: ${{ secrets.TFE_TOKEN }} | ||
|
|
||
| jobs: | ||
| setup-terraform: | ||
| outputs: | ||
| commit_sha: ${{ steps.checkout.outputs.commit }} | ||
|
|
||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v4 | ||
| id: checkout | ||
|
|
||
| - name: Setup Terraform | ||
| uses: hashicorp/setup-terraform@v3.1.2 | ||
| with: | ||
| terraform_version: ${{ vars.terraform_version }} | ||
| cli_config_credentials_token: ${{ secrets.TFE_TOKEN }} | ||
| cli_config_credentials_hostname: ${{ vars.terraform_api }} | ||
|
|
||
| - name: terraform init | ||
| run: terraform init -upgrade | ||
|
|
||
| - uses: actions/upload-artifact@master | ||
| name: Archive Configuration | ||
| if: github.ref == 'refs/heads/main' | ||
| with: | ||
| name: terraform_dir | ||
| path: .terraform | ||
| retention-days: 1 | ||
| include-hidden-files: true | ||
|
|
||
| - uses: actions/upload-artifact@master | ||
| name: Archive Lockfile | ||
| if: github.ref == 'refs/heads/main' | ||
| with: | ||
| name: terraform_lockfile | ||
| path: .terraform.lock.hcl | ||
| retention-days: 1 | ||
| include-hidden-files: true | ||
|
|
||
| terraform-validate: | ||
| needs: setup-terraform | ||
| uses: HappyPathway/centralized-actions/.github/workflows/terraform-test.yml@main | ||
| with: | ||
| terraform_version: ${{ vars.terraform_version }} | ||
| terraform_api: ${{ vars.terraform_api }} | ||
| github_username: ${{ github.actor }} | ||
| github_email: ${{ github.actor }}@roknsound.com | ||
| github_org: ${{ github.repository_owner }} | ||
| setup_terraform: true | ||
| terraform_init: false | ||
| cache: ${{ github.workspace }} | ||
| download_cache: true | ||
| commit_sha: ${{ needs.setup-terraform.outputs.commit_sha }} | ||
| secrets: | ||
| TFE_TOKEN: ${{ secrets.TFE_TOKEN }} | ||
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
| GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }} | ||
|
|
||
| gtag: | ||
| needs: terraform-validate | ||
| if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | ||
| uses: HappyPathway/centralized-actions/.github/workflows/gtag.yml@main | ||
| with: | ||
| patch: true | ||
| github_org: ${{ vars.GH_ORG }} | ||
| github_username: ${{ vars.GH_USERNAME }} | ||
| github_email: ${{ vars.GH_EMAIL }} | ||
| secrets: | ||
| GH_TOKEN: ${{ secrets.GH_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| name: "Terraform" | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| terraform: | ||
| uses: HappyPathway/centralized-actions/.github/workflows/terraform.yml@main | ||
| with: | ||
| terraform_version: 1.9.1 | ||
| terraform_api: app.terraform.io | ||
| github_username: djaboxx | ||
| github_email: git@roknsound.com | ||
| github_org: HappyPathway | ||
| secrets: | ||
| TFE_TOKEN: ${{ secrets.TFE_TOKEN }} |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| # These owners will be the default owners for everything in the repo. Unless a later match takes precedence | ||
| #### How to use this file: https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners | ||
| # These owners will be the default owners for everything in the repo. Unless a later match takes precedence | ||
| * @RoknSound-Public-Modules/terraform-reviewers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,10 @@ | ||
| # terraform-github-repo | ||
| Module to automate creation of | ||
| * github related resources | ||
| * repo | ||
| * default branch | ||
| * branch protection rule for main branch | ||
| * default codeowners and backend.tf file | ||
| * team access | ||
|
|
||
|
|
||
| [](https://github.com/HappyPathway/terraform-github-repo/actions/workflows/terraform.yaml) | ||
|
|
||
|
|
||
| [](https://github.com/HappyPathway/terraform-github-repo/actions/workflows/modtest-dev.yaml) | ||
|
|
||
| <!-- BEGIN_TF_DOCS --> | ||
| {{ .Content }} | ||
| <!-- END_TF_DOCS --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,10 @@ | ||
| # Add a collaborator to a repository | ||
| resource "github_repository_collaborator" "collaborators" { | ||
| for_each = tomap(var.collaborators) | ||
| for_each = tomap(var.collaborators) | ||
| repository = github_repository.repo.name | ||
| username = each.key | ||
| permission = each.value | ||
| # lifecycle { | ||
| # ignore_changes = [ | ||
| # permission | ||
| # ] | ||
| # } | ||
| depends_on = [ | ||
| github_repository.repo | ||
| ] | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # valid_string_concat.tftest.hcl | ||
| variables { | ||
| force_name = true | ||
| github_is_private = true | ||
| repo_org = "HappyPathway" | ||
| name = "github-repo-test" | ||
| enforce_prs = false | ||
| archive_on_destroy = false | ||
| github_org_teams = [] | ||
| admin_teams = [] | ||
| } | ||
|
|
||
| run "repo_tests" { | ||
|
|
||
| command = plan | ||
|
|
||
| assert { | ||
| condition = github_repository.repo.name == "github-repo-test" | ||
| error_message = "Github Repo name did not match expected" | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,4 +24,7 @@ resource "github_team_repository" "admin" { | |
| team_id | ||
| ] | ||
| } | ||
| } | ||
| depends_on = [ | ||
| github_repository.repo | ||
| ] | ||
| } | ||
Oops, something went wrong.