Repository navigation
Add github workflows #6
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,10 @@ | ||
| # Set update schedule for GitHub Actions | ||
|
|
||
| version: 2 | ||
| updates: | ||
|
|
||
| - package-ecosystem: "github-actions" | ||
| directory: "/" | ||
| schedule: | ||
| # Check for updates to GitHub Actions every week | ||
| interval: "weekly" |
This file contains hidden or 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,62 @@ | ||
| name: Apply | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| # schedule: | ||
| # - cron: "17 */4 * * *" | ||
| push: | ||
| paths: | ||
| - "**/*.tf" | ||
| - "**/*.tfvars" | ||
| - "**/*.csv" | ||
| branches: | ||
| - main | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
|
|
||
| jobs: | ||
| apply: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| TF_CLI_ARGS: "-no-color" | ||
| TF_IN_AUTOMATION: "true" | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
|
|
||
| - name: Generate a token | ||
| id: generate-token | ||
| uses: actions/create-github-app-token@v3 | ||
| with: | ||
| client-id: Iv23liMoEs2Rz8MBVfAe | ||
| private-key: ${{ secrets.CONFIG_APP_SECRET }} | ||
| owner: ${{ github.repository_owner }} | ||
|
|
||
| - uses: aws-actions/configure-aws-credentials@v6 | ||
| with: | ||
| role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | ||
| aws-region: us-east-1 | ||
|
|
||
| - name: Setup OpenTofu | ||
| uses: opentofu/setup-opentofu@v2 | ||
| with: | ||
| tofu_wrapper: false | ||
|
|
||
| - name: TF init | ||
| run: | | ||
| tofu init | ||
|
|
||
| - name: TF Validate | ||
| run: | | ||
| tofu validate | ||
|
|
||
| - name: TF Apply | ||
| env: | ||
| GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} | ||
| run: | | ||
| tofu apply -concise -auto-approve |
This file contains hidden or 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,52 @@ | ||
| name: Plan | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - "**/*.tf" | ||
| - "**/*.tfvars" | ||
| - "**/*.csv" | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
|
|
||
| jobs: | ||
| plan: | ||
| # This workflow cannot run on pull requests from forked repositories | ||
| # (because we do not want to grant access to our AWS credentials to | ||
| # third-party code). | ||
| if: github.event.pull_request.head.repo.full_name == github.repository | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| TF_CLI_ARGS: "-no-color" | ||
| TF_CLI_ARGS_plan: "-lock=false" | ||
| TF_IN_AUTOMATION: "true" | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
|
|
||
| - uses: aws-actions/configure-aws-credentials@v6 | ||
| with: | ||
| role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | ||
| aws-region: us-east-1 | ||
|
|
||
| - name: Setup OpenTofu | ||
| uses: opentofu/setup-opentofu@v2 | ||
| with: | ||
| tofu_wrapper: false | ||
|
|
||
| - name: TF init | ||
| run: | | ||
| tofu init | ||
|
|
||
| - name: TF Validate | ||
| run: | | ||
| tofu validate | ||
|
|
||
| - name: TF Plan | ||
| run: | | ||
| tofu plan |
This file contains hidden or 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,23 @@ | ||
| name: Pre-commit | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| pre-commit: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| TF_CLI_ARGS: "-no-color" | ||
| TF_IN_AUTOMATION: "true" | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - uses: actions/setup-python@v7 | ||
| with: | ||
| python-version: "3.13" | ||
| - uses: opentofu/setup-opentofu@v2 | ||
| with: | ||
| tofu_wrapper: false | ||
| - uses: pre-commit/action@v3.0.1 | ||
| with: | ||
| extra_args: --all-files |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -2,4 +2,3 @@ terraform.tfstate | |
| terraform.tfstate.backup | ||
| .terraform | ||
| terraform.tfstate.*.backup | ||
| plan.* | ||
This file contains hidden or 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 @@ | ||
| repos: | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v5.0.0 | ||
| hooks: | ||
| - id: trailing-whitespace | ||
| - id: check-merge-conflict | ||
| - id: end-of-file-fixer | ||
| - id: check-added-large-files | ||
| - id: check-case-conflict | ||
| - id: check-json | ||
| - id: check-symlinks | ||
| - id: detect-private-key | ||
|
|
||
| - repo: https://github.com/adrienverge/yamllint.git | ||
| rev: v1.35.1 | ||
| hooks: | ||
| - id: yamllint | ||
| files: \.(yaml|yml)$ | ||
| types: [file, yaml] | ||
| entry: yamllint --strict | ||
|
|
||
| - repo: local | ||
| hooks: | ||
| - id: tofu-fmt | ||
| pass_filenames: false | ||
| name: tofu-fmt | ||
| language: script | ||
| files: \.tf$ | ||
| entry: ./scripts/tofu-local-hook.sh |
This file contains hidden or 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,10 @@ | ||
| extends: default | ||
| rules: | ||
| line-length: disable | ||
| document-start: disable | ||
| indentation: | ||
| indent-sequences: whatever | ||
| hyphens: | ||
| max-spaces-after: 4 | ||
| truthy: | ||
| check-keys: false |
This file contains hidden or 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,8 @@ | ||
| #!/bin/sh | ||
|
|
||
| export TF_IN_AUTOMATION=true | ||
|
|
||
| if ! tofu fmt -check -diff; then | ||
| tofu fmt | ||
| exit 1 | ||
| fi |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to approach this from a compliance perspective:
How are changes to the various CSVs managed and protected? If I'm reading it right, the new workflows only run when the Terraform files change, so I wasn't sure how CSV changes get applied and logged. (3.4.3)
How long are the Actions logs kept, and do they need to be longer for 800-171 and HIPAA? I believe GitHub caps it at 90 days for a public repo like this one. @knikolla may know offhand. (3.3.1, 3.4.3)
Since a merge to main seems to change the org right away, should there be more controls over who can make changes, such as a required review before merge? Today that's the ops-core team. Is that meant to be the everyday path, or closer to a break-glass capability? And is the intent that this list will change as we approach production? (3.4.5)
Will different environments (Open Science vs. HIPAA, for example) have different sets of approvers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Despite your protestations to the contrary, you are an excellent reviewer! That was a good finding and was an error on my part; I have updated the workflows to trigger on changes to the csv files as well.
The answer depends on what you're looking for:
Information about who authored a change is preserved in the git history. That is preserved indefinitely as part of the repository, barring someone editing history (which we can prevent through appropriate github rulesets).
Information about who approved a change is preserved in the pull request, which exists for the lifetime of the repository.
Information about who approved a change is also available in the organization audit logs for 180 days.
Once this merges, the immediately proximate pull request will be one that adds a branch protection ruleset to this repository requiring two approving reviews before a change can merge. I'm sure this list of approvers will change as we move forward.
If they do, we can address that through path-based protection rules in GitHub. This may require some restructuring of the repository (so that different classes of repository are managed in different paths).