Skip to content

Commit 27a3486

Browse files
chore: Updates Atlas Go SDK and unifies resource prefix names in tests (#1966)
* build(deps): bump go.mongodb.org/atlas-sdk * revert changes in v20231001002 * fix teams * TestStepCheckEmptyPlan * update linter * update mockery * remove unneeded linter rules * random name functions * RandomIP * more random name functions [skip ci] * fix backup schedule imports [skip ci] * run ci --------- Co-authored-by: lantoli <[email protected]>
1 parent 5aa9dfd commit 27a3486

File tree

182 files changed

+576
-613
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+576
-613
lines changed

.github/workflows/code-health.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
- name: golangci-lint
6161
uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804
6262
with:
63-
version: v1.55.0
63+
version: v1.56.2
6464
website-lint:
6565
runs-on: ubuntu-latest
6666
steps:

.golangci.yml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ linters-settings:
66
- opinionated
77
- performance
88
- style
9-
disabled-checks:
10-
- octalLiteral
119
govet:
1210
check-shadowing: true
1311
enable:
@@ -120,23 +118,8 @@ linters:
120118
# - gocognit
121119
issues:
122120
exclude:
123-
- composite literal uses unkeyed fields
124-
- Using the variable on range scope .* in function literal
125121
- declaration of ".*" shadows declaration at line .*
126-
- only one cuddle assignment allowed before if statement
127-
- func `testAccMongoDBAtlasThirdPartyIntegrationDataSourceConfig` is unused
128-
- func `testAccMongoDBAtlasAlertConfigurationConfigWithThresholdUpdated` is unused
129-
- func `testAccMongoDBAtlasAlertConfigurationConfigWithMatchers` is unused
130-
- func `testAccDSMongoDBAtlasAlertConfigurationConfigWithThreshold` is unused
131-
- func `testAccMongoDBAtlasCloudProviderSnapshotRestoreJobConfigPointInTime` is unused
132-
- func `testAccMongoDBAtlasCloudBackupScheduleExportPoliciesConfig` is unused
133122
exclude-rules:
134-
- path: _test\.go
135-
linters:
136-
- testpackage
137-
# part of the golangci govet package is picking up things that go vet doesn't. Seems flaky, shutting that specific error off
138-
139-
# Exclude some staticcheck messages
140123
- linters:
141124
- staticcheck
142125
text: "SA1019:" # d.GetOkExists is deprecated: usage is discouraged due to undefined behaviors and may be removed in a future version of the SDK

GNUmakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ GITTAG=$(shell git describe --always --tags)
1313
VERSION=$(GITTAG:v%=%)
1414
LINKER_FLAGS=-s -w -X 'github.com/mongodb/terraform-provider-mongodbatlas/version.ProviderVersion=${VERSION}'
1515

16-
GOLANGCI_VERSION=v1.55.0
17-
MOCKERY_VERSION=v2.38.0
16+
GOLANGCI_VERSION=v1.56.2
17+
MOCKERY_VERSION=v2.42.0
1818

1919
export PATH := $(shell go env GOPATH)/bin:$(PATH)
2020
export SHELL := env PATH=$(PATH) /bin/bash

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ require (
2626
github.com/zclconf/go-cty v1.14.2
2727
go.mongodb.org/atlas v0.36.0
2828
go.mongodb.org/atlas-sdk/v20231001002 v20231001002.0.0
29-
go.mongodb.org/atlas-sdk/v20231115006 v20231115006.0.0
29+
go.mongodb.org/atlas-sdk/v20231115007 v20231115007.0.0
3030
go.mongodb.org/realm v0.1.0
3131
)
3232

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,8 +759,8 @@ go.mongodb.org/atlas v0.36.0 h1:m05S3AO7zkl+bcG1qaNsEKBnAqnKx2FDwLooHpIG3j4=
759759
go.mongodb.org/atlas v0.36.0/go.mod h1:nfPldE9dSama6G2IbIzmEza02Ly7yFZjMMVscaM0uEc=
760760
go.mongodb.org/atlas-sdk/v20231001002 v20231001002.0.0 h1:h1X2CGKyN1UFvNs69vp7xpufbbreq6p7bbrg5uJ1sxw=
761761
go.mongodb.org/atlas-sdk/v20231001002 v20231001002.0.0/go.mod h1:4TAUPaWPFNSbi8c1hbQLr1wAdkmqi48O7zvyXjBM+a8=
762-
go.mongodb.org/atlas-sdk/v20231115006 v20231115006.0.0 h1:3FvL4J1Ni/4PR2P0Gapo3wJ6w/6RpFbaJd/IGrTYgMQ=
763-
go.mongodb.org/atlas-sdk/v20231115006 v20231115006.0.0/go.mod h1:R0s6He5geum/u75tpnww4nbPGVFnGO1vVp8Heiq6aq8=
762+
go.mongodb.org/atlas-sdk/v20231115007 v20231115007.0.0 h1:gvUBkSoeNtM9FSBQy8rh6cm6qXn4yXbQGzK09X0eAdk=
763+
go.mongodb.org/atlas-sdk/v20231115007 v20231115007.0.0/go.mod h1:JU7JOUGcv7pfDzbRTwIr8hGy2R1lehdrdfGj9fDjSVY=
764764
go.mongodb.org/realm v0.1.0 h1:zJiXyLaZrznQ+Pz947ziSrDKUep39DO4SfA0Fzx8M4M=
765765
go.mongodb.org/realm v0.1.0/go.mod h1:4Vj6iy+Puo1TDERcoh4XZ+pjtwbOzPpzqy3Cwe8ZmDM=
766766
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=

integrationtesting/resource_mongodbatlas_encryption_at_rest_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"testing"
77

88
"github.com/gruntwork-io/terratest/modules/terraform"
9-
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
9+
"github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc"
1010
)
1111

