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

Upgrade tfaction to v1 #2145

Merged
merged 6 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/apply.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
aqua_version: v2.21.0

- uses: suzuki-shunsuke/tfaction/list-targets@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/list-targets@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
id: list-targets

apply:
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
env:
AQUA_GITHUB_TOKEN: ${{ steps.aqua_installer_token.outputs.token }}

- uses: suzuki-shunsuke/tfaction/export-secrets@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/export-secrets@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
with:
secrets: ${{ toJSON(secrets) }}

Expand Down Expand Up @@ -126,9 +126,9 @@ jobs:
"test-tfaction-drift-issues"
]

- uses: suzuki-shunsuke/tfaction/setup@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/setup@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
with:
github_app_token: ${{ steps.setup_token.outputs.token }}
github_token: ${{ steps.setup_token.outputs.token }}
ssh_key: ${{ secrets.TERRAFORM_PRIVATE_MODULE_SSH_KEY }} # This isn't needed if you don't use SSH key to checkout private Terraform Modules

- name: Generate token for apply
Expand All @@ -152,9 +152,9 @@ jobs:
"test-tfaction-drift-issues"
]

- uses: suzuki-shunsuke/tfaction/apply@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/apply@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
with:
github_app_token: ${{ steps.apply_token.outputs.token }}
github_token: ${{ steps.apply_token.outputs.token }}

- name: Generate token for creating follow up pr
id: follow_up_pr_token
Expand All @@ -175,12 +175,12 @@ jobs:
"${{github.event.repository.name}}"
]

- uses: suzuki-shunsuke/tfaction/create-follow-up-pr@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/create-follow-up-pr@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
if: failure()
with:
github_app_token: ${{steps.follow_up_pr_token.outputs.token}}
github_token: ${{steps.follow_up_pr_token.outputs.token}}

- uses: suzuki-shunsuke/tfaction/update-drift-issue@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/update-drift-issue@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
if: always()
with:
status: ${{job.status}}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
with:
aqua_version: v2.21.0

- uses: suzuki-shunsuke/tfaction/release-module@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/release-module@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
with:
version: ${{ github.event.inputs.version }}
module_path: ${{ github.event.inputs.module_path }}
17 changes: 14 additions & 3 deletions .github/workflows/scaffold-module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,17 @@ on:
module_path:
description: 'module path'
required: true
template_dir:
type: choice
default: templates/module-hello
options:
- templates/module-hello
jobs:
scaffold:
runs-on: ubuntu-latest
env:
TFACTION_MODULE_PATH: ${{inputs.module_path}}
TFACTION_MODULE_TEMPLATE_DIR: ${{inputs.template_dir}}
permissions:
contents: read
steps:
Expand All @@ -36,7 +44,10 @@ jobs:
repositories: >-
["${{github.event.repository.name}}"]

- uses: suzuki-shunsuke/tfaction/scaffold-module@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/scaffold-module@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
with:
github_token: ${{ steps.generate_token.outputs.token }}
module_path: ${{ github.event.inputs.module_path }}
github_token: ${{steps.generate_token.outputs.token}}

- uses: suzuki-shunsuke/tfaction/create-scaffold-module-pr@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
with:
github_token: ${{steps.generate_token.outputs.token}}
4 changes: 2 additions & 2 deletions .github/workflows/scaffold-tfmigrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ jobs:
env:
GITHUB_TOKEN: ${{github.token}}

- uses: suzuki-shunsuke/tfaction/scaffold-tfmigrate@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/scaffold-tfmigrate@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
with:
github_app_token: ${{steps.generate_token.outputs.token}}
github_token: ${{steps.generate_token.outputs.token}}
migration_name: ${{github.event.inputs.migration_name}}
pr_number: ${{inputs.pr_number}}
6 changes: 3 additions & 3 deletions .github/workflows/scaffold-working-directory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
aqua_version: v2.21.0

- uses: suzuki-shunsuke/tfaction/scaffold-working-dir@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/scaffold-working-dir@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1

- name: Generate token
id: generate_token
Expand All @@ -38,6 +38,6 @@ jobs:
repositories: >-
["${{github.event.repository.name}}"]

- uses: suzuki-shunsuke/tfaction/create-scaffold-pr@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/create-scaffold-pr@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
with:
github_app_token: ${{ steps.generate_token.outputs.token }}
github_token: ${{ steps.generate_token.outputs.token }}
13 changes: 5 additions & 8 deletions .github/workflows/schedule-detect-drifts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,32 +82,29 @@ jobs:
env:
GITHUB_TOKEN: ${{github.token}}

- uses: suzuki-shunsuke/tfaction/set-drift-env@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/set-drift-env@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
with:
issue: ${{toJSON(matrix.issue)}}

