From cc3184ab0efa28366d3c7f2266362bb5c32c979e Mon Sep 17 00:00:00 2001 From: Cyb3r-Jak3 Date: Thu, 26 Jun 2025 18:06:24 -0400 Subject: [PATCH] Set status attribute of token --- .github/workflows/terraform.yml | 18 +++++++++--------- README.md | 1 + main.tf | 1 + variables.tf | 10 ++++++++++ 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index 263fbf8..c4e4991 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -9,17 +9,17 @@ jobs: Linting: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - uses: hashicorp/setup-terraform@v3 + - uses: hashicorp/setup-terraform@v3 - - name: Terraform Docs - run: | - docker run --rm --volume "$(pwd):/terraform-docs" -u $(id -u) quay.io/terraform-docs/terraform-docs:0.19.0 --output-check /terraform-docs - - - name: Terraform Format Check - run: | - terraform fmt -check -recursive + - name: Terraform Docs + run: | + docker run --rm --volume "$(pwd):/terraform-docs" -u $(id -u) quay.io/terraform-docs/terraform-docs:0.20.0 --output-check /terraform-docs + + - name: Terraform Format Check + run: | + terraform fmt -check -recursive Terraform: runs-on: ubuntu-latest diff --git a/README.md b/README.md index 1b0c5a6..a9d03b1 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ No modules. | [expires\_on](#input\_expires\_on) | The expiration time on or after which the token MUST NOT be accepted for processing. If not specified, the token will not expire. | `string` | `""` | no | | [jurisdiction](#input\_jurisdiction) | Jurisdiction of R2 buckets | `string` | `"default"` | no | | [not\_before](#input\_not\_before) | The time before which the token MUST NOT be accepted for processing. If not specified, the token will be valid immediately. | `string` | `""` | no | +| [status](#input\_status) | Status of the API token. Can be 'active' or 'disabled'. Defaults to 'active'. | `string` | `"active"` | no | | [token\_name](#input\_token\_name) | Name of the API token.
If none given then the fomart is: `R2---` | `string` | `""` | no | ## Outputs diff --git a/main.tf b/main.tf index 7e2ef1b..eef19ac 100644 --- a/main.tf +++ b/main.tf @@ -36,4 +36,5 @@ resource "cloudflare_api_token" "token" { not_in = var.condition_ip_not_in } } + status = var.status } \ No newline at end of file diff --git a/variables.tf b/variables.tf index 4ce3d15..968540c 100644 --- a/variables.tf +++ b/variables.tf @@ -55,4 +55,14 @@ variable "condition_ip_not_in" { description = "List of IP addresses or CIDR notation where the token should not be used from." type = list(string) default = [] +} + +variable "status" { + description = "Status of the API token. Can be 'active' or 'disabled'. Defaults to 'active'." + type = string + default = "active" + validation { + condition = contains(["active", "disabled"], var.status) + error_message = "Status must be either 'active' or 'disabled'." + } } \ No newline at end of file