diff --git a/go.mod b/go.mod index 98fa8c1d..801c1418 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.1 github.com/selectel/dbaas-go v0.7.0 github.com/selectel/domains-go v0.4.0 - github.com/selectel/go-selvpcclient v1.12.0 + github.com/selectel/go-selvpcclient/v2 v2.1.0 github.com/selectel/mks-go v0.12.0 github.com/stretchr/testify v1.7.0 ) diff --git a/go.sum b/go.sum index 1f62a627..dde87550 100644 --- a/go.sum +++ b/go.sum @@ -294,8 +294,8 @@ github.com/selectel/dbaas-go v0.7.0 h1:IBEU7EAPlkQ7wGjtIz9bppthpTZLGn3E6TVX7JWMt github.com/selectel/dbaas-go v0.7.0/go.mod h1:8D945oFzpx94v08zIb4s1bRTPCdPoNVnBu4umMYFJrQ= github.com/selectel/domains-go v0.4.0 h1:mVUeJK8oW9XMizft7Vu4OCyvjbzq4+o+zHgzJ2ZxnIY= github.com/selectel/domains-go v0.4.0/go.mod h1:AhXhwyMSTkpEWFiBLUvzFP76W+WN+ZblwmjLJLt7y58= -github.com/selectel/go-selvpcclient v1.12.0 h1:LsT074HOVF1dWYapsAWjaaJDQhmDPpcsVjSwQ1r1fj0= -github.com/selectel/go-selvpcclient v1.12.0/go.mod h1:HNteVXevZMjUCRR6lImTsGZZSTeKu89S/qbEDWDqmgc= +github.com/selectel/go-selvpcclient/v2 v2.1.0 h1:6CblJtXrL03IbBSgVrX2HU92cfiaPMB7v8kbS1mQN3M= +github.com/selectel/go-selvpcclient/v2 v2.1.0/go.mod h1:kFPnYYxcgJHybnmYEmZ9S+G0MNe8wBmYhhCkEqYjAuc= github.com/selectel/mks-go v0.12.0 h1:nLWHK8BXkhFlXvjFqf7WRrdAfvmrOhQzDSLx7BGa6aM= github.com/selectel/mks-go v0.12.0/go.mod h1:FcFqF3WvZIhztyAt1+ZySKf0zWmCEvg9e2gRwxVyQOw= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= diff --git a/selectel/config.go b/selectel/config.go index 6b174f79..e57003b5 100644 --- a/selectel/config.go +++ b/selectel/config.go @@ -6,9 +6,10 @@ import ( "github.com/hashicorp/go-retryablehttp" domainsV1 "github.com/selectel/domains-go/pkg/v1" - "github.com/selectel/go-selvpcclient/selvpcclient" - "github.com/selectel/go-selvpcclient/selvpcclient/resell" - resellV2 "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2" + "github.com/selectel/go-selvpcclient/v2/selvpcclient" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/quotamanager" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell" + resellV2 "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2" ) // Config contains all available configuration options. @@ -51,3 +52,9 @@ func (c *Config) domainsV1Client() *domainsV1.ServiceClient { return domainsClient } + +func (c *Config) quotaManagerRegionalClient( + identity quotamanager.IdentityManagerInterface, +) *quotamanager.QuotaRegionalClient { + return quotamanager.NewQuotaRegionalClient(selvpcclient.NewHTTPClient(), identity) +} diff --git a/selectel/data_source_selectel_dbaas_available_extension_v1_test.go b/selectel/data_source_selectel_dbaas_available_extension_v1_test.go index 919dab8c..972a9ce9 100644 --- a/selectel/data_source_selectel_dbaas_available_extension_v1_test.go +++ b/selectel/data_source_selectel_dbaas_available_extension_v1_test.go @@ -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/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" ) func TestAccDBaaSAvailableExtensionsV1Basic(t *testing.T) { @@ -67,7 +67,6 @@ func testAccDBaaSAvailableExtensionsV1Basic(projectName, name string) string { return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } data "selectel_dbaas_available_extension_v1" "available_extension_tf_acc_test_1" { diff --git a/selectel/data_source_selectel_dbaas_configuration_parameter_v1_test.go b/selectel/data_source_selectel_dbaas_configuration_parameter_v1_test.go index 4ed53cf6..d0aa0445 100644 --- a/selectel/data_source_selectel_dbaas_configuration_parameter_v1_test.go +++ b/selectel/data_source_selectel_dbaas_configuration_parameter_v1_test.go @@ -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/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" ) func TestAccDBaaSConfigurationParametersV1Basic(t *testing.T) { @@ -97,7 +97,6 @@ func testAccDBaaSConfigurationParametersV1Basic(projectName, engine, version, na return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } data "selectel_dbaas_datastore_type_v1" "dt" { diff --git a/selectel/data_source_selectel_dbaas_datastore_type_v1_test.go b/selectel/data_source_selectel_dbaas_datastore_type_v1_test.go index 8ba8450a..4b16fa41 100644 --- a/selectel/data_source_selectel_dbaas_datastore_type_v1_test.go +++ b/selectel/data_source_selectel_dbaas_datastore_type_v1_test.go @@ -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/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" ) func TestAccDBaaSDatastoreTypesV1Basic(t *testing.T) { @@ -69,7 +69,6 @@ func testAccDBaaSDatastoreTypesV1Basic(projectName, engine, version string) stri return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } data "selectel_dbaas_datastore_type_v1" "datastore_type_tf_acc_test_1" { diff --git a/selectel/data_source_selectel_dbaas_flavor_v1_test.go b/selectel/data_source_selectel_dbaas_flavor_v1_test.go index ce95b329..335e4cd6 100644 --- a/selectel/data_source_selectel_dbaas_flavor_v1_test.go +++ b/selectel/data_source_selectel_dbaas_flavor_v1_test.go @@ -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/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" ) func TestAccDBaaSFlavorsV1Basic(t *testing.T) { @@ -82,7 +82,6 @@ func testAccDBaaSFlavorsV1Basic(projectName string) string { return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } data "selectel_dbaas_flavor_v1" "flavor_tf_acc_test_1" { @@ -96,7 +95,6 @@ func testAccDBaaSFlavorsV1RedisFlavor(projectName string) string { return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } data "selectel_dbaas_datastore_type_v1" "dt" { diff --git a/selectel/data_source_selectel_dbaas_prometheus_metric_token_v1_test.go b/selectel/data_source_selectel_dbaas_prometheus_metric_token_v1_test.go index cb41a0de..c820aaef 100644 --- a/selectel/data_source_selectel_dbaas_prometheus_metric_token_v1_test.go +++ b/selectel/data_source_selectel_dbaas_prometheus_metric_token_v1_test.go @@ -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/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" ) func TestAccDBaaSDataSourcePrometheusMetricTokenV1Basic(t *testing.T) { @@ -65,7 +65,6 @@ func testAccDBaaSDataSourcePrometheusMetricTokenV1Basic(projectName string) stri return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } data "selectel_dbaas_prometheus_metric_token_v1" "prometheus_metric_token_tf_acc_test_1" { diff --git a/selectel/data_source_selectel_mks_kube_options_test.go b/selectel/data_source_selectel_mks_kube_options_test.go index 3dea2145..7ba64cdf 100644 --- a/selectel/data_source_selectel_mks_kube_options_test.go +++ b/selectel/data_source_selectel_mks_kube_options_test.go @@ -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/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" ) const ( @@ -208,7 +208,6 @@ func testKubeOptionsV1BasicConfig(projectName, dataSource, kubeVersion string) s return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } data "%s" "dt" { @@ -225,7 +224,6 @@ func testKubeOptionsV1ConfigNoFilter(projectName, dataSource string) string { return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } data "%s" "dt" { diff --git a/selectel/data_source_selectel_mks_kube_versions_v1.go b/selectel/data_source_selectel_mks_kube_versions_v1.go index 23ceb38a..6672ee92 100644 --- a/selectel/data_source_selectel_mks_kube_versions_v1.go +++ b/selectel/data_source_selectel_mks_kube_versions_v1.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/tokens" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/tokens" v1 "github.com/selectel/mks-go/pkg/v1" "github.com/selectel/mks-go/pkg/v1/kubeversion" ) diff --git a/selectel/data_source_selectel_mks_kube_versions_v1_test.go b/selectel/data_source_selectel_mks_kube_versions_v1_test.go index 73a8a029..8e6e1b8c 100644 --- a/selectel/data_source_selectel_mks_kube_versions_v1_test.go +++ b/selectel/data_source_selectel_mks_kube_versions_v1_test.go @@ -51,7 +51,6 @@ func testAccMKSKubeVersionsV1Basic(projectName string) string { return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } data "selectel_mks_kube_versions_v1" "kube_versions_tf_acc_test_1" { diff --git a/selectel/data_source_selectel_mks_kubeconfig_v1.go b/selectel/data_source_selectel_mks_kubeconfig_v1.go index 450c3c1a..14028899 100644 --- a/selectel/data_source_selectel_mks_kubeconfig_v1.go +++ b/selectel/data_source_selectel_mks_kubeconfig_v1.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/tokens" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/tokens" v1 "github.com/selectel/mks-go/pkg/v1" "github.com/selectel/mks-go/pkg/v1/cluster" ) diff --git a/selectel/dbaas.go b/selectel/dbaas.go index 7086add4..70cd53c2 100644 --- a/selectel/dbaas.go +++ b/selectel/dbaas.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/selectel/dbaas-go" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/tokens" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/tokens" ) const ( diff --git a/selectel/messages_test.go b/selectel/messages_test.go index 0717b51b..2f480ff3 100644 --- a/selectel/messages_test.go +++ b/selectel/messages_test.go @@ -3,7 +3,7 @@ package selectel import ( "testing" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/keypairs" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/keypairs" "github.com/stretchr/testify/assert" ) diff --git a/selectel/mks.go b/selectel/mks.go index 042a6d06..2e5894fa 100644 --- a/selectel/mks.go +++ b/selectel/mks.go @@ -12,8 +12,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/quotas" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/tokens" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/quotamanager/quotas" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/tokens" v1 "github.com/selectel/mks-go/pkg/v1" "github.com/selectel/mks-go/pkg/v1/cluster" "github.com/selectel/mks-go/pkg/v1/kubeoptions" @@ -671,7 +671,7 @@ func findQuota(quotas []*quotas.Quota, resource string) []quotas.ResourceQuotaEn return nil } -func checkQuotasForCluster(projectQuotas []*quotas.Quota, region string, zonal bool) error { +func checkQuotasForCluster(projectQuotas []*quotas.Quota, zonal bool) error { var ( clusterQuotaChecked bool quota []quotas.ResourceQuotaEntity @@ -692,16 +692,14 @@ func checkQuotasForCluster(projectQuotas []*quotas.Quota, region string, zonal b } for _, v := range quota { - if v.Region == region { - if v.Value-v.Used <= 0 { - if zonal { - return errors.New("not enough quota to create zonal k8s cluster") - } - - return errors.New("not enough quota to create regional k8s cluster") + if v.Value-v.Used <= 0 { + if zonal { + return errors.New("not enough quota to create zonal k8s cluster") } - clusterQuotaChecked = true + + return errors.New("not enough quota to create regional k8s cluster") } + clusterQuotaChecked = true } if !clusterQuotaChecked { if zonal { diff --git a/selectel/mks_test.go b/selectel/mks_test.go index 3612e457..0852d144 100644 --- a/selectel/mks_test.go +++ b/selectel/mks_test.go @@ -3,7 +3,7 @@ package selectel import ( "testing" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/quotas" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/quotamanager/quotas" "github.com/selectel/mks-go/pkg/v1/kubeversion" "github.com/selectel/mks-go/pkg/v1/node" "github.com/selectel/mks-go/pkg/v1/nodegroup" @@ -678,16 +678,15 @@ func TestCheckQuotasForClusterErrRegional(t *testing.T) { Name: "mks_cluster_regional", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "", - Value: 10, - Used: 10, + Zone: "", + Value: 10, + Used: 10, }, }, }, } - err := checkQuotasForCluster(testQuotas, ru9Region, false) + err := checkQuotasForCluster(testQuotas, false) assert.Error(t, err) assert.Equal(t, "not enough quota to create regional k8s cluster", err.Error()) @@ -699,67 +698,24 @@ func TestCheckQuotasForClusterErrZonal(t *testing.T) { Name: "mks_cluster_zonal", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "", - Value: 10, - Used: 10, + Zone: "", + Value: 10, + Used: 10, }, }, }, } - err := checkQuotasForCluster(testQuotas, ru9Region, true) + err := checkQuotasForCluster(testQuotas, true) assert.Error(t, err) assert.Equal(t, "not enough quota to create zonal k8s cluster", err.Error()) } -func TestCheckQuotasForRegionalClusterErrNoRegion(t *testing.T) { - testQuotas := []*quotas.Quota{ - { - Name: "mks_cluster_regional", - ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ - { - Region: ru1Region, - Zone: "", - Value: 10, - Used: 10, - }, - }, - }, - } - - err := checkQuotasForCluster(testQuotas, ru9Region, false) - - assert.Error(t, err) - assert.Equal(t, "unable to check regional k8s cluster quotas for a given region", err.Error()) -} - -func TestCheckQuotasForZonalClusterErrNoRegion(t *testing.T) { - testQuotas := []*quotas.Quota{ - { - Name: "mks_cluster_zonal", - ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ - { - Region: ru1Region, - Zone: "", - Value: 10, - Used: 10, - }, - }, - }, - } - - err := checkQuotasForCluster(testQuotas, ru9Region, true) - - assert.Error(t, err) - assert.Equal(t, "unable to check zonal k8s cluster quotas for a given region", err.Error()) -} - func TestCheckQuotasForRegionalClusterErrUnableToCheck(t *testing.T) { var testQuotas []*quotas.Quota - err := checkQuotasForCluster(testQuotas, ru9Region, false) + err := checkQuotasForCluster(testQuotas, false) assert.Error(t, err) assert.Equal(t, "unable to find regional k8s cluster quotas", err.Error()) @@ -768,7 +724,7 @@ func TestCheckQuotasForRegionalClusterErrUnableToCheck(t *testing.T) { func TestCheckQuotasForZonalClusterErrUnableToCheck(t *testing.T) { var testQuotas []*quotas.Quota - err := checkQuotasForCluster(testQuotas, ru9Region, true) + err := checkQuotasForCluster(testQuotas, true) assert.Error(t, err) assert.Equal(t, "unable to find zonal k8s cluster quotas", err.Error()) @@ -780,16 +736,15 @@ func TestCheckQuotasForClusterOkRegional(t *testing.T) { Name: "mks_cluster_regional", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "", - Value: 10, - Used: 0, + Zone: "", + Value: 10, + Used: 0, }, }, }, } - assert.NoError(t, checkQuotasForCluster(testQuotas, ru9Region, false)) + assert.NoError(t, checkQuotasForCluster(testQuotas, false)) } func TestCheckQuotasForClusterOkZonal(t *testing.T) { @@ -798,16 +753,15 @@ func TestCheckQuotasForClusterOkZonal(t *testing.T) { Name: "mks_cluster_zonal", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "", - Value: 10, - Used: 0, + Zone: "", + Value: 10, + Used: 0, }, }, }, } - assert.NoError(t, checkQuotasForCluster(testQuotas, ru9Region, true)) + assert.NoError(t, checkQuotasForCluster(testQuotas, true)) } var testQuotasFull = []*quotas.Quota{ @@ -815,10 +769,9 @@ var testQuotasFull = []*quotas.Quota{ Name: "compute_cores", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9a", - Value: 10, - Used: 10, + Zone: "ru-9a", + Value: 10, + Used: 10, }, }, }, @@ -826,10 +779,9 @@ var testQuotasFull = []*quotas.Quota{ Name: "compute_ram", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9a", - Value: 10, - Used: 10, + Zone: "ru-9a", + Value: 10, + Used: 10, }, }, }, @@ -837,10 +789,9 @@ var testQuotasFull = []*quotas.Quota{ Name: "volume_gigabytes_fast", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9a", - Value: 10, - Used: 10, + Zone: "ru-9a", + Value: 10, + Used: 10, }, }, }, @@ -848,10 +799,9 @@ var testQuotasFull = []*quotas.Quota{ Name: "volume_gigabytes_basic", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9a", - Value: 10, - Used: 10, + Zone: "ru-9a", + Value: 10, + Used: 10, }, }, }, @@ -859,10 +809,9 @@ var testQuotasFull = []*quotas.Quota{ Name: "volume_gigabytes_universal", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9a", - Value: 10, - Used: 10, + Zone: "ru-9a", + Value: 10, + Used: 10, }, }, }, @@ -870,10 +819,9 @@ var testQuotasFull = []*quotas.Quota{ Name: "volume_gigabytes_local", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9a", - Value: 10, - Used: 10, + Zone: "ru-9a", + Value: 10, + Used: 10, }, }, }, @@ -981,10 +929,9 @@ func TestCheckQuotasForNodegroupErrUnableToFindCPUQuota(t *testing.T) { Name: "volume_gigabytes_universal", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9a", - Value: 10, - Used: 0, + Zone: "ru-9a", + Value: 10, + Used: 0, }, }, }, @@ -992,10 +939,9 @@ func TestCheckQuotasForNodegroupErrUnableToFindCPUQuota(t *testing.T) { Name: "compute_ram", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9a", - Value: 10, - Used: 0, + Zone: "ru-9a", + Value: 10, + Used: 0, }, }, }, @@ -1021,10 +967,9 @@ func TestCheckQuotasForNodegroupErrUnableToFindRAMQuota(t *testing.T) { Name: "volume_gigabytes_universal", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9a", - Value: 10, - Used: 0, + Zone: "ru-9a", + Value: 10, + Used: 0, }, }, }, @@ -1032,10 +977,9 @@ func TestCheckQuotasForNodegroupErrUnableToFindRAMQuota(t *testing.T) { Name: "compute_cores", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9a", - Value: 10, - Used: 0, + Zone: "ru-9a", + Value: 10, + Used: 0, }, }, }, @@ -1061,10 +1005,9 @@ func TestCheckQuotasForNodegroupErrUnableToFindVolumeQuota(t *testing.T) { Name: "compute_ram", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9a", - Value: 10, - Used: 0, + Zone: "ru-9a", + Value: 10, + Used: 0, }, }, }, @@ -1072,10 +1015,9 @@ func TestCheckQuotasForNodegroupErrUnableToFindVolumeQuota(t *testing.T) { Name: "compute_cores", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9a", - Value: 10, - Used: 0, + Zone: "ru-9a", + Value: 10, + Used: 0, }, }, }, @@ -1101,10 +1043,9 @@ func TestCheckQuotasForNodegroupErrUnableToCheckCPUQuota(t *testing.T) { Name: "compute_ram", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9b", - Value: 10, - Used: 0, + Zone: "ru-9b", + Value: 10, + Used: 0, }, }, }, @@ -1112,10 +1053,9 @@ func TestCheckQuotasForNodegroupErrUnableToCheckCPUQuota(t *testing.T) { Name: "compute_cores", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9a", - Value: 10, - Used: 0, + Zone: "ru-9a", + Value: 10, + Used: 0, }, }, }, @@ -1123,10 +1063,9 @@ func TestCheckQuotasForNodegroupErrUnableToCheckCPUQuota(t *testing.T) { Name: "volume_gigabytes_universal", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9b", - Value: 10, - Used: 0, + Zone: "ru-9b", + Value: 10, + Used: 0, }, }, }, @@ -1153,10 +1092,9 @@ func TestCheckQuotasForNodegroupErrUnableToCheckRAMQuota(t *testing.T) { Name: "compute_ram", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9a", - Value: 10, - Used: 0, + Zone: "ru-9a", + Value: 10, + Used: 0, }, }, }, @@ -1164,10 +1102,9 @@ func TestCheckQuotasForNodegroupErrUnableToCheckRAMQuota(t *testing.T) { Name: "compute_cores", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9b", - Value: 10, - Used: 0, + Zone: "ru-9b", + Value: 10, + Used: 0, }, }, }, @@ -1175,10 +1112,9 @@ func TestCheckQuotasForNodegroupErrUnableToCheckRAMQuota(t *testing.T) { Name: "volume_gigabytes_universal", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9b", - Value: 10, - Used: 0, + Zone: "ru-9b", + Value: 10, + Used: 0, }, }, }, @@ -1204,10 +1140,9 @@ func TestCheckQuotasForNodegroupErrUnableToCheckVolumeQuota(t *testing.T) { Name: "compute_ram", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9b", - Value: 10, - Used: 0, + Zone: "ru-9b", + Value: 10, + Used: 0, }, }, }, @@ -1215,10 +1150,9 @@ func TestCheckQuotasForNodegroupErrUnableToCheckVolumeQuota(t *testing.T) { Name: "compute_cores", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9b", - Value: 10, - Used: 0, + Zone: "ru-9b", + Value: 10, + Used: 0, }, }, }, @@ -1226,10 +1160,9 @@ func TestCheckQuotasForNodegroupErrUnableToCheckVolumeQuota(t *testing.T) { Name: "volume_gigabytes_universal", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9a", - Value: 10, - Used: 0, + Zone: "ru-9a", + Value: 10, + Used: 0, }, }, }, @@ -1255,10 +1188,9 @@ func TestCheckQuotasForNodegroupErrInvalidVolumeType(t *testing.T) { Name: "compute_ram", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9b", - Value: 10, - Used: 0, + Zone: "ru-9b", + Value: 10, + Used: 0, }, }, }, @@ -1266,10 +1198,9 @@ func TestCheckQuotasForNodegroupErrInvalidVolumeType(t *testing.T) { Name: "compute_cores", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9b", - Value: 10, - Used: 0, + Zone: "ru-9b", + Value: 10, + Used: 0, }, }, }, @@ -1277,10 +1208,9 @@ func TestCheckQuotasForNodegroupErrInvalidVolumeType(t *testing.T) { Name: "volume_gigabytes_universal", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9a", - Value: 10, - Used: 0, + Zone: "ru-9a", + Value: 10, + Used: 0, }, }, }, @@ -1303,10 +1233,9 @@ func TestCheckQuotasForNodegroupOk(t *testing.T) { Name: "compute_ram", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9a", - Value: 10, - Used: 0, + Zone: "ru-9a", + Value: 10, + Used: 0, }, }, }, @@ -1314,10 +1243,9 @@ func TestCheckQuotasForNodegroupOk(t *testing.T) { Name: "compute_cores", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9a", - Value: 10, - Used: 0, + Zone: "ru-9a", + Value: 10, + Used: 0, }, }, }, @@ -1325,10 +1253,9 @@ func TestCheckQuotasForNodegroupOk(t *testing.T) { Name: "volume_gigabytes_universal", ResourceQuotasEntities: []quotas.ResourceQuotaEntity{ { - Region: ru9Region, - Zone: "ru-9a", - Value: 10, - Used: 0, + Zone: "ru-9a", + Value: 10, + Used: 0, }, }, }, diff --git a/selectel/networking.go b/selectel/networking.go index 16464218..d774e306 100644 --- a/selectel/networking.go +++ b/selectel/networking.go @@ -5,8 +5,8 @@ import ( "strconv" "strings" - "github.com/selectel/go-selvpcclient/selvpcclient" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/subnets" + "github.com/selectel/go-selvpcclient/v2/selvpcclient" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/subnets" "github.com/terraform-providers/terraform-provider-selectel/selectel/internal/hashcode" ) diff --git a/selectel/networking_test.go b/selectel/networking_test.go index 1a6d9101..5ab8532f 100644 --- a/selectel/networking_test.go +++ b/selectel/networking_test.go @@ -3,8 +3,8 @@ package selectel import ( "testing" - "github.com/selectel/go-selvpcclient/selvpcclient" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/subnets" + "github.com/selectel/go-selvpcclient/v2/selvpcclient" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/subnets" "github.com/stretchr/testify/assert" ) diff --git a/selectel/project.go b/selectel/project.go index cfc34119..6aa9f37a 100644 --- a/selectel/project.go +++ b/selectel/project.go @@ -7,25 +7,27 @@ import ( "net/url" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/projects" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/quotas" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/quotamanager/quotas" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" + resellQuotas "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/quotas" "github.com/terraform-providers/terraform-provider-selectel/selectel/internal/hashcode" ) // resourceVPCProjectV2QuotasOptsFromSet converts the provided quotaSet to // the slice of quotas.QuotaOpts. It then can be used to make requests with // quotas data. -func resourceVPCProjectV2QuotasOptsFromSet(quotaSet *schema.Set) ([]quotas.QuotaOpts, error) { +func resourceVPCProjectV2QuotasOptsFromSet( + quotaSet *schema.Set, +) (map[string]quotas.UpdateProjectQuotasOpts, error) { quotaSetLen := quotaSet.Len() if quotaSetLen == 0 { return nil, errors.New("got empty quotas") } - // Pre-allocate memory for quotasOpts slice since we already know it's length. - quotasOpts := make([]quotas.QuotaOpts, quotaSetLen) + bufferQuotas := map[string]map[string][]quotas.ResourceQuotaOpts{} // Iterate over each billing resource quotas map. - for i, resourceQuotasData := range quotaSet.List() { + for _, resourceQuotasData := range quotaSet.List() { var resourceNameRaw, resourceQuotasRaw interface{} var ok bool @@ -42,11 +44,9 @@ func resourceVPCProjectV2QuotasOptsFromSet(quotaSet *schema.Set) ([]quotas.Quota // in memory as we already know it's length. resourceName := resourceNameRaw.(string) resourceQuotasEntities := resourceQuotasRaw.(*schema.Set) - resourceQuotasOpts := make([]quotas.ResourceQuotaOpts, resourceQuotasEntities.Len()) - // Populate every quotas.ResourceQuotaOpts with data from a single - // resourceQuotasMap's region zone and value. - for j, resourceQuotasEntityRaw := range resourceQuotasEntities.List() { + // Populate bufferedMap with data from a single resourceQuotasMap's region zone and value. + for _, resourceQuotasEntityRaw := range resourceQuotasEntities.List() { var ( resourceQuotasEntityRegion string resourceQuotasEntityZone string @@ -64,19 +64,30 @@ func resourceVPCProjectV2QuotasOptsFromSet(quotaSet *schema.Set) ([]quotas.Quota } // Populate single entity of billing resource data with the region, // zone and value information. - if resourceQuotasEntityRegion != "" { - resourceQuotasOpts[j].Region = &resourceQuotasEntityRegion - } - if resourceQuotasEntityZone != "" { - resourceQuotasOpts[j].Zone = &resourceQuotasEntityZone + + if _, ok := bufferQuotas[resourceQuotasEntityRegion]; !ok { + bufferQuotas[resourceQuotasEntityRegion] = map[string][]quotas.ResourceQuotaOpts{} } - resourceQuotasOpts[j].Value = &resourceQuotasEntityValue + + bufferQuotas[resourceQuotasEntityRegion][resourceName] = append( + bufferQuotas[resourceQuotasEntityRegion][resourceName], quotas.ResourceQuotaOpts{ + Zone: &resourceQuotasEntityZone, + Value: &resourceQuotasEntityValue, + }) + } + } + + quotasOpts := map[string]quotas.UpdateProjectQuotasOpts{} + for region, bufferQuotaOpts := range bufferQuotas { + if _, ok := quotasOpts[region]; !ok { + quotasOpts[region] = quotas.UpdateProjectQuotasOpts{} } - // Populate single quota options element. - quotasOpts[i] = quotas.QuotaOpts{ - Name: resourceName, - ResourceQuotasOpts: resourceQuotasOpts, + for resourceName, resourceQuotasOpts := range bufferQuotaOpts { + quotaOpts := quotas.QuotaOpts{Name: resourceName, ResourceQuotasOpts: resourceQuotasOpts} + regionalOpts := quotasOpts[region] + regionalOpts.QuotasOpts = append(regionalOpts.QuotasOpts, quotaOpts) + quotasOpts[region] = regionalOpts } } @@ -85,7 +96,7 @@ func resourceVPCProjectV2QuotasOptsFromSet(quotaSet *schema.Set) ([]quotas.Quota // resourceVPCProjectV2QuotasToSet converts the provided quotas.Quota slice // to a nested complex set structure correspondingly to the resource's schema. -func resourceVPCProjectV2QuotasToSet(quotasStructures []quotas.Quota) *schema.Set { +func resourceVPCProjectV2QuotasToSet(quotasStructures []resellQuotas.Quota) *schema.Set { quotaSet := &schema.Set{ F: quotasHashSetFunc(), } diff --git a/selectel/project_test.go b/selectel/project_test.go index 6429acd3..1150b3d5 100644 --- a/selectel/project_test.go +++ b/selectel/project_test.go @@ -3,7 +3,7 @@ package selectel import ( "testing" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" "github.com/stretchr/testify/assert" ) diff --git a/selectel/resource_selectel_dbaas_database_v1_test.go b/selectel/resource_selectel_dbaas_database_v1_test.go index 8ec2ae1a..b15b9fc0 100644 --- a/selectel/resource_selectel_dbaas_database_v1_test.go +++ b/selectel/resource_selectel_dbaas_database_v1_test.go @@ -10,7 +10,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/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" ) func TestAccDBaaSDatabaseV1Basic(t *testing.T) { @@ -102,7 +102,6 @@ func testAccDBaaSDatabaseV1Basic(projectName, datastoreName, userName, userPassw return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -154,7 +153,6 @@ func testAccDBaaSDatabaseV1UpdateLocale(projectName, datastoreName, userName, us return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -208,7 +206,6 @@ func testAccDBaaSDatabaseV1UpdateOwnerID(projectName, datastoreName, userName, u return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { diff --git a/selectel/resource_selectel_dbaas_datastore_v1_test.go b/selectel/resource_selectel_dbaas_datastore_v1_test.go index c13241e7..89e7e352 100644 --- a/selectel/resource_selectel_dbaas_datastore_v1_test.go +++ b/selectel/resource_selectel_dbaas_datastore_v1_test.go @@ -11,7 +11,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/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" ) func TestAccDBaaSDatastoreV1Basic(t *testing.T) { @@ -334,7 +334,6 @@ func testAccDBaaSDatastoreV1Basic(projectName, datastoreName string, nodeCount i return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -376,7 +375,6 @@ func testAccDBaaSDatastoreV1UpdateName(projectName, datastoreName string, nodeCo return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -418,7 +416,6 @@ func testAccDBaaSDatastoreV1UpdatePooler(projectName, datastoreName string, node return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -464,7 +461,6 @@ func testAccDBaaSDatastoreV1UpdateFirewall(projectName, datastoreName string, no return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -513,7 +509,6 @@ func testAccDBaaSDatastoreV1Resize(projectName, datastoreName string, nodeCount return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -562,7 +557,6 @@ func testAccDBaaSDatastoreV1UpdateConfig(projectName, datastoreName string, node return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -610,7 +604,6 @@ func testAccDBaaSDatastoreV1RedisBasic(projectName, datastoreName string, nodeCo return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -657,7 +650,6 @@ func testAccDBaaSDatastoreV1UpdateRedisConfig(projectName, datastoreName string, return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -704,7 +696,6 @@ func testAccDBaaSDatastoreV1UpdateRedisPassword(projectName, datastoreName strin return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -751,7 +742,6 @@ func testAccDBaaSDatastoreV1RedisResize(projectName, datastoreName string, nodeC return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { diff --git a/selectel/resource_selectel_dbaas_extension_v1_test.go b/selectel/resource_selectel_dbaas_extension_v1_test.go index 3bbba97e..ce95fa5e 100644 --- a/selectel/resource_selectel_dbaas_extension_v1_test.go +++ b/selectel/resource_selectel_dbaas_extension_v1_test.go @@ -10,7 +10,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/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" ) func TestAccDBaaSExtensionV1Basic(t *testing.T) { @@ -80,7 +80,6 @@ func testAccDBaaSExtensionV1Basic(projectName, datastoreName, userName, userPass return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { diff --git a/selectel/resource_selectel_dbaas_grant_v1_test.go b/selectel/resource_selectel_dbaas_grant_v1_test.go index 4293389b..db8c8546 100644 --- a/selectel/resource_selectel_dbaas_grant_v1_test.go +++ b/selectel/resource_selectel_dbaas_grant_v1_test.go @@ -10,7 +10,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/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" ) func TestAccDBaaSGrantV1Basic(t *testing.T) { @@ -79,7 +79,6 @@ func testAccDBaaSGrantV1Basic(projectName, datastoreName, userName, userPassword return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { diff --git a/selectel/resource_selectel_dbaas_mysql_database_v1_test.go b/selectel/resource_selectel_dbaas_mysql_database_v1_test.go index 996de93a..cd4ff770 100644 --- a/selectel/resource_selectel_dbaas_mysql_database_v1_test.go +++ b/selectel/resource_selectel_dbaas_mysql_database_v1_test.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/selectel/dbaas-go" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" ) func TestAccDBaaSMySQLDatabaseV1Basic(t *testing.T) { @@ -43,7 +43,6 @@ func testAccDBaaSMySQLDatabaseV1Basic(projectName, datastoreName, databaseName s return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { diff --git a/selectel/resource_selectel_dbaas_mysql_datastore_v1_test.go b/selectel/resource_selectel_dbaas_mysql_datastore_v1_test.go index 8bc7bfd7..b6fd4b23 100644 --- a/selectel/resource_selectel_dbaas_mysql_datastore_v1_test.go +++ b/selectel/resource_selectel_dbaas_mysql_datastore_v1_test.go @@ -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/selectel/dbaas-go" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" ) func TestAccDBaaSMySQLDatastoreV1Basic(t *testing.T) { @@ -139,7 +139,6 @@ func testAccDBaaSMySQLDatastoreV1Basic(projectName, datastoreName string, nodeCo return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -180,7 +179,6 @@ func testAccDBaaSMySQLDatastoreV1UpdateName(projectName, datastoreName string, n return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -221,7 +219,6 @@ func testAccDBaaSMySQLDatastoreV1UpdateFirewall(projectName, datastoreName strin return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -265,7 +262,6 @@ func testAccDBaaSMySQLDatastoreV1Resize(projectName, datastoreName string, nodeC return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -309,7 +305,6 @@ func testAccDBaaSMySQLDatastoreV1UpdateConfig(projectName, datastoreName string, return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { diff --git a/selectel/resource_selectel_dbaas_postgresql_database_v1_test.go b/selectel/resource_selectel_dbaas_postgresql_database_v1_test.go index 42fb3e8e..b2d984da 100644 --- a/selectel/resource_selectel_dbaas_postgresql_database_v1_test.go +++ b/selectel/resource_selectel_dbaas_postgresql_database_v1_test.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/selectel/dbaas-go" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" ) func TestAccDBaaSPostgreSQLDatabaseV1Basic(t *testing.T) { @@ -70,7 +70,6 @@ func testAccDBaaSPostgreSQLDatabaseV1Basic(projectName, datastoreName, userName, return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -122,7 +121,6 @@ func testAccDBaaSPostgreSQLDatabaseV1UpdateLocale(projectName, datastoreName, us return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -176,7 +174,6 @@ func testAccDBaaSPostgreSQLDatabaseV1UpdateOwnerID(projectName, datastoreName, u return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { diff --git a/selectel/resource_selectel_dbaas_postgresql_datastore_v1_test.go b/selectel/resource_selectel_dbaas_postgresql_datastore_v1_test.go index b7f520a4..a0b019e5 100644 --- a/selectel/resource_selectel_dbaas_postgresql_datastore_v1_test.go +++ b/selectel/resource_selectel_dbaas_postgresql_datastore_v1_test.go @@ -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/selectel/dbaas-go" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" ) func TestAccDBaaSPostgreSQLDatastoreV1Basic(t *testing.T) { @@ -170,7 +170,6 @@ func testAccDBaaSPostgreSQLDatastoreV1Basic(projectName, datastoreName string, n return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -212,7 +211,6 @@ func testAccDBaaSPostgreSQLDatastoreV1UpdateName(projectName, datastoreName stri return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -254,7 +252,6 @@ func testAccDBaaSPostgreSQLDatastoreV1UpdatePooler(projectName, datastoreName st return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -300,7 +297,6 @@ func testAccDBaaSPostgreSQLDatastoreV1UpdateFirewall(projectName, datastoreName return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -346,7 +342,6 @@ func testAccDBaaSPostgreSQLDatastoreV1Resize(projectName, datastoreName string, return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -392,7 +387,6 @@ func testAccDBaaSPostgreSQLDatastoreV1UpdateConfig(projectName, datastoreName st return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { diff --git a/selectel/resource_selectel_dbaas_postgresql_extension_v1_test.go b/selectel/resource_selectel_dbaas_postgresql_extension_v1_test.go index 9bdb7aa2..81c932ad 100644 --- a/selectel/resource_selectel_dbaas_postgresql_extension_v1_test.go +++ b/selectel/resource_selectel_dbaas_postgresql_extension_v1_test.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/selectel/dbaas-go" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" ) func TestAccDBaaSPostgreSQLExtensionV1Basic(t *testing.T) { @@ -48,7 +48,6 @@ func testAccDBaaSPostgreSQLExtensionV1Basic(projectName, datastoreName, userName return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { diff --git a/selectel/resource_selectel_dbaas_prometheus_metric_token_v1_test.go b/selectel/resource_selectel_dbaas_prometheus_metric_token_v1_test.go index 5663caba..ca8ba3e2 100644 --- a/selectel/resource_selectel_dbaas_prometheus_metric_token_v1_test.go +++ b/selectel/resource_selectel_dbaas_prometheus_metric_token_v1_test.go @@ -10,7 +10,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/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" ) func TestAccDBaaSPrometheusMetricTokenV1Basic(t *testing.T) { @@ -81,7 +81,6 @@ func testAccDBaaSPrometheusMetricTokenV1Basic(projectName, name string) string { return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_dbaas_prometheus_metric_token_v1" "prometheus_metric_token_tf_acc_test_1" { @@ -96,7 +95,6 @@ func testAccDBaaSPrometheusMetricTokenV1Update(projectName, name string) string return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_dbaas_prometheus_metric_token_v1" "prometheus_metric_token_tf_acc_test_1" { diff --git a/selectel/resource_selectel_dbaas_redis_datastore_v1_test.go b/selectel/resource_selectel_dbaas_redis_datastore_v1_test.go index f454f0b5..371087c3 100644 --- a/selectel/resource_selectel_dbaas_redis_datastore_v1_test.go +++ b/selectel/resource_selectel_dbaas_redis_datastore_v1_test.go @@ -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/selectel/dbaas-go" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" ) func TestAccDBaaSRedisDatastoreV1Basic(t *testing.T) { @@ -95,7 +95,6 @@ func testAccDBaaSRedisDatastoreV1Basic(projectName, datastoreName string, nodeCo return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -139,7 +138,6 @@ func testAccDBaaSRedisDatastoreV1UpdateConfig(projectName, datastoreName string, return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -183,7 +181,6 @@ func testAccDBaaSRedisDatastoreV1UpdatePassword(projectName, datastoreName strin return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { @@ -227,7 +224,6 @@ func testAccDBaaSRedisDatastoreV1Resize(projectName, datastoreName string, nodeC return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { diff --git a/selectel/resource_selectel_dbaas_user_v1_test.go b/selectel/resource_selectel_dbaas_user_v1_test.go index 06a3ef25..9c5d2159 100644 --- a/selectel/resource_selectel_dbaas_user_v1_test.go +++ b/selectel/resource_selectel_dbaas_user_v1_test.go @@ -10,7 +10,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/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" ) func TestAccDBaaSUserV1Basic(t *testing.T) { @@ -77,7 +77,6 @@ func testAccDBaaSUserV1Basic(projectName, datastoreName, userName, userPassword return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { diff --git a/selectel/resource_selectel_mks_cluster_v1.go b/selectel/resource_selectel_mks_cluster_v1.go index b0e32e08..cf819c80 100644 --- a/selectel/resource_selectel_mks_cluster_v1.go +++ b/selectel/resource_selectel_mks_cluster_v1.go @@ -15,8 +15,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/quotas" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/tokens" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/quotamanager" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/quotamanager/quotas" + resell "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/tokens" v1 "github.com/selectel/mks-go/pkg/v1" "github.com/selectel/mks-go/pkg/v1/cluster" ) @@ -220,12 +222,17 @@ func resourceMKSClusterV1Create(ctx context.Context, d *schema.ResourceData, met PrivateKubeAPI: &privateKubeAPI, } - projectQuotas, _, err := quotas.GetProjectQuotas(ctx, resellV2Client, d.Get("project_id").(string)) + accountName := strings.Split(config.Token, "_")[1] + openstackClient := resell.NewOpenstackClient(token.ID) + identityManager := quotamanager.NewIdentityManager(resellV2Client, openstackClient, accountName) + quotaManagerClient := config.quotaManagerRegionalClient(identityManager) + + projectQuotas, _, err := quotas.GetProjectQuotas(ctx, quotaManagerClient, d.Get("project_id").(string), region) if err != nil { return diag.FromErr(errGettingObject(objectProjectQuotas, d.Get("project_id").(string), err)) } - if err := checkQuotasForCluster(projectQuotas, region, zonal); err != nil { + if err := checkQuotasForCluster(projectQuotas, zonal); err != nil { return diag.FromErr(errCreatingObject(objectCluster, err)) } diff --git a/selectel/resource_selectel_mks_cluster_v1_test.go b/selectel/resource_selectel_mks_cluster_v1_test.go index 4be70658..8daa4121 100644 --- a/selectel/resource_selectel_mks_cluster_v1_test.go +++ b/selectel/resource_selectel_mks_cluster_v1_test.go @@ -11,8 +11,8 @@ 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/selvpcclient/resell/v2/projects" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/tokens" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/tokens" v1 "github.com/selectel/mks-go/pkg/v1" "github.com/selectel/mks-go/pkg/v1/cluster" "github.com/selectel/mks-go/pkg/v1/kubeoptions" @@ -257,7 +257,6 @@ func testAccMKSClusterV1Basic(projectName, clusterName, kubeVersion, maintenance return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_mks_cluster_v1" "cluster_tf_acc_test_1" { name = "%s" @@ -275,7 +274,6 @@ func testAccMKSClusterV1BasicWithKubeOptions(projectName, clusterName, kubeVersi return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_mks_cluster_v1" "cluster_tf_acc_test_1" { name = "%s" @@ -295,7 +293,6 @@ func testAccMKSClusterV1UpdateWithKubeOptions(projectName, clusterName, kubeVers return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_mks_cluster_v1" "cluster_tf_acc_test_1" { name = "%s" @@ -315,7 +312,6 @@ func testAccMKSClusterV1Zonal(projectName, clusterName, kubeVersion, maintenance return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_mks_cluster_v1" "cluster_tf_acc_test_1" { name = "%s" @@ -332,7 +328,6 @@ func testAccMKSClusterV1PrivateKubeAPI(projectName, clusterName, kubeVersion, ma return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_mks_cluster_v1" "cluster_tf_acc_test_1" { name = "%s" diff --git a/selectel/resource_selectel_mks_nodegroup_v1.go b/selectel/resource_selectel_mks_nodegroup_v1.go index e898d2af..c92745cd 100644 --- a/selectel/resource_selectel_mks_nodegroup_v1.go +++ b/selectel/resource_selectel_mks_nodegroup_v1.go @@ -6,13 +6,16 @@ import ( "fmt" "log" "net/http" + "strings" "time" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/quotas" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/tokens" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/quotamanager" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/quotamanager/quotas" + resell "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/tokens" v1 "github.com/selectel/mks-go/pkg/v1" "github.com/selectel/mks-go/pkg/v1/nodegroup" ) @@ -231,7 +234,12 @@ func resourceMKSNodegroupV1Create(ctx context.Context, d *schema.ResourceData, m AvailabilityZone: d.Get("availability_zone").(string), } - projectQuotas, _, err := quotas.GetProjectQuotas(ctx, resellV2Client, d.Get("project_id").(string)) + accountName := strings.Split(config.Token, "_")[1] + openstackClient := resell.NewOpenstackClient(token.ID) + identityManager := quotamanager.NewIdentityManager(resellV2Client, openstackClient, accountName) + quotaManagerClient := config.quotaManagerRegionalClient(identityManager) + + projectQuotas, _, err := quotas.GetProjectQuotas(ctx, quotaManagerClient, d.Get("project_id").(string), region) if err != nil { return diag.FromErr(errGettingObject(objectProjectQuotas, d.Get("project_id").(string), err)) } @@ -446,7 +454,13 @@ func resourceMKSNodegroupV1Update(ctx context.Context, d *schema.ResourceData, m AvailabilityZone: d.Get("availability_zone").(string), } - projectQuotas, _, err := quotas.GetProjectQuotas(ctx, resellV2Client, d.Get("project_id").(string)) + accountName := strings.Split(config.Token, "_")[1] + openstackClient := resell.NewOpenstackClient(token.ID) + identityManager := quotamanager.NewIdentityManager(resellV2Client, openstackClient, accountName) + quotaManagerClient := config.quotaManagerRegionalClient(identityManager) + + projectQuotas, _, err := quotas.GetProjectQuotas(ctx, quotaManagerClient, d.Get("project_id").(string), + region) if err != nil { return diag.FromErr(errGettingObject(objectProjectQuotas, d.Get("project_id").(string), err)) } diff --git a/selectel/resource_selectel_mks_nodegroup_v1_test.go b/selectel/resource_selectel_mks_nodegroup_v1_test.go index ac87c203..06aea312 100644 --- a/selectel/resource_selectel_mks_nodegroup_v1_test.go +++ b/selectel/resource_selectel_mks_nodegroup_v1_test.go @@ -10,8 +10,8 @@ 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/selvpcclient/resell/v2/projects" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/tokens" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/tokens" v1 "github.com/selectel/mks-go/pkg/v1" "github.com/selectel/mks-go/pkg/v1/nodegroup" ) @@ -150,7 +150,6 @@ func testAccMKSNodegroupV1Basic(projectName, clusterName, kubeVersion, maintenan return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_mks_cluster_v1" "cluster_tf_acc_test_1" { @@ -201,7 +200,6 @@ func testAccMKSNodegroupV1Update(projectName, clusterName, kubeVersion, maintena return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_mks_cluster_v1" "cluster_tf_acc_test_1" { diff --git a/selectel/resource_selectel_vpc_floatingip_v2.go b/selectel/resource_selectel_vpc_floatingip_v2.go index 7a758403..0a173ea2 100644 --- a/selectel/resource_selectel_vpc_floatingip_v2.go +++ b/selectel/resource_selectel_vpc_floatingip_v2.go @@ -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/selvpcclient/resell/v2/floatingips" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/floatingips" ) func resourceVPCFloatingIPV2() *schema.Resource { diff --git a/selectel/resource_selectel_vpc_floatingip_v2_test.go b/selectel/resource_selectel_vpc_floatingip_v2_test.go index 8143923e..629e3217 100644 --- a/selectel/resource_selectel_vpc_floatingip_v2_test.go +++ b/selectel/resource_selectel_vpc_floatingip_v2_test.go @@ -9,8 +9,8 @@ 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/selvpcclient/resell/v2/floatingips" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/floatingips" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" ) func TestAccVPCV2FloatingIPBasic(t *testing.T) { @@ -91,7 +91,6 @@ func testAccVPCV2FloatingIPBasic(projectName string) string { return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_floatingip_v2" "floatingip_tf_acc_test_1" { diff --git a/selectel/resource_selectel_vpc_keypair_v2.go b/selectel/resource_selectel_vpc_keypair_v2.go index d5e28933..d7c5ed87 100644 --- a/selectel/resource_selectel_vpc_keypair_v2.go +++ b/selectel/resource_selectel_vpc_keypair_v2.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/keypairs" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/keypairs" ) func resourceVPCKeypairV2() *schema.Resource { diff --git a/selectel/resource_selectel_vpc_keypair_v2_test.go b/selectel/resource_selectel_vpc_keypair_v2_test.go index ece3cadb..30d09920 100644 --- a/selectel/resource_selectel_vpc_keypair_v2_test.go +++ b/selectel/resource_selectel_vpc_keypair_v2_test.go @@ -9,8 +9,8 @@ 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/selvpcclient/resell/v2/keypairs" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/users" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/keypairs" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/users" "github.com/stretchr/testify/assert" ) diff --git a/selectel/resource_selectel_vpc_license_v2.go b/selectel/resource_selectel_vpc_license_v2.go index e5313bcc..47c16338 100644 --- a/selectel/resource_selectel_vpc_license_v2.go +++ b/selectel/resource_selectel_vpc_license_v2.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/licenses" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/licenses" ) func resourceVPCLicenseV2() *schema.Resource { diff --git a/selectel/resource_selectel_vpc_license_v2_test.go b/selectel/resource_selectel_vpc_license_v2_test.go index faccd576..f95138f9 100644 --- a/selectel/resource_selectel_vpc_license_v2_test.go +++ b/selectel/resource_selectel_vpc_license_v2_test.go @@ -10,8 +10,8 @@ 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/selvpcclient/resell/v2/licenses" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/licenses" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" ) func TestAccVPCV2LicenseBasic(t *testing.T) { diff --git a/selectel/resource_selectel_vpc_project_v2.go b/selectel/resource_selectel_vpc_project_v2.go index 01dae5be..8c12ed68 100644 --- a/selectel/resource_selectel_vpc_project_v2.go +++ b/selectel/resource_selectel_vpc_project_v2.go @@ -4,11 +4,16 @@ import ( "context" "log" "net/http" + "strings" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/projects" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/quotas" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/quotamanager" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/quotamanager/quotas" + v2 "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/tokens" ) func resourceVPCProjectV2() *schema.Resource { @@ -45,11 +50,6 @@ func resourceVPCProjectV2() *schema.Resource { ForceNew: false, Elem: &schema.Schema{Type: schema.TypeString}, }, - "auto_quotas": { - Type: schema.TypeBool, - Optional: true, - ForceNew: false, - }, "quotas": { Type: schema.TypeSet, Optional: true, @@ -77,6 +77,16 @@ func resourceVPCProjectV2() *schema.Resource { Type: schema.TypeString, Optional: true, ForceNew: false, + ValidateFunc: validation.StringInSlice([]string{ + ru1Region, + ru2Region, + ru3Region, + ru7Region, + ru8Region, + ru9Region, + uz1Region, + nl1Region, + }, false), }, "zone": { Type: schema.TypeString, @@ -135,16 +145,8 @@ func resourceVPCProjectV2Create(ctx context.Context, d *schema.ResourceData, met resellV2Client := config.resellV2Client() var opts projects.CreateOpts - quotaSet := d.Get("quotas").(*schema.Set) - if quotaSet.Len() != 0 { - quotasOpts, err := resourceVPCProjectV2QuotasOptsFromSet(quotaSet) - if err != nil { - return diag.FromErr(errParseProjectV2Quotas(err)) - } - opts.Quotas = quotasOpts - } + opts.Name = d.Get("name").(string) - opts.AutoQuotas = d.Get("auto_quotas").(bool) log.Print(msgCreate(objectProject, opts)) project, _, err := projects.Create(ctx, resellV2Client, opts) @@ -202,7 +204,7 @@ func resourceVPCProjectV2Update(ctx context.Context, d *schema.ResourceData, met var hasChange, projectChange, quotaChange bool var projectOpts projects.UpdateOpts - var projectQuotasOpts quotas.UpdateProjectQuotasOpts + var projectQuotasOpts map[string]quotas.UpdateProjectQuotasOpts if d.HasChange("name") { hasChange, projectChange = true, true @@ -226,7 +228,7 @@ func resourceVPCProjectV2Update(ctx context.Context, d *schema.ResourceData, met if err != nil { return diag.FromErr(errParseProjectV2Quotas(err)) } - projectQuotasOpts.QuotasOpts = quotasOpts + projectQuotasOpts = quotasOpts } if hasChange { @@ -241,9 +243,24 @@ func resourceVPCProjectV2Update(ctx context.Context, d *schema.ResourceData, met // Update project quotas if needed. if quotaChange { log.Print(msgUpdate(objectProjectQuotas, d.Id(), projectQuotasOpts)) - _, _, err := quotas.UpdateProjectQuotas(ctx, resellV2Client, d.Id(), projectQuotasOpts) + accountName := strings.Split(config.Token, "_")[1] + tokenOpts := tokens.TokenOpts{AccountName: accountName} + + log.Print(msgCreate(objectToken, tokenOpts)) + token, _, err := tokens.Create(ctx, resellV2Client, tokenOpts) if err != nil { - return diag.FromErr(errUpdatingObject(objectProjectQuotas, d.Id(), err)) + return diag.FromErr(errCreatingObject(objectToken, err)) + } + + openstackClient := v2.NewOpenstackClient(token.ID) + identityManager := quotamanager.NewIdentityManager(resellV2Client, openstackClient, accountName) + quotaManagerClient := config.quotaManagerRegionalClient(identityManager) + + for region, updateQuotas := range projectQuotasOpts { + _, _, err := quotas.UpdateProjectQuotas(ctx, quotaManagerClient, d.Id(), region, updateQuotas) + if err != nil { + return diag.FromErr(errUpdatingObject(objectProjectQuotas, d.Id(), err)) + } } } } diff --git a/selectel/resource_selectel_vpc_project_v2_test.go b/selectel/resource_selectel_vpc_project_v2_test.go index 809ba17f..b42c34c4 100644 --- a/selectel/resource_selectel_vpc_project_v2_test.go +++ b/selectel/resource_selectel_vpc_project_v2_test.go @@ -10,8 +10,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/projects" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/quotas" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/quotamanager/quotas" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" "github.com/stretchr/testify/assert" ) @@ -74,27 +74,6 @@ func TestAccVPCV2ProjectBasic(t *testing.T) { }) } -func TestAccVPCV2ProjectAutoQuotas(t *testing.T) { - var project projects.Project - projectName := acctest.RandomWithPrefix("tf-acc") - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccSelectelPreCheck(t) }, - ProviderFactories: testAccProviders, - CheckDestroy: testAccCheckVPCV2ProjectDestroy, - Steps: []resource.TestStep{ - { - Config: testAccVPCV2ProjectAutoQuotas(projectName), - Check: resource.ComposeTestCheckFunc( - testAccCheckVPCV2ProjectExists("selectel_vpc_project_v2.project_tf_acc_test_1", &project), - resource.TestCheckResourceAttr("selectel_vpc_project_v2.project_tf_acc_test_1", "name", projectName), - resource.TestCheckResourceAttrSet("selectel_vpc_project_v2.project_tf_acc_test_1", "all_quotas.#"), - ), - }, - }, - }) -} - func testAccCheckVPCV2ProjectDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) resellV2Client := config.resellV2Client() @@ -203,14 +182,6 @@ resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { }`, name) } -func testAccVPCV2ProjectAutoQuotas(name string) string { - return fmt.Sprintf(` -resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { - name = "%s" - auto_quotas = true -}`, name) -} - func TestResourceVPCProjectV2QuotasOptsFromSet(t *testing.T) { region := "ru-3" zone := "ru-3a" @@ -232,14 +203,17 @@ func TestResourceVPCProjectV2QuotasOptsFromSet(t *testing.T) { }) expectedResourceQuotaValue := 100 - expectedQuotasOpts := []quotas.QuotaOpts{ - { - Name: "volume_gigabytes_fast", - ResourceQuotasOpts: []quotas.ResourceQuotaOpts{ + expectedQuotasOpts := map[string]quotas.UpdateProjectQuotasOpts{ + region: { + QuotasOpts: []quotas.QuotaOpts{ { - Region: ®ion, - Zone: &zone, - Value: &expectedResourceQuotaValue, + Name: "volume_gigabytes_fast", + ResourceQuotasOpts: []quotas.ResourceQuotaOpts{ + { + Zone: &zone, + Value: &expectedResourceQuotaValue, + }, + }, }, }, }, diff --git a/selectel/resource_selectel_vpc_role_v2.go b/selectel/resource_selectel_vpc_role_v2.go index 375b9a54..aa8ab2f7 100644 --- a/selectel/resource_selectel_vpc_role_v2.go +++ b/selectel/resource_selectel_vpc_role_v2.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/roles" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/roles" ) func resourceVPCRoleV2() *schema.Resource { diff --git a/selectel/resource_selectel_vpc_role_v2_test.go b/selectel/resource_selectel_vpc_role_v2_test.go index d1d09faf..63efed1b 100644 --- a/selectel/resource_selectel_vpc_role_v2_test.go +++ b/selectel/resource_selectel_vpc_role_v2_test.go @@ -9,9 +9,9 @@ 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/selvpcclient/resell/v2/projects" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/roles" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/users" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/roles" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/users" ) func TestAccVPCV2RoleBasic(t *testing.T) { @@ -115,7 +115,6 @@ func testAccVPCV2RoleBasic(projectName, userName, userPassword string) string { return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_user_v2" "user_tf_acc_test_1" { diff --git a/selectel/resource_selectel_vpc_subnet_v2.go b/selectel/resource_selectel_vpc_subnet_v2.go index aa32f089..afeb9784 100644 --- a/selectel/resource_selectel_vpc_subnet_v2.go +++ b/selectel/resource_selectel_vpc_subnet_v2.go @@ -9,8 +9,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/selectel/go-selvpcclient/selvpcclient" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/subnets" + "github.com/selectel/go-selvpcclient/v2/selvpcclient" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/subnets" ) func resourceVPCSubnetV2() *schema.Resource { diff --git a/selectel/resource_selectel_vpc_subnet_v2_test.go b/selectel/resource_selectel_vpc_subnet_v2_test.go index 03195a53..557998a6 100644 --- a/selectel/resource_selectel_vpc_subnet_v2_test.go +++ b/selectel/resource_selectel_vpc_subnet_v2_test.go @@ -10,8 +10,8 @@ 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/selvpcclient/resell/v2/projects" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/subnets" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/subnets" ) func TestAccVPCV2SubnetBasic(t *testing.T) { @@ -92,7 +92,6 @@ func testAccVPCV2SubnetBasic(projectName string) string { return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet_tf_acc_test_1" { diff --git a/selectel/resource_selectel_vpc_token_v2.go b/selectel/resource_selectel_vpc_token_v2.go index dc89c8c3..8bc74409 100644 --- a/selectel/resource_selectel_vpc_token_v2.go +++ b/selectel/resource_selectel_vpc_token_v2.go @@ -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/selvpcclient/resell/v2/tokens" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/tokens" ) func resourceVPCTokenV2() *schema.Resource { diff --git a/selectel/resource_selectel_vpc_token_v2_test.go b/selectel/resource_selectel_vpc_token_v2_test.go index 87498bae..e1fc739b 100644 --- a/selectel/resource_selectel_vpc_token_v2_test.go +++ b/selectel/resource_selectel_vpc_token_v2_test.go @@ -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/selectel/go-selvpcclient/selvpcclient/resell/v2/projects" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/projects" ) func TestAccVPCV2TokenBasic(t *testing.T) { @@ -53,7 +53,6 @@ func testAccVPCV2TokenBasic(projectName string) string { return fmt.Sprintf(` resource "selectel_vpc_project_v2" "project_tf_acc_test_1" { name = "%s" - auto_quotas = true } resource "selectel_vpc_token_v2" "token_tf_acc_test_1" { diff --git a/selectel/resource_selectel_vpc_user_v2.go b/selectel/resource_selectel_vpc_user_v2.go index 9d824199..031f622e 100644 --- a/selectel/resource_selectel_vpc_user_v2.go +++ b/selectel/resource_selectel_vpc_user_v2.go @@ -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/selvpcclient/resell/v2/users" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/users" ) func resourceVPCUserV2() *schema.Resource { diff --git a/selectel/resource_selectel_vpc_user_v2_test.go b/selectel/resource_selectel_vpc_user_v2_test.go index f9275544..a918fadd 100644 --- a/selectel/resource_selectel_vpc_user_v2_test.go +++ b/selectel/resource_selectel_vpc_user_v2_test.go @@ -9,7 +9,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/selvpcclient/resell/v2/users" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/users" ) func TestAccVPCV2UserBasic(t *testing.T) { diff --git a/selectel/resource_selectel_vpc_vrrp_subnet_v2.go b/selectel/resource_selectel_vpc_vrrp_subnet_v2.go index bf81cfe5..5600abd2 100644 --- a/selectel/resource_selectel_vpc_vrrp_subnet_v2.go +++ b/selectel/resource_selectel_vpc_vrrp_subnet_v2.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/selectel/go-selvpcclient/selvpcclient" + "github.com/selectel/go-selvpcclient/v2/selvpcclient" ) func resourceVPCVRRPSubnetV2() *schema.Resource { diff --git a/selectel/servers.go b/selectel/servers.go index 6c93a81c..191809bf 100644 --- a/selectel/servers.go +++ b/selectel/servers.go @@ -3,7 +3,7 @@ package selectel import ( "fmt" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/servers" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/servers" "github.com/terraform-providers/terraform-provider-selectel/selectel/internal/hashcode" ) diff --git a/selectel/servers_test.go b/selectel/servers_test.go index 002d3022..7ea3216b 100644 --- a/selectel/servers_test.go +++ b/selectel/servers_test.go @@ -3,7 +3,7 @@ package selectel import ( "testing" - "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/servers" + "github.com/selectel/go-selvpcclient/v2/selvpcclient/resell/v2/servers" "github.com/stretchr/testify/assert" ) diff --git a/website/docs/d/dbaas_available_extension_v1.html.markdown b/website/docs/d/dbaas_available_extension_v1.html.markdown index f253f497..f8f982cf 100644 --- a/website/docs/d/dbaas_available_extension_v1.html.markdown +++ b/website/docs/d/dbaas_available_extension_v1.html.markdown @@ -14,7 +14,6 @@ Use this data source to get all available extensions within Selectel DBaaS API S ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } data "selectel_dbaas_available_extension_v1" "ae" { diff --git a/website/docs/d/dbaas_configuration_parameter_v1.html.markdown b/website/docs/d/dbaas_configuration_parameter_v1.html.markdown index a3d340e4..a601df1a 100644 --- a/website/docs/d/dbaas_configuration_parameter_v1.html.markdown +++ b/website/docs/d/dbaas_configuration_parameter_v1.html.markdown @@ -14,7 +14,6 @@ Use this data source to get all available confguration parameters within Selecte ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } data "selectel_dbaas_datastore_type_v1" "dt" { diff --git a/website/docs/d/dbaas_datastore_type_v1.html.markdown b/website/docs/d/dbaas_datastore_type_v1.html.markdown index 66d561d0..c2756aa8 100644 --- a/website/docs/d/dbaas_datastore_type_v1.html.markdown +++ b/website/docs/d/dbaas_datastore_type_v1.html.markdown @@ -14,7 +14,6 @@ Use this data source to get all available datastore types within Selectel DBaaS ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } data "selectel_dbaas_datastore_type_v1" "dt" { diff --git a/website/docs/d/dbaas_flavor_v1.html.markdown b/website/docs/d/dbaas_flavor_v1.html.markdown index dca89caf..787131e4 100644 --- a/website/docs/d/dbaas_flavor_v1.html.markdown +++ b/website/docs/d/dbaas_flavor_v1.html.markdown @@ -14,7 +14,6 @@ Use this data source to get all available flavors within Selectel DBaaS API Serv ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } data "selectel_dbaas_flavor_v1" "flavor" { diff --git a/website/docs/d/dbaas_prometheus_metric_token_v1.html.markdown b/website/docs/d/dbaas_prometheus_metric_token_v1.html.markdown index 28df0849..bec16987 100644 --- a/website/docs/d/dbaas_prometheus_metric_token_v1.html.markdown +++ b/website/docs/d/dbaas_prometheus_metric_token_v1.html.markdown @@ -14,7 +14,6 @@ Use this data source to get all available prometheus metrics tokens within Selec ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } data "selectel_dbaas_prometheus_metric_token_v1" "token" { diff --git a/website/docs/d/mks_admission_controllers_v1.html.markdown b/website/docs/d/mks_admission_controllers_v1.html.markdown index cde980c0..58c68c35 100644 --- a/website/docs/d/mks_admission_controllers_v1.html.markdown +++ b/website/docs/d/mks_admission_controllers_v1.html.markdown @@ -14,7 +14,6 @@ Use this data source to get available admission-controllers within Selectel MKS ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } data "selectel_mks_admission_controllers_v1" "ac" { diff --git a/website/docs/d/mks_feature_gates_v1.html.markdown b/website/docs/d/mks_feature_gates_v1.html.markdown index 3ad74bf7..1ce14f37 100644 --- a/website/docs/d/mks_feature_gates_v1.html.markdown +++ b/website/docs/d/mks_feature_gates_v1.html.markdown @@ -14,7 +14,6 @@ Use this data source to get available feature-gates within Selectel MKS API Serv ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } data "selectel_mks_feature_gates_v1" "fg" { diff --git a/website/docs/d/mks_kube_versions_v1.html.markdown b/website/docs/d/mks_kube_versions_v1.html.markdown index 1e9f46e5..e6d6046d 100644 --- a/website/docs/d/mks_kube_versions_v1.html.markdown +++ b/website/docs/d/mks_kube_versions_v1.html.markdown @@ -14,7 +14,6 @@ Use this data source to get all supported kube versions for a Managed Kubernetes ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } data "selectel_mks_kube_versions_v1" "versions" { diff --git a/website/docs/r/dbaas_database_v1.html.markdown b/website/docs/r/dbaas_database_v1.html.markdown index 776cf774..a3f16570 100644 --- a/website/docs/r/dbaas_database_v1.html.markdown +++ b/website/docs/r/dbaas_database_v1.html.markdown @@ -16,7 +16,6 @@ Manages a V1 database resource within Selectel Managed Databases Service. ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet" { diff --git a/website/docs/r/dbaas_datastore_v1.html.markdown b/website/docs/r/dbaas_datastore_v1.html.markdown index 223bf400..1aea0287 100644 --- a/website/docs/r/dbaas_datastore_v1.html.markdown +++ b/website/docs/r/dbaas_datastore_v1.html.markdown @@ -16,7 +16,6 @@ Manages a V1 datastore resource within Selectel Managed Databases Service. ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet" { diff --git a/website/docs/r/dbaas_extension_v1.html.markdown b/website/docs/r/dbaas_extension_v1.html.markdown index 412c4d47..648ecb91 100644 --- a/website/docs/r/dbaas_extension_v1.html.markdown +++ b/website/docs/r/dbaas_extension_v1.html.markdown @@ -16,7 +16,6 @@ Manages a V1 extension resource within Selectel Managed Databases Service. Can b ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet" { diff --git a/website/docs/r/dbaas_grant_v1.html.markdown b/website/docs/r/dbaas_grant_v1.html.markdown index 42091f75..af05efd7 100644 --- a/website/docs/r/dbaas_grant_v1.html.markdown +++ b/website/docs/r/dbaas_grant_v1.html.markdown @@ -14,7 +14,6 @@ Manages a V1 grant resource within Selectel Managed Databases Service. ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet" { diff --git a/website/docs/r/dbaas_mysql_database_v1.html.markdown b/website/docs/r/dbaas_mysql_database_v1.html.markdown index fddcb8aa..46e41d7e 100644 --- a/website/docs/r/dbaas_mysql_database_v1.html.markdown +++ b/website/docs/r/dbaas_mysql_database_v1.html.markdown @@ -14,7 +14,6 @@ Manages a V1 MySQL database resource within Selectel Managed Databases Service. ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet" { diff --git a/website/docs/r/dbaas_mysql_datastore_v1.html.markdown b/website/docs/r/dbaas_mysql_datastore_v1.html.markdown index b39b2b74..8b86c082 100644 --- a/website/docs/r/dbaas_mysql_datastore_v1.html.markdown +++ b/website/docs/r/dbaas_mysql_datastore_v1.html.markdown @@ -14,7 +14,6 @@ Manages a V1 MySQL datastore resource within Selectel Managed Databases Service. ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet" { diff --git a/website/docs/r/dbaas_postgresql_database_v1.html.markdown b/website/docs/r/dbaas_postgresql_database_v1.html.markdown index d626795b..fee1c486 100644 --- a/website/docs/r/dbaas_postgresql_database_v1.html.markdown +++ b/website/docs/r/dbaas_postgresql_database_v1.html.markdown @@ -14,7 +14,6 @@ Manages a V1 PostgreSQL database resource within Selectel Managed Databases Serv ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet" { diff --git a/website/docs/r/dbaas_postgresql_datastore_v1.html.markdown b/website/docs/r/dbaas_postgresql_datastore_v1.html.markdown index 356a03ec..3a399e8b 100644 --- a/website/docs/r/dbaas_postgresql_datastore_v1.html.markdown +++ b/website/docs/r/dbaas_postgresql_datastore_v1.html.markdown @@ -14,7 +14,6 @@ Manages a V1 PostgreSQL datastore resource within Selectel Managed Databases Ser ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet" { diff --git a/website/docs/r/dbaas_postgresql_extension_v1.html.markdown b/website/docs/r/dbaas_postgresql_extension_v1.html.markdown index e059713f..8d0d2b83 100644 --- a/website/docs/r/dbaas_postgresql_extension_v1.html.markdown +++ b/website/docs/r/dbaas_postgresql_extension_v1.html.markdown @@ -16,7 +16,6 @@ Manages a V1 extension resource within Selectel Managed Databases Service. Can b ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet" { diff --git a/website/docs/r/dbaas_prometheus_metric_token_v1.html.markdown b/website/docs/r/dbaas_prometheus_metric_token_v1.html.markdown index 4308e7bc..1896099c 100644 --- a/website/docs/r/dbaas_prometheus_metric_token_v1.html.markdown +++ b/website/docs/r/dbaas_prometheus_metric_token_v1.html.markdown @@ -14,7 +14,6 @@ Manages a V1 prometheus metrics tokens resource within Selectel Managed Database ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } resource "selectel_dbaas_prometheus_metric_token_v1" "token" { diff --git a/website/docs/r/dbaas_redis_datastore_v1.html.markdown b/website/docs/r/dbaas_redis_datastore_v1.html.markdown index d911aec1..178f6e53 100644 --- a/website/docs/r/dbaas_redis_datastore_v1.html.markdown +++ b/website/docs/r/dbaas_redis_datastore_v1.html.markdown @@ -14,7 +14,6 @@ Manages a V1 Redis datastore resource within Selectel Managed Databases Service. ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet" { diff --git a/website/docs/r/dbaas_user_v1.html.markdown b/website/docs/r/dbaas_user_v1.html.markdown index c8560e68..1100fac3 100644 --- a/website/docs/r/dbaas_user_v1.html.markdown +++ b/website/docs/r/dbaas_user_v1.html.markdown @@ -14,7 +14,6 @@ Manages a V1 user resource within Selectel Managed Databases Service. ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } resource "selectel_vpc_subnet_v2" "subnet" { diff --git a/website/docs/r/mks_cluster_v1.html.markdown b/website/docs/r/mks_cluster_v1.html.markdown index 40e47c7e..9db5edbc 100644 --- a/website/docs/r/mks_cluster_v1.html.markdown +++ b/website/docs/r/mks_cluster_v1.html.markdown @@ -14,7 +14,6 @@ Manages a V1 cluster resource within Selectel Managed Kubernetes Service. ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } resource "selectel_mks_cluster_v1" "cluster_1" { diff --git a/website/docs/r/mks_nodegroup_v1.html.markdown b/website/docs/r/mks_nodegroup_v1.html.markdown index 43996ebf..3bbdb136 100644 --- a/website/docs/r/mks_nodegroup_v1.html.markdown +++ b/website/docs/r/mks_nodegroup_v1.html.markdown @@ -14,7 +14,6 @@ Manages a V1 nodegroup resource within Selectel Managed Kubernetes Service. ```hcl resource "selectel_vpc_project_v2" "project_1" { - auto_quotas = true } resource "selectel_mks_cluster_v1" "cluster_1" { @@ -131,4 +130,4 @@ Nodegroup can be imported using a combined ID using the following format: ``