- uses: suzuki-shunsuke/tfaction/setup@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/setup@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
with:
github_token: ${{steps.generate_token.outputs.token}}
github_app_token: ${{steps.generate_token.outputs.token}}
env:
GITHUB_TOKEN: ${{steps.generate_token.outputs.token}}

- uses: suzuki-shunsuke/tfaction/test@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/test@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
with:
github_token: ${{steps.generate_token.outputs.token}}
github_app_token: ${{steps.generate_token.outputs.token}}
env:
GITHUB_TOKEN: ${{steps.generate_token.outputs.token}}

- uses: suzuki-shunsuke/tfaction/terraform-plan@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/terraform-plan@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
with:
github_token: ${{steps.generate_token.outputs.token}}
github_app_token: ${{steps.generate_token.outputs.token}}
env:
GITHUB_TOKEN: ${{steps.generate_token.outputs.token}}

- uses: suzuki-shunsuke/tfaction/update-drift-issue@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/update-drift-issue@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
if: always()
with:
status: ${{job.status}}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync-drift-issue-description.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
permissions:
issues: write
steps:
- uses: suzuki-shunsuke/tfaction/sync-drift-issue-description@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/sync-drift-issue-description@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
10 changes: 5 additions & 5 deletions .github/workflows/wc-plan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
env:
AQUA_GITHUB_TOKEN: ${{steps.aqua_installer_token.outputs.token}}

- uses: suzuki-shunsuke/tfaction/export-secrets@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/export-secrets@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
with:
secrets: ${{toJSON(secrets)}}

Expand Down Expand Up @@ -95,13 +95,13 @@ jobs:
repositories: >-
["${{github.event.repository.name}}"]

- uses: suzuki-shunsuke/tfaction/setup@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/setup@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
with:
github_token: ${{steps.generate_token.outputs.token}}
env:
GITHUB_TOKEN: ${{steps.generate_token.outputs.token}} # For GitHub Provider

- uses: suzuki-shunsuke/tfaction/get-target-config@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/get-target-config@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
id: target-config

- name: Generate token (pull request write)
Expand Down Expand Up @@ -131,13 +131,13 @@ jobs:
- name: registry.terraform.io/integrations/github
GITHUB_TOKEN: ${{steps.pull_request_token.outputs.token}} # For github-comment

- uses: suzuki-shunsuke/tfaction/test@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/test@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
with:
github_token: ${{steps.generate_token.outputs.token}}
env:
GITHUB_TOKEN: ${{steps.generate_token.outputs.token}} # For GitHub Provider and reviewdog and github-comment

- uses: suzuki-shunsuke/tfaction/plan@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/plan@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
with:
github_token: ${{steps.generate_token.outputs.token}}
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wc-setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
env:
AQUA_GITHUB_TOKEN: ${{steps.generate_token.outputs.token}}

- uses: suzuki-shunsuke/tfaction/list-targets@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/list-targets@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
id: list-targets
env:
GITHUB_TOKEN: ${{steps.generate_token.outputs.token}}
2 changes: 1 addition & 1 deletion .github/workflows/wc-test-module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
env:
AQUA_GITHUB_TOKEN: ${{github.token}}

- uses: suzuki-shunsuke/tfaction/test-module@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3
- uses: suzuki-shunsuke/tfaction/test-module@e14be0997deaf47227d65f02dcff960fd1dcc862 # v1.0.0-1
with:
github_token: ${{steps.generate_token.outputs.token}}
env:
Expand Down
4 changes: 4 additions & 0 deletions templates/module-hello/.terraform-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# https://terraform-docs.io/
formatter: markdown
header-from: docs/header.md
footer-from: docs/footer.md
40 changes: 40 additions & 0 deletions templates/module-hello/.tflint.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# https://github.com/terraform-linters/tflint/tree/master/docs/rules
rule "terraform_deprecated_index" {
enabled = true
}

rule "terraform_unused_declarations" {
enabled = true
}

rule "terraform_comment_syntax" {
enabled = true
}

rule "terraform_documented_outputs" {
enabled = true
}

rule "terraform_documented_variables" {
enabled = true
}

rule "terraform_typed_variables" {
enabled = true
}

rule "terraform_naming_convention" {
enabled = true
}

rule "terraform_required_version" {
enabled = true
}

rule "terraform_required_providers" {
enabled = true
}

