From 4c9d099b13e079ebe7db8ea56950247cd5bf26c3 Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 10:07:30 +0200 Subject: [PATCH 01/22] update node version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf10e60..e3f85e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ on: - main env: - NODE_VERSION: 14 + NODE_VERSION: 22.6.0 GO_VERSION: 1.22.0 jobs: From f363e0fa08352429e6deceacc82372b72337b4ae Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 10:10:06 +0200 Subject: [PATCH 02/22] add pr to main trigger --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3f85e9..bd7badb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,8 @@ on: branches: - feat/** - fix/** - - hotfix/** + - hotfix/**' + - main push: branches: - main From 3def8f33eb9e3920f297e9b0d1048acc4197e19b Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 10:17:38 +0200 Subject: [PATCH 03/22] test hardcoded node version --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd7badb..4907996 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,6 @@ on: - feat/** - fix/** - hotfix/**' - - main push: branches: - main @@ -24,7 +23,7 @@ jobs: - name: Set up Node uses: actions/setup-node@v2 with: - node-version: $NODE_VERSION + node-version: '22.6.0' - name: Install markdownlint-cli run: npm install -g markdownlint-cli - name: Run markdownlint From a0f67fe9ece5392ef6bf650f57c9bd75b306f8b7 Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 10:18:46 +0200 Subject: [PATCH 04/22] test hardcoded node version --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4907996..2422e33 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,7 @@ on: - feat/** - fix/** - hotfix/**' + - main push: branches: - main From 70b8e8d7105f963a2605dd21f521769753a7bd56 Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 10:24:43 +0200 Subject: [PATCH 05/22] set env var versions --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2422e33..834fb93 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: branches: - feat/** - fix/** - - hotfix/**' + - hotfix/** - main push: branches: @@ -24,7 +24,7 @@ jobs: - name: Set up Node uses: actions/setup-node@v2 with: - node-version: '22.6.0' + node-version: ${{ env.NODE_VERSION }} - name: Install markdownlint-cli run: npm install -g markdownlint-cli - name: Run markdownlint @@ -38,7 +38,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: $GO_VERSION + go-version: ${{ env.GO_VERSION }} - name: Run go mod tidy run: go mod tidy @@ -50,7 +50,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: $GO_VERSION + go-version: ${{ env.GO_VERSION }} - name: Install go-tools run: go install honnef.co/go/tools/cmd/staticcheck@latest - name: Run go-tools @@ -64,6 +64,6 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: $GO_VERSION + go-version: ${{ env.GO_VERSION }} - name: Run tests run: go test ./... -v From e80cae0fbb9ebb214292a40a46a7da801b24fd2e Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 11:30:00 +0200 Subject: [PATCH 06/22] markdownlint config --- .markdownlint.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .markdownlint.yaml diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 0000000..33c681f --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,19 @@ +# for more details on the markdownlint configuration file, see: +# https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml + +# default state for all rules +default: true + +# MD013/line-length : Line length : https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md013.md +MD013: + line_length: 120 + +# MD022/blanks-around-headings : Headings should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md022.md +MD022: + lines_above: 0 + +# MD033/no-inline-html : Inline HTML : https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md033.md +MD033: + allowed_elements: + - img + - a From 731aba81b4493f9384750c69d9d97ac5db94f365 Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 11:30:34 +0200 Subject: [PATCH 07/22] md lint fix --- README.md | 2 +- docs/data-sources/cloud_products.md | 8 +++++--- docs/index.md | 1 - docs/resources/cloud_node.md | 6 ++---- docs/resources/workspace.md | 1 - 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 38cd570..1a45220 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # Terraform Provider Autonomi -The autonomi provider enables Terraform to manage autonomi resources. \ No newline at end of file +The autonomi provider enables Terraform to manage autonomi resources. diff --git a/docs/data-sources/cloud_products.md b/docs/data-sources/cloud_products.md index ceea6b8..d1cfca7 100644 --- a/docs/data-sources/cloud_products.md +++ b/docs/data-sources/cloud_products.md @@ -33,8 +33,11 @@ data "autonomi_cloud_products" "clouds" { ### Read-Only -- `facet_distribution` (Attributes) The **facet_distribution** attribute provides an overview of the distribution of various facets within the cloud products returned by the Meilisearch query. This attribute allows you to analyze the frequency of different categories or attributes in the search results. (see [below for nested schema](#nestedatt--facet_distribution)) -- `hits` (Attributes List) The **hits** attribute contains the list of cloud products returned by the Meilisearch query. Each hit represents a cloud product that matches the specified search criteria. (see [below for nested schema](#nestedatt--hits)) +- `facet_distribution` (Attributes) The **facet_distribution** attribute provides an overview of the distribution of + various facets within the cloud products returned by the Meilisearch query. This attribute allows you to analyze the + frequency of different categories or attributes in the search results. (see [below for nested schema](#nestedatt--facet_distribution)) +- `hits` (Attributes List) The **hits** attribute contains the list of cloud products returned by the Meilisearch query. + Each hit represents a cloud product that matches the specified search criteria. (see [below for nested schema](#nestedatt--hits)) ### Nested Schema for `facet_distribution` @@ -48,7 +51,6 @@ Read-Only: - `location` (Map of Number) - `provider` (Map of Number) - ### Nested Schema for `hits` diff --git a/docs/index.md b/docs/index.md index 89ffe17..483646f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -18,7 +18,6 @@ provider "autonomi" { } ``` - ## Schema diff --git a/docs/resources/cloud_node.md b/docs/resources/cloud_node.md index 36290a7..5c23b92 100644 --- a/docs/resources/cloud_node.md +++ b/docs/resources/cloud_node.md @@ -23,8 +23,6 @@ resource "autonomi_cloud_node" "cloud_node" { } ``` - - ## Schema @@ -37,7 +35,8 @@ resource "autonomi_cloud_node" "cloud_node" { ### Read-Only -- `administrative_state` (String) Administrative state of the cloud node [creation_pending, creation_proceed, creation_error, deployed, delete_pending, delete_proceed, delete_error] +- `administrative_state` (String) Administrative state of the cloud node [creation_pending, creation_proceed, + creation_error, deployed, delete_pending, delete_proceed, delete_error] - `connection_id` (String) Connection ID created and returned by the cloud provider - `created_at` (String) Creation date of the cloud node - `dxcon_id` (String) Dxcon ID created and returned by AWS @@ -53,7 +52,6 @@ Required: - `sku` (String) ID of the product - ### Nested Schema for `provider_config` diff --git a/docs/resources/workspace.md b/docs/resources/workspace.md index a8400e8..510cd74 100644 --- a/docs/resources/workspace.md +++ b/docs/resources/workspace.md @@ -17,7 +17,6 @@ resource "autonomi_workspace" { } ``` - ## Schema From f7dcfa975a5f461e40710c4897ee1eb29ac4ca03 Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 11:52:07 +0200 Subject: [PATCH 08/22] update action versions --- .github/workflows/ci.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 834fb93..d02825d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,9 +20,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Node - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} - name: Install markdownlint-cli @@ -34,35 +34,35 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - name: Run go mod tidy run: go mod tidy - go-lint: + golangci-lint: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - - name: Install go-tools - run: go install honnef.co/go/tools/cmd/staticcheck@latest - - name: Run go-tools - run: staticcheck ./... + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.59 go-test: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - name: Run tests From 15a9bab82451da1ae0074585585b80b52530453a Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 14:05:00 +0200 Subject: [PATCH 09/22] add golangci-lint --- .github/workflows/ci.yml | 4 +++- .golangci.yml | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .golangci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d02825d..94afeb9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,7 @@ on: env: NODE_VERSION: 22.6.0 GO_VERSION: 1.22.0 + GOLANGCI_LINT_VERSION: v1.59 jobs: markdown-lint: @@ -54,7 +55,8 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: - version: v1.59 + version: ${{ env.GO_VERSION }} + args: './...' go-test: runs-on: ubuntu-latest diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..3ed0fd9 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,6 @@ +# for more details on golangci-lint configuration file, see: +# https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml + +# options for analysis running +run: + tests: true From 5a813d208d53f24be3238ac212efff288dbf334d Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 14:08:47 +0200 Subject: [PATCH 10/22] fix golang version --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 94afeb9..dd2da26 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ on: env: NODE_VERSION: 22.6.0 - GO_VERSION: 1.22.0 + GO_VERSION: v1.22.0 GOLANGCI_LINT_VERSION: v1.59 jobs: @@ -55,7 +55,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: - version: ${{ env.GO_VERSION }} + version: ${{ env.GOLANGCI_LINT_VERSION }} args: './...' go-test: From 4f7c74d8e81803206f49cf0b33cf83514fbb8787 Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 15:00:07 +0200 Subject: [PATCH 11/22] setup gitconfig for private modules --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd2da26..5ce6360 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,7 @@ env: NODE_VERSION: 22.6.0 GO_VERSION: v1.22.0 GOLANGCI_LINT_VERSION: v1.59 + GOPRIVATE: github.com/intercloud jobs: markdown-lint: @@ -40,6 +41,11 @@ jobs: uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} + - name: Set up git to download intercloud private modules + run: git config --global url."https://${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/" + - name: Print git config + run: git config --get-regexp url + continue-on-error: true - name: Run go mod tidy run: go mod tidy From 968f2c9794bc9826b21be34dfba18a967bb1dcbb Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 16:29:13 +0200 Subject: [PATCH 12/22] set org token --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ce6360..bb4bf3e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} - name: Set up git to download intercloud private modules - run: git config --global url."https://${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/" + run: git config --global url."https://${{ secrets.ORG_GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/" - name: Print git config run: git config --get-regexp url continue-on-error: true From 7f3f334aa2bdd934cc6ee53f673a05fa6748f538 Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 16:36:08 +0200 Subject: [PATCH 13/22] set org token --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb4bf3e..ae34032 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,6 +49,7 @@ jobs: - name: Run go mod tidy run: go mod tidy + golangci-lint: runs-on: ubuntu-latest steps: From 7822e0c9176c32c0163163587533fa2afcd17356 Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 16:58:12 +0200 Subject: [PATCH 14/22] add go mod tidy to local action --- .github/actions/go-mod-tidy/action.yml | 14 ++++++++++++++ .github/workflows/ci.yml | 16 ++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 .github/actions/go-mod-tidy/action.yml diff --git a/.github/actions/go-mod-tidy/action.yml b/.github/actions/go-mod-tidy/action.yml new file mode 100644 index 0000000..acc6278 --- /dev/null +++ b/.github/actions/go-mod-tidy/action.yml @@ -0,0 +1,14 @@ +name: go mod tidy +description: set up gitconfig with an org PAT and run go mod tidy +inputs: + ORG_GITHUB_TOKEN: + description: 'organizational personal access token with read private repositories permission' + required: true + +runs: + using: composite + steps: + - name: Set up git to download intercloud private modules + run: git config --global url."https://${{ secrets.ORG_GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/" + - name: Run go mod tidy + run: go mod tidy diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae34032..9df8415 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,17 +41,15 @@ jobs: uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - - name: Set up git to download intercloud private modules - run: git config --global url."https://${{ secrets.ORG_GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/" - - name: Print git config - run: git config --get-regexp url - continue-on-error: true - - name: Run go mod tidy - run: go mod tidy - + - name: go mod tidy + uses: ./.github/actions/go-mod-tidy + with: + ORG_GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_TOKEN }} golangci-lint: runs-on: ubuntu-latest + needs: + - go-mod-tidy steps: - name: Checkout code uses: actions/checkout@v4 @@ -67,6 +65,8 @@ jobs: go-test: runs-on: ubuntu-latest + needs: + - go-mod-tidy steps: - name: Checkout code uses: actions/checkout@v4 From 1882066a89da9718efc14ca9bfbe76e371157575 Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 17:00:19 +0200 Subject: [PATCH 15/22] fix action input --- .github/actions/go-mod-tidy/action.yml | 2 +- .github/workflows/ci.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/go-mod-tidy/action.yml b/.github/actions/go-mod-tidy/action.yml index acc6278..a37a074 100644 --- a/.github/actions/go-mod-tidy/action.yml +++ b/.github/actions/go-mod-tidy/action.yml @@ -9,6 +9,6 @@ runs: using: composite steps: - name: Set up git to download intercloud private modules - run: git config --global url."https://${{ secrets.ORG_GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/" + run: git config --global url."https://${{ inputs.ORG_GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/" - name: Run go mod tidy run: go mod tidy diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9df8415..c05ebaf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,7 @@ jobs: with: ORG_GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_TOKEN }} + golangci-lint: runs-on: ubuntu-latest needs: From 19c3e93835fa6e15d2e48732fbd12fd21feb4575 Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 17:03:17 +0200 Subject: [PATCH 16/22] fix action shell --- .github/actions/go-mod-tidy/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/go-mod-tidy/action.yml b/.github/actions/go-mod-tidy/action.yml index a37a074..dc2993e 100644 --- a/.github/actions/go-mod-tidy/action.yml +++ b/.github/actions/go-mod-tidy/action.yml @@ -10,5 +10,7 @@ runs: steps: - name: Set up git to download intercloud private modules run: git config --global url."https://${{ inputs.ORG_GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/" + shell: bash - name: Run go mod tidy run: go mod tidy + shell: bash From 498b5be343c6f5e4324cd1eae359f4b2b1c67a26 Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 17:14:03 +0200 Subject: [PATCH 17/22] more generic action --- .../action.yml | 9 +++------ .github/workflows/ci.yml | 19 ++++++++++++++++--- 2 files changed, 19 insertions(+), 9 deletions(-) rename .github/actions/{go-mod-tidy => setup-gitconfig}/action.yml (59%) diff --git a/.github/actions/go-mod-tidy/action.yml b/.github/actions/setup-gitconfig/action.yml similarity index 59% rename from .github/actions/go-mod-tidy/action.yml rename to .github/actions/setup-gitconfig/action.yml index dc2993e..30d9e26 100644 --- a/.github/actions/go-mod-tidy/action.yml +++ b/.github/actions/setup-gitconfig/action.yml @@ -1,5 +1,5 @@ -name: go mod tidy -description: set up gitconfig with an org PAT and run go mod tidy +name: setup gitconfig +description: set up gitconfig with an org PAT to clone private repos inputs: ORG_GITHUB_TOKEN: description: 'organizational personal access token with read private repositories permission' @@ -8,9 +8,6 @@ inputs: runs: using: composite steps: - - name: Set up git to download intercloud private modules + - name: Set up gitconfig to clone github private repositories run: git config --global url."https://${{ inputs.ORG_GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/" shell: bash - - name: Run go mod tidy - run: go mod tidy - shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c05ebaf..6a20347 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,11 +41,12 @@ jobs: uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - - name: go mod tidy - uses: ./.github/actions/go-mod-tidy + - name: Set up gitconfig + uses: ./terraform-provider-autonomi/.github/actions/setup-gitconfig with: ORG_GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_TOKEN }} - + - name: Run go mod tidy + run: go mod tidy golangci-lint: runs-on: ubuntu-latest @@ -77,3 +78,15 @@ jobs: go-version: ${{ env.GO_VERSION }} - name: Run tests run: go test ./... -v + +# terraform-validate: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout code +# uses: actions/checkout@v4 +# - name: Set up Terraform +# uses: hashicorp/setup-terraform@v1 +# with: +# terraform_version: 1.0.0 +# - name: Terraform validate +# run: terraform validate \ No newline at end of file From 6734044972d2f507850e65fe6c7c566249677a05 Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 17:15:58 +0200 Subject: [PATCH 18/22] fix action path --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a20347..4e7af93 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} - name: Set up gitconfig - uses: ./terraform-provider-autonomi/.github/actions/setup-gitconfig + uses: ./.github/actions/setup-gitconfig with: ORG_GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_TOKEN }} - name: Run go mod tidy From 2f0db2923a0b59dc420f6f777f8ed52957dda5ba Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 17:48:12 +0200 Subject: [PATCH 19/22] add tf auto vars --- .github/workflows/{ci.yml => go-ci.yml} | 14 +------------- .gitignore | 1 + examples/autonomi/terraform.auto.tfvars | 8 ++++++++ 3 files changed, 10 insertions(+), 13 deletions(-) rename .github/workflows/{ci.yml => go-ci.yml} (83%) create mode 100644 examples/autonomi/terraform.auto.tfvars diff --git a/.github/workflows/ci.yml b/.github/workflows/go-ci.yml similarity index 83% rename from .github/workflows/ci.yml rename to .github/workflows/go-ci.yml index 4e7af93..9332d13 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/go-ci.yml @@ -1,4 +1,4 @@ -name: continuous-integration +name: go-continuous-integration on: pull_request: @@ -78,15 +78,3 @@ jobs: go-version: ${{ env.GO_VERSION }} - name: Run tests run: go test ./... -v - -# terraform-validate: -# runs-on: ubuntu-latest -# steps: -# - name: Checkout code -# uses: actions/checkout@v4 -# - name: Set up Terraform -# uses: hashicorp/setup-terraform@v1 -# with: -# terraform_version: 1.0.0 -# - name: Terraform validate -# run: terraform validate \ No newline at end of file diff --git a/.gitignore b/.gitignore index adb4507..35e629d 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ go.work.sum # Terraform local file *.backup *.tfvars +!examples/autonomi/terraform.auto.tfvars *.tfstate examples/autonomi/main.tf diff --git a/examples/autonomi/terraform.auto.tfvars b/examples/autonomi/terraform.auto.tfvars new file mode 100644 index 0000000..d44b7f5 --- /dev/null +++ b/examples/autonomi/terraform.auto.tfvars @@ -0,0 +1,8 @@ +csp_name = "AWS" +csp_city = "pa" +csp_region = "eu-west-3" +underlay_provider = "EQUINIX" +bandwidth = 50 +location = "EQUINIX AM2" +host_url = "https://api.autonomi.io" +catalog_url = "https://catalog.autonomi.io" From 291c85da0d2df41d21d42d387c87e190448778ea Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 18:06:24 +0200 Subject: [PATCH 20/22] tf ci pipeline --- .github/workflows/go-ci.yml | 26 +++++++++---------- .github/workflows/tf-ci.yml | 52 +++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/tf-ci.yml diff --git a/.github/workflows/go-ci.yml b/.github/workflows/go-ci.yml index 9332d13..cf261b6 100644 --- a/.github/workflows/go-ci.yml +++ b/.github/workflows/go-ci.yml @@ -21,31 +21,31 @@ jobs: markdown-lint: runs-on: ubuntu-latest steps: - - name: Checkout code + - name: checkout code uses: actions/checkout@v4 - - name: Set up Node + - name: set up Node uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} - - name: Install markdownlint-cli + - name: install markdownlint-cli run: npm install -g markdownlint-cli - - name: Run markdownlint + - name: markdownlint run: markdownlint '**/*.md' go-mod-tidy: runs-on: ubuntu-latest steps: - - name: Checkout code + - name: checkout code uses: actions/checkout@v4 - - name: Set up Go + - name: set up Go uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - - name: Set up gitconfig + - name: set up gitconfig uses: ./.github/actions/setup-gitconfig with: ORG_GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_TOKEN }} - - name: Run go mod tidy + - name: go mod tidy run: go mod tidy golangci-lint: @@ -53,9 +53,9 @@ jobs: needs: - go-mod-tidy steps: - - name: Checkout code + - name: checkout code uses: actions/checkout@v4 - - name: Set up Go + - name: set up Go uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} @@ -70,11 +70,11 @@ jobs: needs: - go-mod-tidy steps: - - name: Checkout code + - name: checkout code uses: actions/checkout@v4 - - name: Set up Go + - name: set up Go uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - - name: Run tests + - name: go test run: go test ./... -v diff --git a/.github/workflows/tf-ci.yml b/.github/workflows/tf-ci.yml new file mode 100644 index 0000000..bf0cae2 --- /dev/null +++ b/.github/workflows/tf-ci.yml @@ -0,0 +1,52 @@ +name: terraform-continuous-integration + +on: + pull_request: + branches: + - feat/** + - fix/** + - hotfix/** + - main + push: + branches: + - main + +env: + GOPRIVATE: github.com/intercloud + TF_VERSION: 1.9.0 + TF_MODULE_PATH: examples/autonomi + +jobs: + tf-validate: + runs-on: ubuntu-latest + steps: + - name: checkout code + uses: actions/checkout@v4 + - name: set up terraform + uses: hashicorp/setup-terraform@v3 + with: + terraform_version: ${{ env.TF_VERSION }} + - name: change working directory + run: cd ${{ env.TF_MODULE_PATH }} + - name: terraform init + run: terraform init + - name: terraform validate + run: terraform validate + + tf-plan: + runs-on: ubuntu-latest + needs: + - tf-validate + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: set up terraform + uses: hashicorp/setup-terraform@v3 + with: + terraform_version: ${{ env.TF_VERSION }} + - name: change working directory + run: cd ${{ env.TF_MODULE_PATH }} +# - name: terraform init +# run: terraform init + - name: terraform plan + run: terraform plan From 0ef61390019dfc37581d19be405e6080d02f83b8 Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 18:11:23 +0200 Subject: [PATCH 21/22] tf ci change wd --- .github/workflows/tf-ci.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tf-ci.yml b/.github/workflows/tf-ci.yml index bf0cae2..083bbb8 100644 --- a/.github/workflows/tf-ci.yml +++ b/.github/workflows/tf-ci.yml @@ -26,11 +26,11 @@ jobs: uses: hashicorp/setup-terraform@v3 with: terraform_version: ${{ env.TF_VERSION }} - - name: change working directory - run: cd ${{ env.TF_MODULE_PATH }} - name: terraform init + working-directory: ${{ env.TF_MODULE_PATH }} run: terraform init - name: terraform validate + working-directory: ${{ env.TF_MODULE_PATH }} run: terraform validate tf-plan: @@ -44,9 +44,6 @@ jobs: uses: hashicorp/setup-terraform@v3 with: terraform_version: ${{ env.TF_VERSION }} - - name: change working directory - run: cd ${{ env.TF_MODULE_PATH }} -# - name: terraform init -# run: terraform init - name: terraform plan + working-directory: ${{ env.TF_MODULE_PATH }} run: terraform plan From 1f101f1a5dca3b63b34b13eb2d8031946e010cf4 Mon Sep 17 00:00:00 2001 From: juan pablo Date: Mon, 12 Aug 2024 18:29:53 +0200 Subject: [PATCH 22/22] pass secrets as env vars --- .github/workflows/{go-ci.yml => ci.yml} | 40 +++++++++++++++++++- .github/workflows/tf-ci.yml | 49 ------------------------- 2 files changed, 38 insertions(+), 51 deletions(-) rename .github/workflows/{go-ci.yml => ci.yml} (61%) delete mode 100644 .github/workflows/tf-ci.yml diff --git a/.github/workflows/go-ci.yml b/.github/workflows/ci.yml similarity index 61% rename from .github/workflows/go-ci.yml rename to .github/workflows/ci.yml index cf261b6..d1d530b 100644 --- a/.github/workflows/go-ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: go-continuous-integration +name: continuous-integration on: pull_request: @@ -16,6 +16,8 @@ env: GO_VERSION: v1.22.0 GOLANGCI_LINT_VERSION: v1.59 GOPRIVATE: github.com/intercloud + TF_VERSION: 1.9.0 + TF_MODULE_PATH: examples/autonomi jobs: markdown-lint: @@ -68,7 +70,7 @@ jobs: go-test: runs-on: ubuntu-latest needs: - - go-mod-tidy + - golangci-lint steps: - name: checkout code uses: actions/checkout@v4 @@ -78,3 +80,37 @@ jobs: go-version: ${{ env.GO_VERSION }} - name: go test run: go test ./... -v + + tf-validate: + runs-on: ubuntu-latest + steps: + - name: checkout code + uses: actions/checkout@v4 + - name: set up terraform + uses: hashicorp/setup-terraform@v3 + with: + terraform_version: ${{ env.TF_VERSION }} + - name: terraform init + working-directory: ${{ env.TF_MODULE_PATH }} + run: terraform init + - name: terraform validate + working-directory: ${{ env.TF_MODULE_PATH }} + run: terraform validate + + tf-plan: + runs-on: ubuntu-latest + needs: + - tf-validate + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: set up terraform + uses: hashicorp/setup-terraform@v3 + with: + terraform_version: ${{ env.TF_VERSION }} + - name: terraform plan + working-directory: ${{ env.TF_MODULE_PATH }} + run: terraform plan + env: + TF_VAR_pat_token: ${{ secrets.TF_VAR_PAT_TOKEN }} + TF_VAR_aws_account_id: ${{ secrets.TF_VAR_AWS_ACCOUNT_ID }} diff --git a/.github/workflows/tf-ci.yml b/.github/workflows/tf-ci.yml deleted file mode 100644 index 083bbb8..0000000 --- a/.github/workflows/tf-ci.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: terraform-continuous-integration - -on: - pull_request: - branches: - - feat/** - - fix/** - - hotfix/** - - main - push: - branches: - - main - -env: - GOPRIVATE: github.com/intercloud - TF_VERSION: 1.9.0 - TF_MODULE_PATH: examples/autonomi - -jobs: - tf-validate: - runs-on: ubuntu-latest - steps: - - name: checkout code - uses: actions/checkout@v4 - - name: set up terraform - uses: hashicorp/setup-terraform@v3 - with: - terraform_version: ${{ env.TF_VERSION }} - - name: terraform init - working-directory: ${{ env.TF_MODULE_PATH }} - run: terraform init - - name: terraform validate - working-directory: ${{ env.TF_MODULE_PATH }} - run: terraform validate - - tf-plan: - runs-on: ubuntu-latest - needs: - - tf-validate - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: set up terraform - uses: hashicorp/setup-terraform@v3 - with: - terraform_version: ${{ env.TF_VERSION }} - - name: terraform plan - working-directory: ${{ env.TF_MODULE_PATH }} - run: terraform plan