1212
func TestTerraformResourceMongoDBAtlasEncryptionAtRestWithRole_basicAWS(t *testing.T) {
@@ -90,10 +90,9 @@ func TestResourceEncryptionAtRestAws(t *testing.T) {
9090

9191
var (
9292
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID")
93-
projectName = acctest.RandomWithPrefix("test-acc")
93+
projectName = acc.RandomProjectName()
9494
publicKey = mongoSecrets.PublicKey
9595
privateKey = mongoSecrets.PrivateKey
96-
9796
awsAccess = awsSecrets.AccessKey
9897
awsSecret = awsSecrets.SecretKey
9998
awsCustomer = awsSecrets.CustomerMasterKey
@@ -136,7 +135,7 @@ func TestResourceEncryptionAtRestAzure(t *testing.T) {
136135

137136
var (
138137
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID")
139-
projectName = acctest.RandomWithPrefix("test-acc")
138+
projectName = acc.RandomProjectName()
140139
publicKey = mongoSecrets.PublicKey
141140
privateKey = mongoSecrets.PrivateKey
142141

@@ -190,7 +189,7 @@ func TestResourceEncryptionAtRestGCP(t *testing.T) {
190189

191190
var (
192191
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID")
193-
projectName = acctest.RandomWithPrefix("test-acc")
192+
projectName = acc.RandomProjectName()
194193
publicKey = mongoSecrets.PublicKey
195194
privateKey = mongoSecrets.PrivateKey
196195

integrationtesting/test-upgrades_test.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/gruntwork-io/terratest/modules/terraform"
1313
test_structure "github.com/gruntwork-io/terratest/modules/test-structure"
1414
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
15+
"github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc"
1516
)
1617

1718
var (
@@ -22,13 +23,12 @@ func TestUpgradeNetworkContainerRegionsGCP(t *testing.T) {
2223
t.Parallel()
2324

2425
var (
25-
randInt = acctest.RandIntRange(0, 255)
2626
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID")
2727
projectID = os.Getenv("MONGODB_ATLAS_PROJECT_ID")
28-
atlasCIDRBlock = fmt.Sprintf("10.%d.0.0/18", randInt)
29-
providerName = "GCP"
3028
publicKey = os.Getenv("MONGODB_ATLAS_PUBLIC_KEY")
3129
privateKey = os.Getenv("MONGODB_ATLAS_PRIVATE_KEY")
30+
providerName = "GCP"
31+
atlasCIDRBlock = fmt.Sprintf("10.%d.0.0/18", acctest.RandIntRange(0, 255))
3232
)
3333
// Construct the terraform options with default retryable errors to handle the most common
3434
// retryable errors in terraform testing.
@@ -80,7 +80,7 @@ func TestUpgradeDatabaseUserLDAPAuthType(t *testing.T) {
8080

8181
var (
8282
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID")
83-
projectName = acctest.RandomWithPrefix("test-acc")
83+
projectName = acc.RandomProjectName()
8484
roleName = "atlasAdmin"
8585
username = "[email protected],OU=users,DC=example,DC=com"
8686
publicKey = os.Getenv("MONGODB_ATLAS_PUBLIC_KEY")
@@ -146,8 +146,8 @@ func TestUpgradeClusterDeprecationEBSVolume(t *testing.T) {
146146

147147
var (
148148
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID")
149-
projectName = acctest.RandomWithPrefix("test-acc")
150-
clusterName = acctest.RandomWithPrefix("test-acc")
149+
projectName = acc.RandomProjectName()
150+
clusterName = acc.RandomClusterName()
151151
publicKey = os.Getenv("MONGODB_ATLAS_PUBLIC_KEY")
152152
privateKey = os.Getenv("MONGODB_ATLAS_PRIVATE_KEY")
153153
majorVersion = testAccGetMongoDBAtlasMajorVersion()
@@ -204,7 +204,7 @@ func TestUpgradePrivateEndpoint(t *testing.T) {
204204

205205
var (
206206
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID")
207-
projectName = acctest.RandomWithPrefix("test-acc")
207+
projectName = acc.RandomProjectName()
208208
publicKey = os.Getenv("MONGODB_ATLAS_PUBLIC_KEY")
209209
privateKey = os.Getenv("MONGODB_ATLAS_PRIVATE_KEY")
210210
baseURL = os.Getenv("MONGODB_ATLAS_BASE_URL")
@@ -279,10 +279,10 @@ func TestUpgradeProjectIPWhitelistDeprecation(t *testing.T) {
279279

280280
var (
281281
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID")
282-
projectName = acctest.RandomWithPrefix("test-acc")
282+
projectName = acc.RandomProjectName()
283283
publicKey = os.Getenv("MONGODB_ATLAS_PUBLIC_KEY")
284284
privateKey = os.Getenv("MONGODB_ATLAS_PRIVATE_KEY")
285-
ipAddress = fmt.Sprintf("179.154.226.%d", acctest.RandIntRange(0, 255))
285+
ipAddress = acc.RandomIP(179, 154, 226)
286286
comment = fmt.Sprintf("TestAcc for ipAddress (%s)", ipAddress)
287287
)
288288
// Construct the terraform options with default retryable errors to handle the most common
@@ -339,8 +339,8 @@ func TestUpgradeDesignIDState(t *testing.T) {
339339

340340
var (
341341
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID")
342-
projectName = acctest.RandomWithPrefix("test-acc")
343-
clusterName = acctest.RandomWithPrefix("test-acc")
342+
projectName = acc.RandomProjectName()
343+
clusterName = acc.RandomClusterName()
344344
description = fmt.Sprintf("My description in %s", clusterName)
345345
retentionInDays = "1"
346346
publicKey = mongoSecrets.PublicKey
@@ -466,7 +466,7 @@ func TestUpgradePrivateLinkEndpointDeprecation(t *testing.T) {
466466

467467
var (
468468
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID")
469-
projectName = acctest.RandomWithPrefix("test-acc")
469+
projectName = acc.RandomProjectName()
470470
publicKey = os.Getenv("MONGODB_ATLAS_PUBLIC_KEY")
471471
privateKey = os.Getenv("MONGODB_ATLAS_PRIVATE_KEY")
472472
awsAccess = os.Getenv("AWS_ACCESS_KEY_ID")
@@ -538,10 +538,10 @@ func TestUpgradeCloudBackupPolicies(t *testing.T) {
538538

539539
var (
540540
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID")
541-
projectName = acctest.RandomWithPrefix("test-acc")
541+
projectName = acc.RandomProjectName()
542542
publicKey = os.Getenv("MONGODB_ATLAS_PUBLIC_KEY")
543543
privateKey = os.Getenv("MONGODB_ATLAS_PRIVATE_KEY")
544-
clusterName = fmt.Sprintf("test-acc-%s", acctest.RandString(10))
544+
clusterName = acc.RandomClusterName()
545545
)
546546
// Construct the terraform options with default retryable errors to handle the most common
547547
// retryable errors in terraform testing.
@@ -597,7 +597,7 @@ func TestUpgradeEncryptionAtRestAws(t *testing.T) {
597597

598598
var (
599599
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID")
600-
projectName = acctest.RandomWithPrefix("test-acc")
600+
projectName = acc.RandomProjectName()
601601
publicKey = mongoSecrets.PublicKey
602602
privateKey = mongoSecrets.PrivateKey
603603

@@ -664,7 +664,7 @@ func TestUpgradeEncryptionAtRestAzure(t *testing.T) {
664664

665665
var (
666666
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID")
667-
projectName = acctest.RandomWithPrefix("test-acc")
667+
projectName = acc.RandomProjectName()
668668
publicKey = mongoSecrets.PublicKey
669669
privateKey = mongoSecrets.PrivateKey
670670

@@ -739,7 +739,7 @@ func TestUpgradeEncryptionAtRestGCP(t *testing.T) {
739739

740740
var (
741741
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID")
742-
projectName = acctest.RandomWithPrefix("test-acc")
742+
projectName = acc.RandomProjectName()
743743
publicKey = mongoSecrets.PublicKey
744744
privateKey = mongoSecrets.PrivateKey
745745

@@ -798,8 +798,8 @@ func TestUpgradeCloudBackupSnapshot(t *testing.T) {
798798

799799
var (
800800
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID")
801-
projectName = acctest.RandomWithPrefix("test-acc")
802-
clusterName = fmt.Sprintf("test-acc-%s", acctest.RandString(10))
801+
projectName = acc.RandomProjectName()
802+
clusterName = acc.RandomClusterName()
803803
)
804804
// Construct the terraform options with default retryable errors to handle the most common
805805
// retryable errors in terraform testing.

internal/common/conversion/flatten_expand.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package conversion
33
import (
44
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
55

6-
"go.mongodb.org/atlas-sdk/v20231115006/admin"
6+
"go.mongodb.org/atlas-sdk/v20231115007/admin"
77
)
88

99
func FlattenLinks(links []admin.Link) []map[string]string {

internal/config/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/mongodb/terraform-provider-mongodbatlas/version"
1414
"github.com/spf13/cast"
1515
admin20231001002 "go.mongodb.org/atlas-sdk/v20231001002/admin"
16-
"go.mongodb.org/atlas-sdk/v20231115006/admin"
16+
"go.mongodb.org/atlas-sdk/v20231115007/admin"
1717
matlasClient "go.mongodb.org/atlas/mongodbatlas"
1818
realmAuth "go.mongodb.org/realm/auth"
1919
"go.mongodb.org/realm/realm"

internal/provider/provider_authentication_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@ import (
44
"os"
55
"testing"
66

7-
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
87
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
98
"github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc"
10-
"go.mongodb.org/atlas-sdk/v20231115006/admin"
9+
"go.mongodb.org/atlas-sdk/v20231115007/admin"
1110
)
1211

1312
func TestAccSTSAssumeRole_basic(t *testing.T) {
1413
var (
1514
resourceName = "mongodbatlas_project.test"
16-
projectName = acctest.RandomWithPrefix("test-acc")
15+
projectName = acc.RandomProjectName()
1716
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID")
1817
clusterCount = "0"
1918
)

internal/service/accesslistapikey/data_source_accesslist_api_key_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"os"
66
"testing"
77

8-
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
98
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
109
"github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc"
1110
)
@@ -14,8 +13,8 @@ func TestAccConfigDSAccesslistAPIKey_basic(t *testing.T) {
1413
resourceName := "mongodbatlas_access_list_api_key.test"
1514
dataSourceName := "data.mongodbatlas_access_list_api_key.test"
1615
orgID := os.Getenv("MONGODB_ATLAS_ORG_ID")
17-
description := fmt.Sprintf("test-acc-accesslist-api_key-%s", acctest.RandString(5))
18-
ipAddress := fmt.Sprintf("179.154.226.%d", acctest.RandIntRange(0, 255))
16+
description := acc.RandomName()
17+
ipAddress := acc.RandomIP(179, 154, 226)
1918

2019
resource.ParallelTest(t, resource.TestCase{
2120
PreCheck: func() { acc.PreCheckBasic(t) },

internal/service/accesslistapikey/data_source_accesslist_api_keys.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion"
1111
"github.com/mongodb/terraform-provider-mongodbatlas/internal/config"
1212

13-
"go.mongodb.org/atlas-sdk/v20231115006/admin"
13+
"go.mongodb.org/atlas-sdk/v20231115007/admin"
1414
)
1515

1616
func PluralDataSource() *schema.Resource {

internal/service/accesslistapikey/data_source_accesslist_api_keys_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ import (
55
"os"
66
"testing"
77

8-
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
98
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
109
"github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc"
1110
)
1211

1312
func TestAccConfigDSAccesslistAPIKeys_basic(t *testing.T) {
14-
resourceName := "mongodbatlas_access_list_api_key.test"
15-
dataSourceName := "data.mongodbatlas_access_list_api_keys.test"
16-
orgID := os.Getenv("MONGODB_ATLAS_ORG_ID")
17-
description := fmt.Sprintf("test-acc-accesslist-api_keys-%s", acctest.RandString(5))
18-
ipAddress := fmt.Sprintf("179.154.226.%d", acctest.RandIntRange(0, 255))
13+
var (
14+
resourceName = "mongodbatlas_access_list_api_key.test"
15+
dataSourceName = "data.mongodbatlas_access_list_api_keys.test"
16+
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID")
17+
description = acc.RandomName()
18+
ipAddress = acc.RandomIP(179, 154, 226)
19+
)
1920

2021
resource.ParallelTest(t, resource.TestCase{
2122
PreCheck: func() { acc.PreCheckBasic(t) },

internal/service/accesslistapikey/resource_access_list_api_key.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
1414
"github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion"
1515
"github.com/mongodb/terraform-provider-mongodbatlas/internal/config"
16-
"go.mongodb.org/atlas-sdk/v20231115006/admin"
16+
"go.mongodb.org/atlas-sdk/v20231115007/admin"
1717
)
1818

1919
func Resource() *schema.Resource {

internal/service/accesslistapikey/resource_access_list_api_key_migration_test.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
package accesslistapikey_test
22

33
import (
4-
"fmt"
54
"os"
65
"testing"
76

8-
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
97
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
108
"github.com/hashicorp/terraform-plugin-testing/plancheck"
119
"github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc"
1210
"github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/mig"
1311
)
1412

1513
func TestAccMigrationProjectAccesslistAPIKey_SettingIPAddress(t *testing.T) {
16-
resourceName := "mongodbatlas_access_list_api_key.test"
17-
orgID := os.Getenv("MONGODB_ATLAS_ORG_ID")
18-
ipAddress := fmt.Sprintf("179.154.226.%d", acctest.RandIntRange(0, 255))
19-
description := fmt.Sprintf("test-acc-access_list-api_key-%s", acctest.RandString(5))
14+
var (
15+
resourceName = "mongodbatlas_access_list_api_key.test"
16+
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID")
17+
ipAddress = acc.RandomIP(179, 154, 226)
18+
description = acc.RandomName()
19+
)
2020

2121
resource.Test(t, resource.TestCase{
2222
PreCheck: func() { mig.PreCheckBasic(t) },
@@ -46,10 +46,12 @@ func TestAccMigrationProjectAccesslistAPIKey_SettingIPAddress(t *testing.T) {
4646
}
4747

4848
func TestAccMigrationProjectAccesslistAPIKey_SettingCIDRBlock(t *testing.T) {
49-
resourceName := "mongodbatlas_access_list_api_key.test"
50-
orgID := os.Getenv("MONGODB_ATLAS_ORG_ID")
51-
cidrBlock := fmt.Sprintf("179.154.226.%d/32", acctest.RandIntRange(0, 255))
52-
description := fmt.Sprintf("test-acc-access_list-api_key-%s", acctest.RandString(5))
49+
var (
50+
resourceName = "mongodbatlas_access_list_api_key.test"
51+
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID")
52+
cidrBlock = acc.RandomIP(179, 154, 226) + "/32"
53+
description = acc.RandomName()
54+
)
5355

5456
resource.Test(t, resource.TestCase{
5557
PreCheck: func() { mig.PreCheckBasic(t) },

0 commit comments

Comments
 (0)