rule "terraform_standard_module_structure" {
enabled = true
}
54 changes: 54 additions & 0 deletions templates/module-hello/aqua/aqua-checksums.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"checksums": [
{
"id": "github_release/github.com/aquasecurity/trivy/v0.46.0/trivy_0.46.0_Linux-64bit.tar.gz",
"checksum": "D26B6A5B4445C4A7F99E104A8C47579AEC150023FB927D55F8622E760C171AF2",
"algorithm": "sha256"
},
{
"id": "github_release/github.com/aquasecurity/trivy/v0.46.0/trivy_0.46.0_Linux-ARM64.tar.gz",
"checksum": "6AF0383E99B579203BBA3286C780BEBFC49A1EFB66739BC6FEFA3B0A779499B4",
"algorithm": "sha256"
},
{
"id": "github_release/github.com/aquasecurity/trivy/v0.46.0/trivy_0.46.0_macOS-64bit.tar.gz",
"checksum": "C2E498941FE8914C3B364AE982ABB1DEA362AF0DEF7E6F15175166B3CFFF5947",
"algorithm": "sha256"
},
{
"id": "github_release/github.com/aquasecurity/trivy/v0.46.0/trivy_0.46.0_macOS-ARM64.tar.gz",
"checksum": "B5A8F853A132B18BFF6ABA3E20604F81DE724DEFCCD188B53FFF1ED55BE00918",
"algorithm": "sha256"
},
{
"id": "github_release/github.com/terraform-linters/tflint/v0.48.0/tflint_darwin_amd64.zip",
"checksum": "8F491F42A07152B27D7C3599FAF24EB839A202F5C58EF735740303AE3CAD51FA",
"algorithm": "sha256"
},
{
"id": "github_release/github.com/terraform-linters/tflint/v0.48.0/tflint_darwin_arm64.zip",
"checksum": "88BBA0BD1CA4012F836D14093E5D18CF0D6633C7FEA82404382FDA70C99753A0",
"algorithm": "sha256"
},
{
"id": "github_release/github.com/terraform-linters/tflint/v0.48.0/tflint_linux_amd64.zip",
"checksum": "13C7947963C4DC4F0AA9E0CB7A0854367A425162A508BC7517D1CBCBEF822F3C",
"algorithm": "sha256"
},
{
"id": "github_release/github.com/terraform-linters/tflint/v0.48.0/tflint_linux_arm64.zip",
"checksum": "EF4E07EF95E5F2779DF0ED43E62364855DAFB92B938CF62F08C64016DE2756B0",
"algorithm": "sha256"
},
{
"id": "github_release/github.com/terraform-linters/tflint/v0.48.0/tflint_windows_amd64.zip",
"checksum": "1EFAB7EA19E8ADB73CAE770E5EDABAE44A5CEBD63BAF203A5D3270948DB55648",
"algorithm": "sha256"
},
{
"id": "registries/github_content/github.com/aquaproj/aqua-registry/v4.71.0/registry.yaml",
"checksum": "A1C0A6710A70FA6C8CA737392B1E4455B9D25C42650631F8713B7E45680B74456892B4EA2EB71AAF4EB272DC5B0B73C226A54E60BA4561B12D0FFE47A5DDC78A",
"algorithm": "sha512"
}
]
}
13 changes: 13 additions & 0 deletions templates/module-hello/aqua/aqua.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
# aqua - Declarative CLI Version Manager
# https://aquaproj.github.io/
checksum:
enabled: true
require_checksum: true
# supported_envs:
# - all
registries:
- type: standard
ref: v4.71.0 # renovate: depName=aquaproj/aqua-registry
packages:
- import: imports/*.yaml
2 changes: 2 additions & 0 deletions templates/module-hello/aqua/imports/tflint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages:
- name: terraform-linters/tflint@v0.48.0
2 changes: 2 additions & 0 deletions templates/module-hello/aqua/imports/trivy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages:
- name: aquasecurity/trivy@v0.46.0
4 changes: 4 additions & 0 deletions templates/module-hello/docs/footer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

---

This document is generated by [terraform-docs](https://terraform-docs.io/)
11 changes: 11 additions & 0 deletions templates/module-hello/docs/header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# %%MODULE_NAME%%

[Versions](https://github.com/%%GITHUB_REPOSITORY%%/releases?q=%%MODULE_PATH%%)

## Example

```tf
module "foo" {
source = "github.com/%%GITHUB_REPOSITORY%%//%%MODULE_PATH%%?ref=%%REF%%"
}
```
3 changes: 3 additions & 0 deletions templates/module-hello/locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
locals {
foo = 1
}
3 changes: 3 additions & 0 deletions templates/module-hello/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resource "null_resource" "foo" {
count = max(local.foo, var.hello)
}
4 changes: 4 additions & 0 deletions templates/module-hello/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "hello" {
description = "hello"
value = "hello"
}
5 changes: 5 additions & 0 deletions templates/module-hello/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
variable "hello" {
description = "hello"
type = number
default = 1
}
9 changes: 9 additions & 0 deletions templates/module-hello/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
required_version = ">= 1.0"
required_providers {
null = {
source = "hashicorp/null"
version = "3.2.2"
}
}
}