Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change configuration of provider #313

Merged
merged 12 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
branches:
- master
schedule:
- cron: '0 0 * * *'
- cron: "0 0 * * *"

jobs:
acceptance-test:
Expand All @@ -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
Expand All @@ -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 }}
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Release
on:
push:
tags:
- 'v*'
- "v*"

jobs:
goreleaser:
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -22,17 +22,17 @@ 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
steps:
- 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
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
## 6.0.0 (Dec 2, 2024)

BREAKING CHANGES:

* Configuration parameters `auth_region` and `auth_url` are made mandatory
for the provider configuration ([#313](https://github.com/selectel/terraform-provider-selectel/pull/313))
* Renamed environment variables for resources:
* `SEL_PROJECT_ID` -> `INFRA_PROJECT_ID`
* `SEL_REGION` -> `INFRA_REGION`
* Removed deprecated resources ([#313](https://github.com/selectel/terraform-provider-selectel/pull/313)):
* `selectel_vpc_role_v2`
* `selectel_vpc_token_v2`
* `selectel_vpc_user_v2`
* `selectel_vpc_vrrp_subnet_v2`
* `selectel_vpc_crossregion_subnet_v2`

IMPROVEMENTS:

* Added migration guide to upgrade to new major v6 version ([#313](https://github.com/selectel/terraform-provider-selectel/pull/313))
* Updated docs ([#313](https://github.com/selectel/terraform-provider-selectel/pull/313))

## 5.5.0 (Dec 2, 2024)

FEATURES:
Expand Down
47 changes: 20 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
Terraform Selectel Provider
=========================
# Terraform Selectel Provider

- Website: https://www.terraform.io
- [![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)
* Website: <https://www.terraform.io>
* [![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)

<img alt="Terraform Selectel Provider" src="https://selectel.ru/blog/wp-content/uploads/2019/03/[email protected]" width="600px">

Maintainers
-----------
## Maintainers

This provider plugin is maintained by:

Expand All @@ -17,63 +15,58 @@ This provider plugin is maintained by:
* 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 [email protected]:selectel/terraform-provider-selectel.git
git clone [email protected]: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*`
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
module github.com/terraform-providers/terraform-provider-selectel

go 1.22.7
go 1.23

require (
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/go-retryablehttp v0.7.7
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1
github.com/selectel/craas-go v0.3.0
github.com/selectel/dbaas-go v0.12.1
github.com/selectel/domains-go v1.0.2
github.com/selectel/go-selvpcclient/v3 v3.2.1
github.com/selectel/go-selvpcclient/v4 v4.0.0
github.com/selectel/iam-go v0.4.1
github.com/selectel/mks-go v0.17.0
github.com/selectel/secretsmanager-go v0.2.1
Expand All @@ -29,6 +28,7 @@ require (
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.4.6 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ github.com/selectel/dbaas-go v0.12.1 h1:u3mBMoHP/FnHucLqd1QBeBHjQ2WV4S88ewP97gCE
github.com/selectel/dbaas-go v0.12.1/go.mod h1:Ffq6RQ4PmgZX8eL9oXsaKDc0lzbCK9wadyDV6AHaz/k=
github.com/selectel/domains-go v1.0.2 h1:Si6iGaMnTFJxwiJVI50DOdZnwcxc87kqaWrVQYW0a4U=
github.com/selectel/domains-go v1.0.2/go.mod h1:SugRKfq4sTpnOHquslCpzda72wV8u0cMBHx0C0l+bzA=
github.com/selectel/go-selvpcclient/v3 v3.2.1 h1:ny6WIAMiHzKxOgOEnwcWE79wIQij1AHHylzPA41MXCw=
github.com/selectel/go-selvpcclient/v3 v3.2.1/go.mod h1:3EfSf8aEWyhspOGbvZ6mvnFg7JN5uckxNyBFPGWsXNQ=
github.com/selectel/go-selvpcclient/v4 v4.0.0 h1:5HorF8n6u/4BUh2+cJEysmXhMOB9epGgrKluLonPlM0=
github.com/selectel/go-selvpcclient/v4 v4.0.0/go.mod h1:eFhL1KUW159KOJVeGO7k/Uxl0TYd/sBkWXjuF5WxmYk=
github.com/selectel/iam-go v0.4.1 h1:grncCGkPVCM6nwqSTk+q15M5ZO6S/Pe0AIbbmKtm6gU=
github.com/selectel/iam-go v0.4.1/go.mod h1:OIAkW7MZK97YUm+uvUgYbgDhkI9SdzTCxwd4yZoOR1o=
github.com/selectel/mks-go v0.17.0 h1:fYyIuB/K+TJJDy50Bl7z52SrogYCdekpKPaRc0pDi+M=
Expand Down
10 changes: 3 additions & 7 deletions selectel/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/selectel/go-selvpcclient/v3/selvpcclient"
"github.com/selectel/go-selvpcclient/v4/selvpcclient"
)

var (
Expand Down Expand Up @@ -37,12 +37,8 @@ func getConfig(d *schema.ResourceData) (*Config, diag.Diagnostics) {
Username: d.Get("username").(string),
Password: d.Get("password").(string),
DomainName: d.Get("domain_name").(string),
}
if v, ok := d.GetOk("auth_url"); ok {
cfgSingletone.AuthURL = v.(string)
}
if v, ok := d.GetOk("auth_region"); ok {
cfgSingletone.AuthRegion = v.(string)
AuthURL: d.Get("auth_url").(string),
AuthRegion: d.Get("auth_region").(string),
}
if v, ok := d.GetOk("user_domain_name"); ok {
cfgSingletone.UserDomainName = v.(string)
Expand Down
2 changes: 1 addition & 1 deletion selectel/craas.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
v1 "github.com/selectel/craas-go/pkg"
"github.com/selectel/craas-go/pkg/v1/registry"
"github.com/selectel/go-selvpcclient/v3/selvpcclient"
"github.com/selectel/go-selvpcclient/v4/selvpcclient"
)

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/selectel/dbaas-go"
"github.com/selectel/go-selvpcclient/v3/selvpcclient/resell/v2/projects"
"github.com/selectel/go-selvpcclient/v4/selvpcclient/resell/v2/projects"
)

func TestAccDBaaSAvailableExtensionsV1Basic(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/selectel/dbaas-go"
"github.com/selectel/go-selvpcclient/v3/selvpcclient/resell/v2/projects"
"github.com/selectel/go-selvpcclient/v4/selvpcclient/resell/v2/projects"
)

func TestAccDBaaSConfigurationParametersV1Basic(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/selectel/dbaas-go"
"github.com/selectel/go-selvpcclient/v3/selvpcclient/resell/v2/projects"
"github.com/selectel/go-selvpcclient/v4/selvpcclient/resell/v2/projects"
)

func TestAccDBaaSDatastoreTypesV1Basic(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion selectel/data_source_selectel_dbaas_flavor_v1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/selectel/dbaas-go"
"github.com/selectel/go-selvpcclient/v3/selvpcclient/resell/v2/projects"
"github.com/selectel/go-selvpcclient/v4/selvpcclient/resell/v2/projects"
)

func TestAccDBaaSFlavorsV1Basic(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/selectel/dbaas-go"
"github.com/selectel/go-selvpcclient/v3/selvpcclient/resell/v2/projects"
"github.com/selectel/go-selvpcclient/v4/selvpcclient/resell/v2/projects"
)

func TestAccDBaaSDataSourcePrometheusMetricTokenV1Basic(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion selectel/data_source_selectel_mks_kube_options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/selectel/go-selvpcclient/v3/selvpcclient/resell/v2/projects"
"github.com/selectel/go-selvpcclient/v4/selvpcclient/resell/v2/projects"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion selectel/domains_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
domainsV2 "github.com/selectel/domains-go/pkg/v2"
)

var ErrProjectIDNotSetupForDNSV2 = errors.New("env variable SEL_PROJECT_ID or variable project_id must be set for the dns v2")
var ErrProjectIDNotSetupForDNSV2 = errors.New("env variable INFRA_PROJECT_ID or variable project_id must be set for the dns v2")

func getDomainsV2Client(d *schema.ResourceData, meta interface{}) (domainsV2.DNSClient[domainsV2.Zone, domainsV2.RRSet], error) {
config := meta.(*Config)
Expand Down
2 changes: 1 addition & 1 deletion selectel/iam.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/selectel/go-selvpcclient/v3/selvpcclient"
"github.com/selectel/go-selvpcclient/v4/selvpcclient"
"github.com/selectel/iam-go"
"github.com/selectel/iam-go/service/roles"
"github.com/selectel/iam-go/service/users"
Expand Down
2 changes: 1 addition & 1 deletion selectel/import_selectel_domains_rrset_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

func TestAccDomainsRRSetV2ImportBasic(t *testing.T) {
projectID := os.Getenv("SEL_PROJECT_ID")
projectID := os.Getenv("INFRA_PROJECT_ID")
testZoneName := fmt.Sprintf("%s.xyz.", acctest.RandomWithPrefix("tf-acc"))
testRRSetName := fmt.Sprintf("%[1]s.%[2]s", acctest.RandomWithPrefix("tf-acc"), testZoneName)
testRRSetType := domainsV2.TXT
Expand Down
2 changes: 1 addition & 1 deletion selectel/import_selectel_domains_zone_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

func TestAccDomainsZoneV2ImportBasic(t *testing.T) {
projectID := os.Getenv("SEL_PROJECT_ID")
projectID := os.Getenv("INFRA_PROJECT_ID")
fullResourceName := fmt.Sprintf("selectel_domains_zone_v2.%[1]s", resourceZoneName)
testZoneName := fmt.Sprintf("%s.xyz.", acctest.RandomWithPrefix("tf-acc"))
resource.Test(t, resource.TestCase{
Expand Down
1 change: 0 additions & 1 deletion selectel/import_selectel_iam_user_v1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

func TestAccSecretsManagerCertificateV1ImportBasic(t *testing.T) {
projectID := os.Getenv("SEL_PROJECT_ID")
projectID := os.Getenv("INFRA_PROJECT_ID")
resourceName := "selectel_secretsmanager_certificate_v1.certificate_tf_acc_test_1"

certificateName := acctest.RandomWithPrefix("tf-acc")
Expand Down
2 changes: 1 addition & 1 deletion selectel/import_selectel_secretsmanager_secret_v1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

func TestAccSecretsManagerSecretV1ImportBasic(t *testing.T) {
projectID := os.Getenv("SEL_PROJECT_ID")
projectID := os.Getenv("INFRA_PROJECT_ID")

resourceName := "selectel_secretsmanager_secret_v1.secret_tf_acc_test_1"

Expand Down
2 changes: 1 addition & 1 deletion selectel/messages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package selectel
import (
"testing"

"github.com/selectel/go-selvpcclient/v3/selvpcclient/resell/v2/keypairs"
"github.com/selectel/go-selvpcclient/v4/selvpcclient/resell/v2/keypairs"
"github.com/stretchr/testify/assert"
)

Expand Down
Loading
Loading