From 0ea4b9699d874c2670fcfc68e491d35cc74f25b7 Mon Sep 17 00:00:00 2001 From: cliftonHPE Date: Wed, 4 Dec 2024 10:59:39 +0200 Subject: [PATCH 1/9] add terraform workflow --- .github/workflows/terraform.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/terraform.yaml diff --git a/.github/workflows/terraform.yaml b/.github/workflows/terraform.yaml new file mode 100644 index 0000000..07a6912 --- /dev/null +++ b/.github/workflows/terraform.yaml @@ -0,0 +1,23 @@ +name: Terraform + +on: [push] + +jobs: + terraform-fmt: + name: Check formatting + runs-on: ubuntu-latest + env: + TF_IN_AUTOMATION: "true" + + steps: + - name: Git checkout + uses: actions/checkout@v4 + + - name: Setup Terraform + uses: hashicorp/setup-terraform@v1 + with: + terraform_version: 0.13.7 + + - name: Terraform fmt + id: fmt + run: terraform fmt -recursive -check From 5378e3e2d3bad39522cd014adf0cd19399618973 Mon Sep 17 00:00:00 2001 From: cliftonHPE Date: Wed, 4 Dec 2024 11:02:32 +0200 Subject: [PATCH 2/9] update justfile fmt command --- Justfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Justfile b/Justfile index 51edac7..067d1f6 100644 --- a/Justfile +++ b/Justfile @@ -79,6 +79,7 @@ fmt: go run github.com/segmentio/golines@v0.12.2 -w . go run golang.org/x/tools/cmd/goimports@latest -local github.com/aruba-uxi -w . go run mvdan.cc/gofumpt@latest -w . + terraform fmt --recursive . tidy-provider: go mod tidy From b0f7085b26afbf1df94a020275255411b1760cee Mon Sep 17 00:00:00 2001 From: cliftonHPE Date: Wed, 4 Dec 2024 11:04:22 +0200 Subject: [PATCH 3/9] format tf files --- examples/provider/provider.tf | 4 ++-- examples/resources/hpeuxi_agent/resource.tf | 6 +++--- .../resources/hpeuxi_agent_group_assignment/resource.tf | 4 ++-- examples/resources/hpeuxi_group/resource.tf | 2 +- .../resources/hpeuxi_network_group_assignment/resource.tf | 4 ++-- .../resources/hpeuxi_sensor_group_assignment/resource.tf | 4 ++-- examples/resources/hpeuxi_service_test/resource.tf | 2 +- .../hpeuxi_service_test_group_assignment/resource.tf | 4 ++-- examples/resources/hpeuxi_wired_network/resource.tf | 2 +- examples/resources/hpeuxi_wireless_network/resource.tf | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 97f05be..7c4ff7b 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -1,4 +1,4 @@ provider "hpeuxi" { - client_id = "your_greenlake_uxi_client_id" - client_secret = "your_greenlake_uxi_client_secret" + client_id = "your_greenlake_uxi_client_id" + client_secret = "your_greenlake_uxi_client_secret" } diff --git a/examples/resources/hpeuxi_agent/resource.tf b/examples/resources/hpeuxi_agent/resource.tf index 14b1e38..9f952f9 100644 --- a/examples/resources/hpeuxi_agent/resource.tf +++ b/examples/resources/hpeuxi_agent/resource.tf @@ -1,5 +1,5 @@ resource "hpeuxi_agent" "my_agent" { - name = "name" - notes = "notes" - pcap_mode = "light" + name = "name" + notes = "notes" + pcap_mode = "light" } diff --git a/examples/resources/hpeuxi_agent_group_assignment/resource.tf b/examples/resources/hpeuxi_agent_group_assignment/resource.tf index 784f5e2..7f3b8d2 100644 --- a/examples/resources/hpeuxi_agent_group_assignment/resource.tf +++ b/examples/resources/hpeuxi_agent_group_assignment/resource.tf @@ -1,4 +1,4 @@ resource "hpeuxi_agent_group_assignment" "my_agent_group_assignment" { - agent_id = hpeuxi_agent.my_agent.id - group_id = hpeuxi_group.my_group.id + agent_id = hpeuxi_agent.my_agent.id + group_id = hpeuxi_group.my_group.id } diff --git a/examples/resources/hpeuxi_group/resource.tf b/examples/resources/hpeuxi_group/resource.tf index a8fcfdb..b4188c3 100644 --- a/examples/resources/hpeuxi_group/resource.tf +++ b/examples/resources/hpeuxi_group/resource.tf @@ -1,6 +1,6 @@ # Create level 1 group attached to the root node resource "hpeuxi_group" "level_1" { - name = "Parent Group" + name = "Parent Group" } # Create level 2 group attached to level 1 group diff --git a/examples/resources/hpeuxi_network_group_assignment/resource.tf b/examples/resources/hpeuxi_network_group_assignment/resource.tf index 1433aba..c985536 100644 --- a/examples/resources/hpeuxi_network_group_assignment/resource.tf +++ b/examples/resources/hpeuxi_network_group_assignment/resource.tf @@ -1,4 +1,4 @@ resource "hpeuxi_network_group_assignment" "my_network_group_assignment" { - network_id = hpeuxi_wired_network.my_network.id - group_id = hpeuxi_group.my_group.id + network_id = hpeuxi_wired_network.my_network.id + group_id = hpeuxi_group.my_group.id } diff --git a/examples/resources/hpeuxi_sensor_group_assignment/resource.tf b/examples/resources/hpeuxi_sensor_group_assignment/resource.tf index f8ba57d..8df7409 100644 --- a/examples/resources/hpeuxi_sensor_group_assignment/resource.tf +++ b/examples/resources/hpeuxi_sensor_group_assignment/resource.tf @@ -1,4 +1,4 @@ resource "hpeuxi_sensor_group_assignment" "my_sensor_group_assignment" { - sensor_id = hpeuxi_sensor.my_sensor.id - group_id = hpeuxi_group.my_group.id + sensor_id = hpeuxi_sensor.my_sensor.id + group_id = hpeuxi_group.my_group.id } diff --git a/examples/resources/hpeuxi_service_test/resource.tf b/examples/resources/hpeuxi_service_test/resource.tf index 787e090..12e953b 100644 --- a/examples/resources/hpeuxi_service_test/resource.tf +++ b/examples/resources/hpeuxi_service_test/resource.tf @@ -1,5 +1,5 @@ resource "hpeuxi_service_test" "my_service_test" { - name = "name" + name = "name" # Deleting of service tests is not supported yet lifecycle { diff --git a/examples/resources/hpeuxi_service_test_group_assignment/resource.tf b/examples/resources/hpeuxi_service_test_group_assignment/resource.tf index 1808388..e9280cf 100644 --- a/examples/resources/hpeuxi_service_test_group_assignment/resource.tf +++ b/examples/resources/hpeuxi_service_test_group_assignment/resource.tf @@ -1,4 +1,4 @@ resource "hpeuxi_service_test_group_assignment" "my_service_test_group_assignment" { - service_test_id = hpeuxi_service_test.my_service_test.id - group_id = hpeuxi_group.my_group.id + service_test_id = hpeuxi_service_test.my_service_test.id + group_id = hpeuxi_group.my_group.id } diff --git a/examples/resources/hpeuxi_wired_network/resource.tf b/examples/resources/hpeuxi_wired_network/resource.tf index 59ee0bc..9d5c568 100644 --- a/examples/resources/hpeuxi_wired_network/resource.tf +++ b/examples/resources/hpeuxi_wired_network/resource.tf @@ -1,5 +1,5 @@ resource "hpeuxi_wired_network" "my_wired_network" { - name = "name" + name = "name" # Deleting of wired networks is not supported yet lifecycle { diff --git a/examples/resources/hpeuxi_wireless_network/resource.tf b/examples/resources/hpeuxi_wireless_network/resource.tf index 28830e8..22c63e9 100644 --- a/examples/resources/hpeuxi_wireless_network/resource.tf +++ b/examples/resources/hpeuxi_wireless_network/resource.tf @@ -1,5 +1,5 @@ resource "hpeuxi_wireless_network" "my_wireless_network" { - name = "name" + name = "name" # Deleting of wireless networks is not supported yet lifecycle { From d45f43b84d7a87b3f963db6f18b5d8dc5590a21f Mon Sep 17 00:00:00 2001 From: cliftonHPE Date: Wed, 4 Dec 2024 11:08:35 +0200 Subject: [PATCH 4/9] Docs formatted --- docs/index.md | 4 ++-- docs/resources/agent.md | 6 +++--- docs/resources/agent_group_assignment.md | 4 ++-- docs/resources/group.md | 2 +- docs/resources/network_group_assignment.md | 4 ++-- docs/resources/sensor_group_assignment.md | 4 ++-- docs/resources/service_test.md | 2 +- docs/resources/service_test_group_assignment.md | 4 ++-- docs/resources/wired_network.md | 2 +- docs/resources/wireless_network.md | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/index.md b/docs/index.md index 9e295e9..6da79f0 100644 --- a/docs/index.md +++ b/docs/index.md @@ -13,8 +13,8 @@ Interact with HPE Aruba Network UXI Configuration. ```terraform provider "hpeuxi" { - client_id = "your_greenlake_uxi_client_id" - client_secret = "your_greenlake_uxi_client_secret" + client_id = "your_greenlake_uxi_client_id" + client_secret = "your_greenlake_uxi_client_secret" } ``` diff --git a/docs/resources/agent.md b/docs/resources/agent.md index 0d6ac94..6202a31 100644 --- a/docs/resources/agent.md +++ b/docs/resources/agent.md @@ -14,9 +14,9 @@ Manages an agent. ```terraform resource "hpeuxi_agent" "my_agent" { - name = "name" - notes = "notes" - pcap_mode = "light" + name = "name" + notes = "notes" + pcap_mode = "light" } ``` diff --git a/docs/resources/agent_group_assignment.md b/docs/resources/agent_group_assignment.md index e4a732c..66ee043 100644 --- a/docs/resources/agent_group_assignment.md +++ b/docs/resources/agent_group_assignment.md @@ -14,8 +14,8 @@ Manages an agent group assignment. ```terraform resource "hpeuxi_agent_group_assignment" "my_agent_group_assignment" { - agent_id = hpeuxi_agent.my_agent.id - group_id = hpeuxi_group.my_group.id + agent_id = hpeuxi_agent.my_agent.id + group_id = hpeuxi_group.my_group.id } ``` diff --git a/docs/resources/group.md b/docs/resources/group.md index 6950735..efe6909 100644 --- a/docs/resources/group.md +++ b/docs/resources/group.md @@ -15,7 +15,7 @@ Manages a group. ```terraform # Create level 1 group attached to the root node resource "hpeuxi_group" "level_1" { - name = "Parent Group" + name = "Parent Group" } # Create level 2 group attached to level 1 group diff --git a/docs/resources/network_group_assignment.md b/docs/resources/network_group_assignment.md index 7095a40..d06eab0 100644 --- a/docs/resources/network_group_assignment.md +++ b/docs/resources/network_group_assignment.md @@ -14,8 +14,8 @@ Manages a network group assignment. ```terraform resource "hpeuxi_network_group_assignment" "my_network_group_assignment" { - network_id = hpeuxi_wired_network.my_network.id - group_id = hpeuxi_group.my_group.id + network_id = hpeuxi_wired_network.my_network.id + group_id = hpeuxi_group.my_group.id } ``` diff --git a/docs/resources/sensor_group_assignment.md b/docs/resources/sensor_group_assignment.md index 9cc9127..1822a73 100644 --- a/docs/resources/sensor_group_assignment.md +++ b/docs/resources/sensor_group_assignment.md @@ -14,8 +14,8 @@ Manages a sensor group assignment. ```terraform resource "hpeuxi_sensor_group_assignment" "my_sensor_group_assignment" { - sensor_id = hpeuxi_sensor.my_sensor.id - group_id = hpeuxi_group.my_group.id + sensor_id = hpeuxi_sensor.my_sensor.id + group_id = hpeuxi_group.my_group.id } ``` diff --git a/docs/resources/service_test.md b/docs/resources/service_test.md index 3829e9f..fd0d667 100644 --- a/docs/resources/service_test.md +++ b/docs/resources/service_test.md @@ -14,7 +14,7 @@ Manages a service test. ```terraform resource "hpeuxi_service_test" "my_service_test" { - name = "name" + name = "name" # Deleting of service tests is not supported yet lifecycle { diff --git a/docs/resources/service_test_group_assignment.md b/docs/resources/service_test_group_assignment.md index 9072354..de1e368 100644 --- a/docs/resources/service_test_group_assignment.md +++ b/docs/resources/service_test_group_assignment.md @@ -14,8 +14,8 @@ Manages a service test group assignment. ```terraform resource "hpeuxi_service_test_group_assignment" "my_service_test_group_assignment" { - service_test_id = hpeuxi_service_test.my_service_test.id - group_id = hpeuxi_group.my_group.id + service_test_id = hpeuxi_service_test.my_service_test.id + group_id = hpeuxi_group.my_group.id } ``` diff --git a/docs/resources/wired_network.md b/docs/resources/wired_network.md index 6824c65..d6d623e 100644 --- a/docs/resources/wired_network.md +++ b/docs/resources/wired_network.md @@ -14,7 +14,7 @@ Manages a wired network. ```terraform resource "hpeuxi_wired_network" "my_wired_network" { - name = "name" + name = "name" # Deleting of wired networks is not supported yet lifecycle { diff --git a/docs/resources/wireless_network.md b/docs/resources/wireless_network.md index 6803908..9152460 100644 --- a/docs/resources/wireless_network.md +++ b/docs/resources/wireless_network.md @@ -14,7 +14,7 @@ Manages a wireless network. ```terraform resource "hpeuxi_wireless_network" "my_wireless_network" { - name = "name" + name = "name" # Deleting of wireless networks is not supported yet lifecycle { From eab7debdc9ecd39322e8339945d6a7cb5b57747a Mon Sep 17 00:00:00 2001 From: cliftonHPE Date: Wed, 4 Dec 2024 14:43:53 +0200 Subject: [PATCH 5/9] undo lint fix --- docs/index.md | 4 ++-- examples/provider/provider.tf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/index.md b/docs/index.md index 6da79f0..9e295e9 100644 --- a/docs/index.md +++ b/docs/index.md @@ -13,8 +13,8 @@ Interact with HPE Aruba Network UXI Configuration. ```terraform provider "hpeuxi" { - client_id = "your_greenlake_uxi_client_id" - client_secret = "your_greenlake_uxi_client_secret" + client_id = "your_greenlake_uxi_client_id" + client_secret = "your_greenlake_uxi_client_secret" } ``` diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 7c4ff7b..97f05be 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -1,4 +1,4 @@ provider "hpeuxi" { - client_id = "your_greenlake_uxi_client_id" - client_secret = "your_greenlake_uxi_client_secret" + client_id = "your_greenlake_uxi_client_id" + client_secret = "your_greenlake_uxi_client_secret" } From 03f380b67a5c2307d700ba032898684d1dcabbdc Mon Sep 17 00:00:00 2001 From: cliftonHPE Date: Wed, 4 Dec 2024 14:46:30 +0200 Subject: [PATCH 6/9] move terraform fmt to lint workflow --- .github/workflows/lint-test-code.yaml | 8 ++++++++ .github/workflows/terraform.yaml | 23 ----------------------- 2 files changed, 8 insertions(+), 23 deletions(-) delete mode 100644 .github/workflows/terraform.yaml diff --git a/.github/workflows/lint-test-code.yaml b/.github/workflows/lint-test-code.yaml index f0c7281..ffff91d 100644 --- a/.github/workflows/lint-test-code.yaml +++ b/.github/workflows/lint-test-code.yaml @@ -71,3 +71,11 @@ jobs: files: ./pkg/config-api-client/.coverage,.coverage flage: client,provider fail_ci_if_error: true + + - name: Setup Terraform + uses: hashicorp/setup-terraform@v1 + with: + terraform_version: 0.13.7 + + - name: Terraform Formatting Check + run: terraform fmt -recursive -check diff --git a/.github/workflows/terraform.yaml b/.github/workflows/terraform.yaml deleted file mode 100644 index 07a6912..0000000 --- a/.github/workflows/terraform.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: Terraform - -on: [push] - -jobs: - terraform-fmt: - name: Check formatting - runs-on: ubuntu-latest - env: - TF_IN_AUTOMATION: "true" - - steps: - - name: Git checkout - uses: actions/checkout@v4 - - - name: Setup Terraform - uses: hashicorp/setup-terraform@v1 - with: - terraform_version: 0.13.7 - - - name: Terraform fmt - id: fmt - run: terraform fmt -recursive -check From 1f7bc3769267388af0ad2fa6943257e9f02c98b7 Mon Sep 17 00:00:00 2001 From: cliftonHPE Date: Wed, 4 Dec 2024 14:50:02 +0200 Subject: [PATCH 7/9] lint fix --- docs/index.md | 4 ++-- examples/provider/provider.tf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/index.md b/docs/index.md index 9e295e9..6da79f0 100644 --- a/docs/index.md +++ b/docs/index.md @@ -13,8 +13,8 @@ Interact with HPE Aruba Network UXI Configuration. ```terraform provider "hpeuxi" { - client_id = "your_greenlake_uxi_client_id" - client_secret = "your_greenlake_uxi_client_secret" + client_id = "your_greenlake_uxi_client_id" + client_secret = "your_greenlake_uxi_client_secret" } ``` diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 97f05be..7c4ff7b 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -1,4 +1,4 @@ provider "hpeuxi" { - client_id = "your_greenlake_uxi_client_id" - client_secret = "your_greenlake_uxi_client_secret" + client_id = "your_greenlake_uxi_client_id" + client_secret = "your_greenlake_uxi_client_secret" } From 54b492a5cdf6f25cc04d97ca4bf58c4d1fd59a7c Mon Sep 17 00:00:00 2001 From: cliftonHPE Date: Wed, 4 Dec 2024 15:11:02 +0200 Subject: [PATCH 8/9] add check to Justfile --- .github/workflows/lint-test-code.yaml | 8 -------- Justfile | 2 ++ examples/provider/provider.tf | 4 ++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/lint-test-code.yaml b/.github/workflows/lint-test-code.yaml index ffff91d..f0c7281 100644 --- a/.github/workflows/lint-test-code.yaml +++ b/.github/workflows/lint-test-code.yaml @@ -71,11 +71,3 @@ jobs: files: ./pkg/config-api-client/.coverage,.coverage flage: client,provider fail_ci_if_error: true - - - name: Setup Terraform - uses: hashicorp/setup-terraform@v1 - with: - terraform_version: 0.13.7 - - - name: Terraform Formatting Check - run: terraform fmt -recursive -check diff --git a/Justfile b/Justfile index 067d1f6..c42ce6f 100644 --- a/Justfile +++ b/Justfile @@ -74,6 +74,8 @@ lint: python -m tools.lint-attribution lint + terraform fmt -recursive -check + fmt: python -m tools.lint-attribution format go run github.com/segmentio/golines@v0.12.2 -w . diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 7c4ff7b..cc63061 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -1,4 +1,4 @@ provider "hpeuxi" { - client_id = "your_greenlake_uxi_client_id" - client_secret = "your_greenlake_uxi_client_secret" + client_id = "your_greenlake_uxi_client_id" + client_secret = "your_greenlake_uxi_client_secret" } From 3d1f694a9c3cc93fe48ea426c017ee01bf6d4199 Mon Sep 17 00:00:00 2001 From: cliftonHPE Date: Wed, 4 Dec 2024 15:14:12 +0200 Subject: [PATCH 9/9] list fix --- examples/provider/provider.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index cc63061..7c4ff7b 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -1,4 +1,4 @@ provider "hpeuxi" { - client_id = "your_greenlake_uxi_client_id" - client_secret = "your_greenlake_uxi_client_secret" + client_id = "your_greenlake_uxi_client_id" + client_secret = "your_greenlake_uxi_client_secret" }