diff --git a/.github/workflows/pr-infracost.yml b/.github/workflows/pr-infracost.yml deleted file mode 100644 index 6101f39..0000000 --- a/.github/workflows/pr-infracost.yml +++ /dev/null @@ -1,187 +0,0 @@ -name: Infracost - -on: - pull_request: - paths: - - 'examples/**' - - 'tests/**' - - '**.tf' - repository_dispatch: - types: [ ok-to-test-command ] - -jobs: - # Branch-based pull request - infracost-pr-branch: - name: infracost-pr-branch - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: write - env: - TF_ROOT: ./examples - INFRACOST_ENABLE_CLOUD: false - INFRACOST_API_KEY: ${{ secrets.INFRACOST_API_KEY }} - if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository - steps: - - name: Setup Infracost - uses: infracost/actions/setup@v2 - with: - api-key: ${INFRACOST_API_KEY} - currency: EUR - - # Checkout the base branch of the pull request (e.g. main/master). - - name: Checkout base branch - uses: actions/checkout@v4 - with: - ref: '${{ github.event.pull_request.base.ref }}' - - # Generate Infracost JSON file as the baseline. - - name: Generate Infracost cost estimate baseline - run: | - infracost breakdown --path=${TF_ROOT} \ - --format=json \ - --out-file=/tmp/infracost-base.json - - # Checkout the current PR branch so we can create a diff. - - name: Checkout PR branch - uses: actions/checkout@v4 - - # Generate an Infracost diff and save it to a JSON file. - - name: Generate Infracost diff - run: | - infracost diff --path=${TF_ROOT} \ - --format=json \ - --compare-to=/tmp/infracost-base.json \ - --out-file=/tmp/infracost.json - - # Posts a comment to the PR using the 'update' behavior. - # This creates a single comment and updates it. The "quietest" option. - # The other valid behaviors are: - # delete-and-new - Delete previous comments and create a new one. - # hide-and-new - Minimize previous comments and create a new one. - # new - Create a new cost estimate comment on every push. - # See https://www.infracost.io/docs/features/cli_commands/#comment-on-pull-requests for other options. - - name: Post Infracost comment - run: | - infracost comment github --path=/tmp/infracost-base.json \ - --repo=$GITHUB_REPOSITORY \ - --github-token=${{github.token}} \ - --pull-request=${{github.event.pull_request.number}} \ - --behavior=update - - - # User with write access has commented /ok-to-test on a (fork-based) pull request - infracost-pr-fork: - name: infracost-pr-fork - runs-on: ubuntu-latest - permissions: - checks: write - contents: read - pull-requests: write - env: - TF_ROOT: ./examples - INFRACOST_ENABLE_CLOUD: false - INFRACOST_API_KEY: ${{ secrets.INFRACOST_API_KEY }} - if: | - github.event_name == 'repository_dispatch' && - github.event.client_payload.slash_command.args.named.sha != '' && - contains( - github.event.client_payload.pull_request.head.sha, - github.event.client_payload.slash_command.args.named.sha - ) - steps: - - name: Update skipped check run to in_progress - uses: actions/github-script@v6 - env: - job: ${{ github.job }} - number: ${{ github.event.client_payload.pull_request.number }} - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const { data: pull } = await github.rest.pulls.get({ - ...context.repo, - pull_number: process.env.number - }); - const ref = pull.head.sha; - const { data: checks } = await github.rest.checks.listForRef({ - ...context.repo, - ref - }); - - // Filter for the check run with a specific name and a 'skipped' conclusion - const check = checks.check_runs.filter(c => c.name === process.env.job && c.conclusion === "skipped"); - - if (check.length > 0) { - console.log(`Skipped check run found with name: ${check[0].name}`); - - // Update the check run to 'in_progress' - const { data: result } = await github.rest.checks.update({ - ...context.repo, - check_run_id: check[0].id, - status: 'in_progress', - }); - - console.log(`Successfully updated check run to 'in_progress'. Name: ${result.name}`); - return result; - } else { - console.log('No skipped check runs found with the specified name.'); - } - - - name: Setup Infracost - uses: infracost/actions/setup@v2 - with: - api-key: ${INFRACOST_API_KEY} - currency: EUR - - # Checkout the base branch of the pull request (e.g. main/master). - - name: Checkout base branch /ok-to-test checkout - uses: actions/checkout@v4 - with: - ref: '${{ github.event.pull_request.base.ref }}' - - # Generate Infracost JSON file as the baseline. - - name: Generate Infracost cost estimate baseline - run: | - infracost breakdown --path=${TF_ROOT} \ - --format=json \ - --out-file=/tmp/infracost-base.json - - # Checkout the current PR branch so we can create a diff. - - name: Checkout PR branch /ok-to-test checkout - uses: actions/checkout@v4 - with: - ref: 'refs/pull/${{ github.event.client_payload.pull_request.number }}/merge' - - # Generate an Infracost diff and save it to a JSON file. - - name: Generate Infracost diff - run: | - infracost diff --path=${TF_ROOT} \ - --format=json \ - --compare-to=/tmp/infracost-base.json \ - --out-file=/tmp/infracost.json - - # Posts a comment to the PR using the 'update' behavior. - # This creates a single comment and updates it. The "quietest" option. - # The other valid behaviors are: - # delete-and-new - Delete previous comments and create a new one. - # hide-and-new - Minimize previous comments and create a new one. - # new - Create a new cost estimate comment on every push. - # See https://www.infracost.io/docs/features/cli_commands/#comment-on-pull-requests for other options. - - name: Post Infracost comment - run: | - infracost comment github --path=/tmp/infracost-base.json \ - --repo=$GITHUB_REPOSITORY \ - --github-token=${{github.token}} \ - --pull-request=${{ github.event.client_payload.pull_request.number }} \ - --behavior=update - - - name: Update check run to completed - uses: LouisBrunner/checks-action@v1.6.2 - id: update-check-run-completed - if: ${{ always() }} - with: - sha: ${{ github.sha }} - token: ${{ secrets.GITHUB_TOKEN }} - name: ${{ github.job }} - status: completed - conclusion: ${{ job.status }} diff --git a/.github/workflows/pr-terraform.yml b/.github/workflows/pr-terraform.yml index c73d661..4453651 100644 --- a/.github/workflows/pr-terraform.yml +++ b/.github/workflows/pr-terraform.yml @@ -208,7 +208,6 @@ jobs: - name: Update Pull Request uses: actions/github-script@v6 - if: github.event_name == 'pull_request' env: PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" with: diff --git a/internal.tf b/internal.tf index 6447292..c0d68d7 100644 --- a/internal.tf +++ b/internal.tf @@ -19,6 +19,7 @@ resource "aws_subnet" "internal" { } } + # -------------------------------------------------------------------------- # Route Table # -------------------------------------------------------------------------- diff --git a/private.tf b/private.tf index 6467990..9642566 100644 --- a/private.tf +++ b/private.tf @@ -19,6 +19,7 @@ resource "aws_subnet" "private" { } } + # -------------------------------------------------------------------------- # Route Table # -------------------------------------------------------------------------- @@ -40,6 +41,7 @@ resource "aws_route_table" "private" { } } + # -------------------------------------------------------------------------- # NAT Gateway route # -------------------------------------------------------------------------- @@ -55,6 +57,7 @@ resource "aws_route" "private_nat_gateway" { } } + # -------------------------------------------------------------------------- # IPv6 Route # -------------------------------------------------------------------------- diff --git a/public.tf b/public.tf index 72570da..f66e77f 100644 --- a/public.tf +++ b/public.tf @@ -34,6 +34,7 @@ resource "aws_route_table" "public" { } } + # -------------------------------------------------------------------------- # Internet Gateway Route # --------------------------------------------------------------------------