From d2cbea3078a5f4563f1cb805ee195c84678bc071 Mon Sep 17 00:00:00 2001 From: Omri Attal Date: Thu, 27 Nov 2025 14:15:05 +0200 Subject: [PATCH 1/3] Update all to version 1.24 --- .github/workflows/lint.yml | 4 ++-- .github/workflows/release.yml | 15 ++++++--------- .golangci.yml | 2 +- README.md | 24 +++++++++++++++++------- go.mod | 2 ++ 5 files changed, 28 insertions(+), 19 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index dab0aab..1eba09f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: 1.24 - uses: actions/checkout@v3 - name: golangci-lint uses: golangci/golangci-lint-action@v3.1.0 @@ -38,4 +38,4 @@ jobs: # skip-pkg-cache: true # Optional: if set to true then the action don't cache or restore ~/.cache/go-build. - # skip-build-cache: true \ No newline at end of file + # skip-build-cache: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 18af970..ed12584 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,26 +2,23 @@ name: release on: push: tags: - - 'v*' + - "v*" jobs: goreleaser: permissions: write-all runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v3 - - - name: Set up Go + - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.18 - - - name: Run GoReleaser + go-version: 1.24 + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6 with: version: "~> v2" args: release --clean env: # GitHub sets this automatically - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.golangci.yml b/.golangci.yml index 8302ed0..ccdf568 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -51,4 +51,4 @@ linters-settings: run: timeout: 25m - go: "1.18" + go: "1.24" diff --git a/README.md b/README.md index 34f4a6a..5645c07 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,19 @@ # Infinity Next Terraform CLI + The project provides a command line interface for using the API of Infinity Next -## Generating an API Key *(Required)* +## Generating an API Key _(Required)_ + If already have an API key from setting up [terraform-provider-infinity-next](https://github.com/CheckPointSW/terraform-provider-infinity-next) then you can skip this section. -1. Go to https://portal.checkpoint.com, navigate to *Global Settings -> API Keys* -2. Create a new API key and select *Infinity Policy* as the service, with *Admin* role, we recommend that you specify a meaningful comment for the key so you could identify them later and avoid mistakes. +1. Go to https://portal.checkpoint.com, navigate to _Global Settings -> API Keys_ + +2. Create a new API key and select _Infinity Policy_ as the service, with _Admin_ role, we recommend that you specify a meaningful comment for the key so you could identify them later and avoid mistakes. -3. Store the *Client ID* and *Secret Key* in a secure location, and note there's no way to view the secret key afterward. +3. Store the _Client ID_ and _Secret Key_ in a secure location, and note there's no way to view the secret key afterward. ## Usage + Download and install the CLI found in the [latest release](https://github.com/CheckPointSW/infinity-next-terraform-cli/releases/latest) You could run `inext help` and get all available options and commands. @@ -17,8 +21,8 @@ You could run `inext help` and get all available options and commands. The CLI requires the same credentials used to configure the provider, there are 3 options to pass these credentials to the CLI: 1. Set the environment variables: `INEXT_REGION`, `INEXT_CLIENT_ID` and `INEXT_ACCESS_KEY` and run `inext `, this is more comfortable for usage right after `terraform apply` since it uses the same environment variables. - 2. Set credentials using flags `--client-id` (shorthand `-c`) and `--access-key` (shorthand `-k`) + ``` inext publish -c $INEXT_CLIENT_ID -k $INEXT_ACCESS_KEY -r us ``` @@ -32,19 +36,25 @@ The CLI requires the same credentials used to configure the provider, there are Run `inext ` and the CLI would be configured using `~/.inext.yaml` by default, can be set using `inext --config ` ## Example + ``` inext publish && inext enforce ``` ## Build + ### Requirements -* Go 1.18+ + +- Go 1.24+ To build the CLI run: + ``` go build -o inext ``` + You could then install it by running: + ``` cp inext /usr/local/bin -``` \ No newline at end of file +``` diff --git a/go.mod b/go.mod index 4ef6975..4104c41 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,8 @@ module github.com/CheckPointSW/infinity-next-terraform-cli go 1.24.0 +toolchain go1.24.2 + require ( github.com/golang-jwt/jwt/v5 v5.3.0 github.com/spf13/cobra v1.10.1 From 9dafed92b16e512e6d3f437640d7ab8547a4db0a Mon Sep 17 00:00:00 2001 From: Omri Attal Date: Thu, 27 Nov 2025 14:19:25 +0200 Subject: [PATCH 2/3] Update all to version 1.24 --- .github/workflows/lint.yml | 6 +++--- .github/workflows/release.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1eba09f..441876b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,10 +11,10 @@ jobs: name: lint runs-on: ubuntu-latest steps: - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v5 with: - go-version: 1.24 - - uses: actions/checkout@v3 + go-version: "1.24" + - uses: actions/checkout@v4 - name: golangci-lint uses: golangci/golangci-lint-action@v3.1.0 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ed12584..59170da 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,11 +9,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: - go-version: 1.24 + go-version: "1.24" - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6 with: From afe408bacba362f795cce573c69caf2a4645aa78 Mon Sep 17 00:00:00 2001 From: Omri Attal Date: Tue, 3 Mar 2026 19:08:05 +0200 Subject: [PATCH 3/3] Add support for AU, IN, CA, and AE regions --- cmd/discard.go | 10 +++++++++- cmd/enforce.go | 10 +++++++++- cmd/publish.go | 10 +++++++++- cmd/root.go | 4 ++++ 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/cmd/discard.go b/cmd/discard.go index be74243..a832be6 100644 --- a/cmd/discard.go +++ b/cmd/discard.go @@ -58,8 +58,16 @@ var discardCmd = &cobra.Command{ URL = EUCIURL case "us": URL = USCIURL + case "au": + URL = AUCIURL + case "in": + URL = INCIURL + case "ca": + URL = CACIURL + case "ae": + URL = AECIURL default: - fmt.Printf("Invalid region %s, expected eu or us\n", region) + fmt.Printf("Invalid region %s, expected eu, us, au, in, ca or ae\n", region) os.Exit(1) } diff --git a/cmd/enforce.go b/cmd/enforce.go index 5595da6..9463b76 100644 --- a/cmd/enforce.go +++ b/cmd/enforce.go @@ -62,8 +62,16 @@ var enforceCmd = &cobra.Command{ URL = EUCIURL case "us": URL = USCIURL + case "au": + URL = AUCIURL + case "in": + URL = INCIURL + case "ca": + URL = CACIURL + case "ae": + URL = AECIURL default: - fmt.Printf("Invalid region %s, expected eu or us\n", region) + fmt.Printf("Invalid region %s, expected eu, us, au, in, ca or ae\n", region) os.Exit(1) } diff --git a/cmd/publish.go b/cmd/publish.go index 3a5845f..653c84a 100644 --- a/cmd/publish.go +++ b/cmd/publish.go @@ -67,8 +67,16 @@ var publishCmd = &cobra.Command{ URL = EUCIURL case "us": URL = USCIURL + case "au": + URL = AUCIURL + case "in": + URL = INCIURL + case "ca": + URL = CACIURL + case "ae": + URL = AECIURL default: - fmt.Printf("Invalid region %s, expected eu or us\n", region) + fmt.Printf("Invalid region %s, expected eu, us, au, in, ca or ae\n", region) os.Exit(1) } diff --git a/cmd/root.go b/cmd/root.go index 32e71a9..65b9648 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -11,6 +11,10 @@ import ( const ( EUCIURL = "https://cloudinfra-gw.portal.checkpoint.com" USCIURL = "https://cloudinfra-gw-us.portal.checkpoint.com" + AUCIURL = "https://cloudinfra-gw.ap.portal.checkpoint.com" + INCIURL = "https://cloudinfra-gw.in.portal.checkpoint.com" + AECIURL = "https://cloudinfra-gw.ae.portal.checkpoint.com" + CACIURL = "https://cloudinfra-gw.ca.portal.checkpoint.com" CIAuthPath = "/auth/external" appIDClaim = "appId" wafAppID = "64488de9-f813-42a7-93e7-f3fe25dd9011"