diff --git a/.github/workflows/acceptance-tests.yml b/.github/workflows/acceptance-tests.yml index 407804f8..96064533 100644 --- a/.github/workflows/acceptance-tests.yml +++ b/.github/workflows/acceptance-tests.yml @@ -4,7 +4,7 @@ on: branches: - master schedule: - - cron: '0 0 * * *' + - cron: "0 0 * * *" jobs: acceptance-test: @@ -19,7 +19,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.22.7' + go-version: "1.23" - name: Set up Terraform uses: hashicorp/setup-terraform@v2 @@ -30,5 +30,5 @@ jobs: run: make testacc env: OS_DOMAIN_NAME: ${{ secrets.OS_DOMAIN_NAME }} - OS_USERNAME: ${{ secrets.OS_USERNAME }} - OS_PASSWORD: ${{ secrets.OS_PASSWORD }} + OS_USERNAME: ${{ secrets.OS_USERNAME }} + OS_PASSWORD: ${{ secrets.OS_PASSWORD }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c763157d..737c4813 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ name: Release on: push: tags: - - 'v*' + - "v*" jobs: goreleaser: @@ -23,7 +23,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.22.7' + go-version: "1.23" - name: Import GPG key id: import_gpg diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 0eaa0bce..325e7739 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.22.7' + go-version: "1.23" - run: make test golangci-lint: @@ -22,10 +22,10 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.22.7' + go-version: "1.23" - uses: golangci/golangci-lint-action@v6 with: - version: v1.56.2 + version: v1.62.0 tidy: runs-on: ubuntu-24.04 @@ -33,6 +33,6 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.22.7' + go-version: "1.23" - run: go mod tidy -v - run: git diff --exit-code diff --git a/README.md b/README.md index 37c34e1d..9e64d105 100644 --- a/README.md +++ b/README.md @@ -1,79 +1,72 @@ -Terraform Selectel Provider -========================= +# Terraform Selectel Provider -- Website: https://www.terraform.io +- Website: - [![Gitter chat](https://badges.gitter.im/hashicorp-terraform/Lobby.png)](https://gitter.im/hashicorp-terraform/Lobby) - Mailing list: [Google Groups](http://groups.google.com/group/terraform-tool) Terraform Selectel Provider -Maintainers ------------ +## Maintainers This provider plugin is maintained by: -* Sergei Kolyshkin ([@kolsean](https://github.com/kolsean)) -* Nikita Kunets ([@dkder3k](https://github.com/dkder3k)) -* Ilya Kulakov ([@TawR1024](https://github.com/TawR1024)) -* Tatyana Voloshina ([@T-Sh](https://github.com/T-Sh)) +- Sergei Kolyshkin ([@kolsean](https://github.com/kolsean)) +- Nikita Kunets ([@dkder3k](https://github.com/dkder3k)) +- Ilya Kulakov ([@TawR1024](https://github.com/TawR1024)) +- Tatyana Voloshina ([@T-Sh](https://github.com/T-Sh)) -Requirements ------------- +## Requirements -- [Terraform](https://www.terraform.io/downloads.html) 0.12.x -- [Go](https://golang.org/doc/install) 1.22 (to build the provider plugin) +- [Terraform](https://www.terraform.io/downloads.html) 0.12.x +- [Go](https://golang.org/doc/install) 1.23 (to build the provider plugin) -Building The Provider ---------------------- +## Building The Provider Clone the repository ```sh -$ git clone git@github.com:selectel/terraform-provider-selectel.git +git clone git@github.com:selectel/terraform-provider-selectel.git ``` Enter the provider directory and build the provider ```sh -$ cd terraform-provider-selectel -$ make build +cd terraform-provider-selectel +make build ``` -Using the provider ----------------------- +## Using the provider Getting Started with Terraform at Selectel: [kb.selectel.com](https://kb.selectel.com/docs/selectel-cloud-platform/main-services/instructions/how_to_use_terraform/). Documentation is available at: [docs/providers/selectel](https://www.terraform.io/docs/providers/selectel/index.html). You can find examples in this repository: [examples](https://github.com/terraform-providers/terraform-provider-selectel/tree/master/examples). Also there are lots of examples in the [selectel/terraform-examples](https://github.com/selectel/terraform-examples). -Developing the Provider ---------------------------- +## Developing the Provider -If you wish to work on the provider, you'll first need [Go](https://golang.org) installed on your machine (version 1.17+ is *required*). +If you wish to work on the provider, you'll first need [Go](https://golang.org) installed on your machine (version 1.17+ is _required_). To compile the provider, run `make build`. This will build the provider and put the provider binary in the current directory. ```sh -$ make build +make build ``` In order to test the provider, you can simply run `make test`. ```sh -$ make test +make test ``` In order to run the full suite of Acceptance tests, run `make testacc`. -*Note:* Acceptance tests create real resources, and often cost money to run. +_Note:_ Acceptance tests create real resources, and often cost money to run. ```sh -$ make testacc +make testacc ``` -Releasing the Provider ----------------------- +## Releasing the Provider This repository contains a GitHub Action configured to automatically build and publish assets for release when a tag is pushed that matches the pattern `v*` diff --git a/go.mod b/go.mod index 743de2cf..c6579406 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/terraform-providers/terraform-provider-selectel -go 1.22.7 +go 1.23 require ( github.com/hashicorp/go-retryablehttp v0.7.7 diff --git a/selectel/import_selectel_iam_user_v1_test.go b/selectel/import_selectel_iam_user_v1_test.go index d69d24ee..bf38d110 100644 --- a/selectel/import_selectel_iam_user_v1_test.go +++ b/selectel/import_selectel_iam_user_v1_test.go @@ -9,7 +9,6 @@ import ( func TestAccIAMV1UserImportBasic(t *testing.T) { resourceName := "selectel_iam_user_v1.user_tf_acc_test_1" - //nolint:goconst userEmail := acctest.RandomWithPrefix("tf-acc") + "@example.com" resource.Test(t, resource.TestCase{ diff --git a/selectel/mks.go b/selectel/mks.go index 39126afd..bef2dada 100644 --- a/selectel/mks.go +++ b/selectel/mks.go @@ -68,20 +68,20 @@ func mksClusterV1StateRefreshFunc( } } -func mksClusterV1KubeVersionDiffSuppressFunc(_, old, new string, d *schema.ResourceData) bool { +func mksClusterV1KubeVersionDiffSuppressFunc(_, oldVersion, newVersion string, d *schema.ResourceData) bool { if d.Id() == "" { return false } - currentMajor, err := kubeVersionToMajor(old) + currentMajor, err := kubeVersionToMajor(oldVersion) if err != nil { - log.Printf("[DEBUG] error getting a major part of the current kube version %s: %s", old, err) + log.Printf("[DEBUG] error getting a major part of the current kube version %s: %s", oldVersion, err) return false } - desiredMajor, err := kubeVersionToMajor(new) + desiredMajor, err := kubeVersionToMajor(newVersion) if err != nil { - log.Printf("[DEBUG] error getting a major part of the desired kube version %s: %s", new, err) + log.Printf("[DEBUG] error getting a major part of the desired kube version %s: %s", newVersion, err) return false } @@ -96,15 +96,15 @@ func mksClusterV1KubeVersionDiffSuppressFunc(_, old, new string, d *schema.Resou return true } - currentMinor, err := kubeVersionToMinor(old) + currentMinor, err := kubeVersionToMinor(oldVersion) if err != nil { - log.Printf("[DEBUG] error getting a minor part of the current kube version %s: %s", old, err) + log.Printf("[DEBUG] error getting a minor part of the current kube version %s: %s", oldVersion, err) return false } - desiredMinor, err := kubeVersionToMinor(new) + desiredMinor, err := kubeVersionToMinor(newVersion) if err != nil { - log.Printf("[DEBUG] error getting a minor part of the desired kube version %s: %s", new, err) + log.Printf("[DEBUG] error getting a minor part of the desired kube version %s: %s", newVersion, err) return false } @@ -119,15 +119,15 @@ func mksClusterV1KubeVersionDiffSuppressFunc(_, old, new string, d *schema.Resou return true } - currentPatch, err := kubeVersionToPatch(old) + currentPatch, err := kubeVersionToPatch(oldVersion) if err != nil { - log.Printf("[DEBUG] error getting a patch part of the current kube version %s: %s", old, err) + log.Printf("[DEBUG] error getting a patch part of the current kube version %s: %s", oldVersion, err) return false } - desiredPatch, err := kubeVersionToPatch(new) + desiredPatch, err := kubeVersionToPatch(newVersion) if err != nil { - log.Printf("[DEBUG] error getting a patch part of the desired kube version %s: %s", new, err) + log.Printf("[DEBUG] error getting a patch part of the desired kube version %s: %s", newVersion, err) return true } diff --git a/selectel/resource_selectel_dbaas_kafka_topic_v1.go b/selectel/resource_selectel_dbaas_kafka_topic_v1.go index ba97b3ae..7d66a382 100644 --- a/selectel/resource_selectel_dbaas_kafka_topic_v1.go +++ b/selectel/resource_selectel_dbaas_kafka_topic_v1.go @@ -43,7 +43,7 @@ func resourceDBaaSTopicV1Create(ctx context.Context, d *schema.ResourceData, met topicCreateOpts := dbaas.TopicCreateOpts{ DatastoreID: d.Get("datastore_id").(string), Name: d.Get("name").(string), - Partitions: uint16(d.Get("partitions").(int)), + Partitions: uint16(d.Get("partitions").(int)), //nolint:gosec } log.Print(msgCreate(objectTopic, topicCreateOpts)) @@ -90,7 +90,7 @@ func resourceDBaaSTopicV1Update(ctx context.Context, d *schema.ResourceData, met } if d.HasChange("partitions") { - partitions := uint16(d.Get("partitions").(int)) + partitions := uint16(d.Get("partitions").(int)) //nolint:gosec updateOpts := dbaas.TopicUpdateOpts{ Partitions: partitions, } diff --git a/selectel/resource_selectel_mks_nodegroup_v1.go b/selectel/resource_selectel_mks_nodegroup_v1.go index ec0894cc..7bddc473 100644 --- a/selectel/resource_selectel_mks_nodegroup_v1.go +++ b/selectel/resource_selectel_mks_nodegroup_v1.go @@ -191,11 +191,11 @@ func resourceMKSNodegroupV1() *schema.Resource { }, CustomizeDiff: customdiff.All( // We need to recreate nodegroup if flavor changed. - customdiff.ForceNewIfChange("flavor_id", func(_ context.Context, old, new, _ interface{}) bool { - return old.(string) != new.(string) + customdiff.ForceNewIfChange("flavor_id", func(_ context.Context, oldVersion, newVersion, _ interface{}) bool { + return oldVersion.(string) != newVersion.(string) }), - customdiff.ForceNewIfChange("local_volume", func(_ context.Context, old, new, _ interface{}) bool { - return old.(bool) != new.(bool) + customdiff.ForceNewIfChange("local_volume", func(_ context.Context, oldVersion, newVersion, _ interface{}) bool { + return oldVersion.(bool) != newVersion.(bool) }), ), }