diff --git a/.changelog/2387.txt b/.changelog/2387.txt new file mode 100644 index 0000000000..e56999ff5d --- /dev/null +++ b/.changelog/2387.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/mongodbatlas_cloud_backup_schedule: Updates `copy_settings` on changes (even when empty) +``` \ No newline at end of file diff --git a/.github/workflows/pull-request-lint.yml b/.github/workflows/pull-request-lint.yml index 9acb89bf44..b7746d7a9c 100644 --- a/.github/workflows/pull-request-lint.yml +++ b/.github/workflows/pull-request-lint.yml @@ -17,7 +17,7 @@ jobs: permissions: pull-requests: write # Needed by sticky-pull-request-comment steps: - - uses: amannn/action-semantic-pull-request@cfb60706e18bc85e8aec535e3c577abe8f70378e + - uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 id: lint_pr_title env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index c60444a7c8..d6e4cb9a04 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -10,9 +10,8 @@ on: jobs: stale: runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write + env: + GITHUB_TOKEN: ${{ secrets.APIX_BOT_PAT }} steps: - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e id: stale diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 7a7bf651c1..ff25bb843d 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -6,7 +6,7 @@ on: inputs: terraform_matrix: description: 'Terraform version matrix (JSON array)' - default: '["1.8.x", "1.7.x", "1.6.x", "1.5.x", "1.4.x", "1.3.x", "1.2.x"]' + default: '["1.9.x", "1.8.x", "1.7.x", "1.6.x", "1.5.x", "1.4.x", "1.3.x"]' provider_matrix: description: 'Previous MongoDB Atlas Provider version matrix for migration tests (JSON array)' default: '[""]' # "" for latest version @@ -42,7 +42,7 @@ concurrency: jobs: versions: env: - schedule_terraform_matrix: '["1.8.x"]' + schedule_terraform_matrix: '["${{ vars.TF_VERSION_LATEST }}"]' schedule_provider_matrix: '[""]' # "" for latest version runs-on: ubuntu-latest outputs: diff --git a/.github/workflows/update_tf_compatibility_matrix.yml b/.github/workflows/update_tf_compatibility_matrix.yml index a58fcd74d9..ffa81d48e9 100644 --- a/.github/workflows/update_tf_compatibility_matrix.yml +++ b/.github/workflows/update_tf_compatibility_matrix.yml @@ -30,4 +30,4 @@ jobs: commit-message: "doc: Updates Terraform Compatibility Matrix documentation" delete-branch: true branch: terraform-compatibility-matrix-update - body: Automatic updates for Terraform Compatibility Matrix documentation + body: "Automatic updates for Terraform Compatibility Matrix documentation. **Action Required**: Update test-suite.yml, .tools-version files, and TF_VERSION_LATEST GitHub environment variable if needed." diff --git a/.tool-versions b/.tool-versions index 50fac1e3eb..4277997d39 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ golang 1.22.4 -terraform 1.8.5 +terraform 1.9.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 7be70fce86..590c1da37e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## (Unreleased) +BUG FIXES: + +* resource/mongodbatlas_cloud_backup_schedule: Updates `copy_settings` on changes (even when empty) ([#2387](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/2387)) + +## 1.17.3 (June 27, 2024) + ## 1.17.2 (June 20, 2024) ENHANCEMENTS: diff --git a/go.mod b/go.mod index 619d43ec3d..639d00f8a8 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.22 require ( github.com/andygrunwald/go-jira/v2 v2.0.0-20240116150243-50d59fe116d6 - github.com/aws/aws-sdk-go v1.54.8 + github.com/aws/aws-sdk-go v1.54.13 github.com/go-test/deep v1.1.1 github.com/hashicorp/go-changelog v0.0.0-20240318095659-4d68c58a6e7f github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 @@ -25,7 +25,7 @@ require ( github.com/zclconf/go-cty v1.14.4 go.mongodb.org/atlas v0.36.0 go.mongodb.org/atlas-sdk/v20231115014 v20231115014.0.0 - go.mongodb.org/atlas-sdk/v20240530001 v20240530001.0.1-0.20240628150242-4d7b444ed046 + go.mongodb.org/atlas-sdk/v20240530002 v20240530002.0.1-0.20240703083409-9e77f6cad45f go.mongodb.org/realm v0.1.0 ) diff --git a/go.sum b/go.sum index 8c598994e0..26518e3a50 100644 --- a/go.sum +++ b/go.sum @@ -243,8 +243,8 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkY github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.37.0/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= -github.com/aws/aws-sdk-go v1.54.8 h1:+soIjaRsuXfEJ9ts9poJD2fIIzSSRwfx+T69DrTtL2M= -github.com/aws/aws-sdk-go v1.54.8/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= +github.com/aws/aws-sdk-go v1.54.13 h1:zpCuiG+/mFdDY/klKJvmSioAZWk45F4rLGq0JWVAAzk= +github.com/aws/aws-sdk-go v1.54.13/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= @@ -782,18 +782,10 @@ go.mongodb.org/atlas v0.36.0 h1:m05S3AO7zkl+bcG1qaNsEKBnAqnKx2FDwLooHpIG3j4= go.mongodb.org/atlas v0.36.0/go.mod h1:nfPldE9dSama6G2IbIzmEza02Ly7yFZjMMVscaM0uEc= go.mongodb.org/atlas-sdk/v20231115014 v20231115014.0.0 h1:hN7x3m6THf03q/tE48up1j0U/26lJmx+s1LXB/qvHHc= go.mongodb.org/atlas-sdk/v20231115014 v20231115014.0.0/go.mod h1:pCl46YnWOIde8lq27whXDwUseNeUvtAy3vy5ZDeTcBA= -go.mongodb.org/atlas-sdk/v20240530001 v20240530001.0.0 h1:Lx3SCYLACxii0pqu8ZoeOvTPXNZXn/nejsbxaavacAY= -go.mongodb.org/atlas-sdk/v20240530001 v20240530001.0.0/go.mod h1:xfvOKGvcdJ12uduvUSIIfcHQvEpPXc9UQT+DYUCrmlA= -go.mongodb.org/atlas-sdk/v20240530001 v20240530001.0.1-0.20240614083321-69cb517ed2e5 h1:erJ9+6ONNKQ1LLxpS49qRq8nCrhCLB1nAo8Ntz579O0= -go.mongodb.org/atlas-sdk/v20240530001 v20240530001.0.1-0.20240614083321-69cb517ed2e5/go.mod h1:xfvOKGvcdJ12uduvUSIIfcHQvEpPXc9UQT+DYUCrmlA= -go.mongodb.org/atlas-sdk/v20240530001 v20240530001.0.1-0.20240619083352-d423f3e4cbe1 h1:q7r+JFie1lLZ1+ndlswVxpvWmo9/Bd62fdT2hezWMNk= -go.mongodb.org/atlas-sdk/v20240530001 v20240530001.0.1-0.20240619083352-d423f3e4cbe1/go.mod h1:xfvOKGvcdJ12uduvUSIIfcHQvEpPXc9UQT+DYUCrmlA= -go.mongodb.org/atlas-sdk/v20240530001 v20240530001.0.1-0.20240621083407-1908ed1f83ea h1:0RjNbmuy5swpaV7nFIEd6h6LsAaauPeVBSTaN2xcdzA= -go.mongodb.org/atlas-sdk/v20240530001 v20240530001.0.1-0.20240621083407-1908ed1f83ea/go.mod h1:xfvOKGvcdJ12uduvUSIIfcHQvEpPXc9UQT+DYUCrmlA= -go.mongodb.org/atlas-sdk/v20240530001 v20240530001.0.1-0.20240624083419-fb05c1937b8a h1:9HlqteDe9q+S5A222pfnyHJiYNOBDsXBA1UdESHkhz4= -go.mongodb.org/atlas-sdk/v20240530001 v20240530001.0.1-0.20240624083419-fb05c1937b8a/go.mod h1:xfvOKGvcdJ12uduvUSIIfcHQvEpPXc9UQT+DYUCrmlA= -go.mongodb.org/atlas-sdk/v20240530001 v20240530001.0.1-0.20240628150242-4d7b444ed046 h1:jZLppPtf//Bfc2bSvYAFpxyAHtu0geaxuBeG+L++Fxs= -go.mongodb.org/atlas-sdk/v20240530001 v20240530001.0.1-0.20240628150242-4d7b444ed046/go.mod h1:xFOIZUbSSx4dttH/lQwxnsYS7N3/tPiYPCCwTHaZrtk= +go.mongodb.org/atlas-sdk/v20240530002 v20240530002.0.0 h1:D+e3bpRwa9WH3HHs8bLjOdjTp1vdlp83ZYithzGbaQ8= +go.mongodb.org/atlas-sdk/v20240530002 v20240530002.0.0/go.mod h1:seuG5HpfG20/8FhJGyWi4yL7hqAcmq7pf/G0gipNOyM= +go.mongodb.org/atlas-sdk/v20240530002 v20240530002.0.1-0.20240703083409-9e77f6cad45f h1:p4oDdUBXj4hW/QUwQ6R3Uqx8tMJw1Z8g4b6/hfZBHfk= +go.mongodb.org/atlas-sdk/v20240530002 v20240530002.0.1-0.20240703083409-9e77f6cad45f/go.mod h1:seuG5HpfG20/8FhJGyWi4yL7hqAcmq7pf/G0gipNOyM= go.mongodb.org/realm v0.1.0 h1:zJiXyLaZrznQ+Pz947ziSrDKUep39DO4SfA0Fzx8M4M= go.mongodb.org/realm v0.1.0/go.mod h1:4Vj6iy+Puo1TDERcoh4XZ+pjtwbOzPpzqy3Cwe8ZmDM= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= diff --git a/internal/common/conversion/collections.go b/internal/common/conversion/collections.go new file mode 100644 index 0000000000..c4c14b07e8 --- /dev/null +++ b/internal/common/conversion/collections.go @@ -0,0 +1,24 @@ +package conversion + +import "reflect" + +// HasElementsSliceOrMap checks if param is a non-empty slice or map +func HasElementsSliceOrMap(value any) bool { + v := reflect.ValueOf(value) + if v.Kind() == reflect.Slice || v.Kind() == reflect.Map { + return v.Len() > 0 + } + return false +} + +// ToAnySlicePointer converts to a slice pointer of any as needed in some Atlas SDK Go structs +func ToAnySlicePointer(value *[]map[string]any) *[]any { + if value == nil { + return nil + } + ret := make([]any, len(*value)) + for i, item := range *value { + ret[i] = item + } + return &ret +} diff --git a/internal/common/conversion/collections_test.go b/internal/common/conversion/collections_test.go new file mode 100644 index 0000000000..8132997aa3 --- /dev/null +++ b/internal/common/conversion/collections_test.go @@ -0,0 +1,63 @@ +package conversion_test + +import ( + "testing" + + "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" + "github.com/stretchr/testify/assert" +) + +func TestHasElementsSliceOrMap(t *testing.T) { + testCasesTrue := map[string]any{ + "slice": []string{"hi"}, + "map": map[string]string{"hi": "there"}, + "int int map": map[int]int{1: 2}, + "double map": map[string]map[string]string{ + "hi": {"there": "bye"}, + }, + } + testCasesFalse := map[string]any{ + "nil": nil, + "empty slice": []string{}, + "empty map": map[string]string{}, + "empty int int map": map[int]int{}, + "not a collection but with len": "hello", + "random object": 123, + } + for name, value := range testCasesTrue { + t.Run(name, func(t *testing.T) { + assert.True(t, conversion.HasElementsSliceOrMap(value)) + }) + } + for name, value := range testCasesFalse { + t.Run(name, func(t *testing.T) { + assert.False(t, conversion.HasElementsSliceOrMap(value)) + }) + } +} + +func TestToAnySlicePointer(t *testing.T) { + testCases := map[string]*[]map[string]any{ + "nil": nil, + "empty": {}, + "one element": {{"hi": "there"}}, + "more complex": { + {"hi": "there"}, + {"bye": 1234}, + }, + } + for name, value := range testCases { + t.Run(name, func(t *testing.T) { + ret := conversion.ToAnySlicePointer(value) + if ret == nil { + assert.Nil(t, value) + } else { + assert.NotNil(t, ret) + assert.Equal(t, len(*value), len(*ret)) + for i := range *value { + assert.Equal(t, (*value)[i], (*ret)[i]) + } + } + }) + } +} diff --git a/internal/common/conversion/flatten_expand.go b/internal/common/conversion/flatten_expand.go index 6608020a3a..229934db0e 100644 --- a/internal/common/conversion/flatten_expand.go +++ b/internal/common/conversion/flatten_expand.go @@ -3,7 +3,7 @@ package conversion import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func FlattenLinks(links []admin.Link) []map[string]string { diff --git a/internal/config/client.go b/internal/config/client.go index 70dc9d0daf..5aee0d01e6 100644 --- a/internal/config/client.go +++ b/internal/config/client.go @@ -9,8 +9,8 @@ import ( "strings" "time" - "go.mongodb.org/atlas-sdk/v20231115014/admin" - adminPreview "go.mongodb.org/atlas-sdk/v20240530001/admin" + admin20231115 "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" matlasClient "go.mongodb.org/atlas/mongodbatlas" realmAuth "go.mongodb.org/realm/auth" "go.mongodb.org/realm/realm" @@ -29,10 +29,10 @@ const ( // MongoDBClient contains the mongodbatlas clients and configurations type MongoDBClient struct { - Atlas *matlasClient.Client - AtlasV2 *admin.APIClient - AtlasV2Preview *adminPreview.APIClient - Config *Config + Atlas *matlasClient.Client + AtlasV2 *admin.APIClient + AtlasV220231115 *admin20231115.APIClient + Config *Config } // Config contains the configurations needed to use SDKs @@ -105,16 +105,16 @@ func (c *Config) NewClient(ctx context.Context) (any, error) { return nil, err } - sdkV2PreviewClient, err := c.newSDKV2PreviewClient(client) + sdkV220231115Client, err := c.newSDKV220231115Client(client) if err != nil { return nil, err } clients := &MongoDBClient{ - Atlas: atlasClient, - AtlasV2: sdkV2Client, - AtlasV2Preview: sdkV2PreviewClient, - Config: c, + Atlas: atlasClient, + AtlasV2: sdkV2Client, + AtlasV220231115: sdkV220231115Client, + Config: c, } return clients, nil @@ -136,15 +136,15 @@ func (c *Config) newSDKV2Client(client *http.Client) (*admin.APIClient, error) { return sdkv2, nil } -func (c *Config) newSDKV2PreviewClient(client *http.Client) (*adminPreview.APIClient, error) { - opts := []adminPreview.ClientModifier{ - adminPreview.UseHTTPClient(client), - adminPreview.UseUserAgent(userAgent(c)), - adminPreview.UseBaseURL(c.BaseURL), - adminPreview.UseDebug(false)} +func (c *Config) newSDKV220231115Client(client *http.Client) (*admin20231115.APIClient, error) { + opts := []admin20231115.ClientModifier{ + admin20231115.UseHTTPClient(client), + admin20231115.UseUserAgent(userAgent(c)), + admin20231115.UseBaseURL(c.BaseURL), + admin20231115.UseDebug(false)} // Initialize the MongoDB Versioned Atlas Client. - sdkv2, err := adminPreview.NewClient(opts...) + sdkv2, err := admin20231115.NewClient(opts...) if err != nil { return nil, err } diff --git a/internal/provider/provider_authentication_test.go b/internal/provider/provider_authentication_test.go index b779896002..c91510427b 100644 --- a/internal/provider/provider_authentication_test.go +++ b/internal/provider/provider_authentication_test.go @@ -22,7 +22,7 @@ func TestAccSTSAssumeRole_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configProject(orgID, projectName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "org_id", orgID), resource.TestCheckResourceAttr(resourceName, "name", projectName), resource.TestCheckResourceAttr(resourceName, "cluster_count", "0"), diff --git a/internal/service/accesslistapikey/data_source_accesslist_api_key_test.go b/internal/service/accesslistapikey/data_source_accesslist_api_key_test.go index 72365885c8..a987054317 100644 --- a/internal/service/accesslistapikey/data_source_accesslist_api_key_test.go +++ b/internal/service/accesslistapikey/data_source_accesslist_api_key_test.go @@ -23,7 +23,7 @@ func TestAccConfigDSAccesslistAPIKey_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configDS(orgID, description, ipAddress), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "org_id"), resource.TestCheckResourceAttrSet(resourceName, "ip_address"), diff --git a/internal/service/accesslistapikey/data_source_accesslist_api_keys.go b/internal/service/accesslistapikey/data_source_accesslist_api_keys.go index 73b33e4096..ccc34007c2 100644 --- a/internal/service/accesslistapikey/data_source_accesslist_api_keys.go +++ b/internal/service/accesslistapikey/data_source_accesslist_api_keys.go @@ -10,7 +10,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func PluralDataSource() *schema.Resource { diff --git a/internal/service/accesslistapikey/data_source_accesslist_api_keys_test.go b/internal/service/accesslistapikey/data_source_accesslist_api_keys_test.go index a89a075881..82f1d14384 100644 --- a/internal/service/accesslistapikey/data_source_accesslist_api_keys_test.go +++ b/internal/service/accesslistapikey/data_source_accesslist_api_keys_test.go @@ -25,7 +25,7 @@ func TestAccConfigDSAccesslistAPIKeys_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configDSPlural(orgID, description, ipAddress), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "org_id"), resource.TestCheckResourceAttrSet(resourceName, "ip_address"), diff --git a/internal/service/accesslistapikey/resource_access_list_api_key.go b/internal/service/accesslistapikey/resource_access_list_api_key.go index ce645e9f55..1eaf6751f5 100644 --- a/internal/service/accesslistapikey/resource_access_list_api_key.go +++ b/internal/service/accesslistapikey/resource_access_list_api_key.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func Resource() *schema.Resource { diff --git a/internal/service/accesslistapikey/resource_access_list_api_key_migration_test.go b/internal/service/accesslistapikey/resource_access_list_api_key_migration_test.go index db2510acfb..227fa37c7f 100644 --- a/internal/service/accesslistapikey/resource_access_list_api_key_migration_test.go +++ b/internal/service/accesslistapikey/resource_access_list_api_key_migration_test.go @@ -26,7 +26,7 @@ func TestMigProjectAccesslistAPIKey_SettingIPAddress(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: configWithIPAddress(orgID, description, ipAddress), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), resource.TestCheckResourceAttr(resourceName, "ip_address", ipAddress), @@ -54,7 +54,7 @@ func TestMigProjectAccesslistAPIKey_SettingCIDRBlock(t *testing.T) { { ExternalProviders: acc.ExternalProviders("1.14.0"), Config: configWithCIDRBlock(orgID, description, cidrBlock), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), resource.TestCheckResourceAttr(resourceName, "cidr_block", cidrBlock), @@ -92,7 +92,7 @@ func TestMigProjectAccesslistAPIKey_SettingCIDRBlock_WideCIDR_SDKMigration(t *te { ExternalProviders: acc.ExternalProviders("1.14.0"), Config: configWithCIDRBlock(orgID, description, cidrBlock), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), resource.TestCheckResourceAttr(resourceName, "cidr_block", cidrBlock), diff --git a/internal/service/accesslistapikey/resource_access_list_api_key_test.go b/internal/service/accesslistapikey/resource_access_list_api_key_test.go index 887736fd40..a070953f2a 100644 --- a/internal/service/accesslistapikey/resource_access_list_api_key_test.go +++ b/internal/service/accesslistapikey/resource_access_list_api_key_test.go @@ -28,7 +28,7 @@ func TestAccProjectRSAccesslistAPIKey_SettingIPAddress(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithIPAddress(orgID, description, ipAddress), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), resource.TestCheckResourceAttr(resourceName, "ip_address", ipAddress), @@ -36,7 +36,7 @@ func TestAccProjectRSAccesslistAPIKey_SettingIPAddress(t *testing.T) { }, { Config: configWithIPAddress(orgID, description, updatedIPAddress), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), resource.TestCheckResourceAttr(resourceName, "ip_address", updatedIPAddress), @@ -68,7 +68,7 @@ func TestAccProjectRSAccessListAPIKey_SettingCIDRBlock(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithCIDRBlock(orgID, description, cidrBlock), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), resource.TestCheckResourceAttr(resourceName, "cidr_block", cidrBlock), @@ -76,7 +76,7 @@ func TestAccProjectRSAccessListAPIKey_SettingCIDRBlock(t *testing.T) { }, { Config: configWithCIDRBlock(orgID, description, updatedCIDRBlock), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), resource.TestCheckResourceAttr(resourceName, "cidr_block", updatedCIDRBlock), @@ -102,7 +102,7 @@ func TestAccProjectRSAccessListAPIKey_SettingCIDRBlock_WideCIDR(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithCIDRBlock(orgID, description, cidrBlock), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), resource.TestCheckResourceAttr(resourceName, "cidr_block", cidrBlock), @@ -110,7 +110,7 @@ func TestAccProjectRSAccessListAPIKey_SettingCIDRBlock_WideCIDR(t *testing.T) { }, { Config: configWithCIDRBlock(orgID, description, updatedCIDRBlock), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), resource.TestCheckResourceAttr(resourceName, "cidr_block", updatedCIDRBlock), diff --git a/internal/service/advancedcluster/data_source_advanced_cluster.go b/internal/service/advancedcluster/data_source_advanced_cluster.go index ccb5473d56..091ce6bcc2 100644 --- a/internal/service/advancedcluster/data_source_advanced_cluster.go +++ b/internal/service/advancedcluster/data_source_advanced_cluster.go @@ -6,7 +6,7 @@ import ( "net/http" admin20231115 "go.mongodb.org/atlas-sdk/v20231115014/admin" - "go.mongodb.org/atlas-sdk/v20240530001/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -250,8 +250,8 @@ func DataSource() *schema.Resource { } func dataSourceRead(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics { - connV220231115 := meta.(*config.MongoDBClient).AtlasV2 - connV2 := meta.(*config.MongoDBClient).AtlasV2Preview + connV220231115 := meta.(*config.MongoDBClient).AtlasV220231115 + connV2 := meta.(*config.MongoDBClient).AtlasV2 projectID := d.Get("project_id").(string) clusterName := d.Get("name").(string) diff --git a/internal/service/advancedcluster/data_source_advanced_clusters.go b/internal/service/advancedcluster/data_source_advanced_clusters.go index 6a33cc3402..51682add26 100644 --- a/internal/service/advancedcluster/data_source_advanced_clusters.go +++ b/internal/service/advancedcluster/data_source_advanced_clusters.go @@ -7,7 +7,7 @@ import ( "net/http" admin20231115 "go.mongodb.org/atlas-sdk/v20231115014/admin" - "go.mongodb.org/atlas-sdk/v20240530001/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" @@ -248,34 +248,34 @@ func PluralDataSource() *schema.Resource { } func dataSourcePluralRead(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics { + connV220231115 := meta.(*config.MongoDBClient).AtlasV220231115 connV2 := meta.(*config.MongoDBClient).AtlasV2 - connLatest := meta.(*config.MongoDBClient).AtlasV2Preview projectID := d.Get("project_id").(string) d.SetId(id.UniqueId()) - list, resp, err := connV2.ClustersApi.ListClusters(ctx, projectID).Execute() + list, resp, err := connV220231115.ClustersApi.ListClusters(ctx, projectID).Execute() if err != nil { if resp != nil && resp.StatusCode == http.StatusNotFound { return nil } return diag.FromErr(fmt.Errorf("error reading advanced cluster list for project(%s): %s", projectID, err)) } - if err := d.Set("results", flattenAdvancedClusters(ctx, connV2, connLatest, list.GetResults(), d)); err != nil { + if err := d.Set("results", flattenAdvancedClusters(ctx, connV220231115, connV2, list.GetResults(), d)); err != nil { return diag.FromErr(fmt.Errorf(ErrorClusterAdvancedSetting, "results", d.Id(), err)) } return nil } -func flattenAdvancedClusters(ctx context.Context, connV2 *admin20231115.APIClient, connLatest *admin.APIClient, clusters []admin20231115.AdvancedClusterDescription, d *schema.ResourceData) []map[string]any { +func flattenAdvancedClusters(ctx context.Context, connV220231115 *admin20231115.APIClient, connV2 *admin.APIClient, clusters []admin20231115.AdvancedClusterDescription, d *schema.ResourceData) []map[string]any { results := make([]map[string]any, 0, len(clusters)) for i := range clusters { cluster := &clusters[i] - processArgs, _, err := connV2.ClustersApi.GetClusterAdvancedConfiguration(ctx, cluster.GetGroupId(), cluster.GetName()).Execute() + processArgs, _, err := connV220231115.ClustersApi.GetClusterAdvancedConfiguration(ctx, cluster.GetGroupId(), cluster.GetName()).Execute() if err != nil { log.Printf("[WARN] Error setting `advanced_configuration` for the cluster(%s): %s", cluster.GetId(), err) } - replicationSpecs, err := FlattenAdvancedReplicationSpecsOldSDK(ctx, cluster.GetReplicationSpecs(), cluster.GetDiskSizeGB(), nil, d, connLatest) + replicationSpecs, err := FlattenAdvancedReplicationSpecsOldSDK(ctx, cluster.GetReplicationSpecs(), cluster.GetDiskSizeGB(), nil, d, connV2) if err != nil { log.Printf("[WARN] Error setting `replication_specs` for the cluster(%s): %s", cluster.GetId(), err) } @@ -290,7 +290,7 @@ func flattenAdvancedClusters(ctx context.Context, connV2 *admin20231115.APIClien "disk_size_gb": cluster.GetDiskSizeGB(), "encryption_at_rest_provider": cluster.GetEncryptionAtRestProvider(), "labels": flattenLabels(*convertLabelsToLatest(cluster.Labels)), - "tags": conversion.FlattenTags(cluster.GetTags()), + "tags": conversion.FlattenTags(convertTagsToLatest(cluster.GetTags())), "mongo_db_major_version": cluster.GetMongoDBMajorVersion(), "mongo_db_version": cluster.GetMongoDBVersion(), "name": cluster.GetName(), diff --git a/internal/service/advancedcluster/model_advanced_cluster.go b/internal/service/advancedcluster/model_advanced_cluster.go index 4deacc98a6..c11f57450f 100644 --- a/internal/service/advancedcluster/model_advanced_cluster.go +++ b/internal/service/advancedcluster/model_advanced_cluster.go @@ -10,7 +10,7 @@ import ( "strings" admin20231115 "go.mongodb.org/atlas-sdk/v20231115014/admin" - "go.mongodb.org/atlas-sdk/v20240530001/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" @@ -303,7 +303,7 @@ func UpgradeRefreshFunc(ctx context.Context, name, projectID string, client admi } } -func ResourceClusterListAdvancedRefreshFunc(ctx context.Context, projectID string, clustersAPI admin20231115.ClustersApi) retry.StateRefreshFunc { +func ResourceClusterListAdvancedRefreshFunc(ctx context.Context, projectID string, clustersAPI admin.ClustersApi) retry.StateRefreshFunc { return func() (any, string, error) { clusters, resp, err := clustersAPI.ListClusters(ctx, projectID).Execute() diff --git a/internal/service/advancedcluster/model_advanced_cluster_test.go b/internal/service/advancedcluster/model_advanced_cluster_test.go index 556419372e..a635f6f2c9 100644 --- a/internal/service/advancedcluster/model_advanced_cluster_test.go +++ b/internal/service/advancedcluster/model_advanced_cluster_test.go @@ -6,10 +6,11 @@ import ( "net/http" "testing" - "go.mongodb.org/atlas-sdk/v20231115014/admin" - "go.mongodb.org/atlas-sdk/v20231115014/mockadmin" - adminLatest "go.mongodb.org/atlas-sdk/v20240530001/admin" - mockAdminLatest "go.mongodb.org/atlas-sdk/v20240530001/mockadmin" + admin20231115 "go.mongodb.org/atlas-sdk/v20231115014/admin" + mockadmin20231115 "go.mongodb.org/atlas-sdk/v20231115014/mockadmin" + + "go.mongodb.org/atlas-sdk/v20240530002/admin" + "go.mongodb.org/atlas-sdk/v20240530002/mockadmin" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/stretchr/testify/assert" @@ -24,7 +25,7 @@ var ( dummyClusterName = "clusterName" dummyProjectID = "projectId" errGeneric = errors.New("generic") - advancedClusters = []admin.AdvancedClusterDescription{{StateName: conversion.StringPtr("NOT IDLE")}} + advancedClusters = []admin.ClusterDescription20240710{{StateName: conversion.StringPtr("NOT IDLE")}} ) func TestFlattenReplicationSpecs(t *testing.T) { @@ -35,7 +36,7 @@ func TestFlattenReplicationSpecs(t *testing.T) { unexpectedID = "id2" expectedZoneName = "z1" unexpectedZoneName = "z2" - regionConfigAdmin = []admin.CloudRegionConfig{{ + regionConfigAdmin = []admin20231115.CloudRegionConfig{{ ProviderName: &providerName, RegionName: ®ionName, }} @@ -48,8 +49,8 @@ func TestFlattenReplicationSpecs(t *testing.T) { "region_name": regionName, "zone_name": unexpectedZoneName, } - apiSpecExpected = admin.ReplicationSpec{Id: &expectedID, ZoneName: &expectedZoneName, RegionConfigs: ®ionConfigAdmin} - apiSpecDifferent = admin.ReplicationSpec{Id: &unexpectedID, ZoneName: &unexpectedZoneName, RegionConfigs: ®ionConfigAdmin} + apiSpecExpected = admin20231115.ReplicationSpec{Id: &expectedID, ZoneName: &expectedZoneName, RegionConfigs: ®ionConfigAdmin} + apiSpecDifferent = admin20231115.ReplicationSpec{Id: &unexpectedID, ZoneName: &unexpectedZoneName, RegionConfigs: ®ionConfigAdmin} testSchema = map[string]*schema.Schema{ "project_id": {Type: schema.TypeString}, } @@ -79,60 +80,60 @@ func TestFlattenReplicationSpecs(t *testing.T) { } ) testCases := map[string]struct { - adminSpecs []admin.ReplicationSpec + adminSpecs []admin20231115.ReplicationSpec tfInputSpecs []any expectedLen int }{ "empty admin spec should return empty list": { - []admin.ReplicationSpec{}, + []admin20231115.ReplicationSpec{}, []any{tfSameIDSameZone}, 0, }, "existing id, should match admin": { - []admin.ReplicationSpec{apiSpecExpected}, + []admin20231115.ReplicationSpec{apiSpecExpected}, []any{tfSameIDSameZone}, 1, }, "existing different id, should change to admin spec": { - []admin.ReplicationSpec{apiSpecExpected}, + []admin20231115.ReplicationSpec{apiSpecExpected}, []any{tfdiffIDDiffZone}, 1, }, "missing id, should be set when zone_name matches": { - []admin.ReplicationSpec{apiSpecExpected}, + []admin20231115.ReplicationSpec{apiSpecExpected}, []any{tfNoIDSameZone}, 1, }, "missing id and diff zone, should change to admin spec": { - []admin.ReplicationSpec{apiSpecExpected}, + []admin20231115.ReplicationSpec{apiSpecExpected}, []any{tfNoIDDiffZone}, 1, }, "existing id, should match correct api spec using `id` and extra api spec added": { - []admin.ReplicationSpec{apiSpecDifferent, apiSpecExpected}, + []admin20231115.ReplicationSpec{apiSpecDifferent, apiSpecExpected}, []any{tfSameIDSameZone}, 2, }, "missing id, should match correct api spec using `zone_name` and extra api spec added": { - []admin.ReplicationSpec{apiSpecDifferent, apiSpecExpected}, + []admin20231115.ReplicationSpec{apiSpecDifferent, apiSpecExpected}, []any{tfNoIDSameZone}, 2, }, "two matching specs should be set to api specs": { - []admin.ReplicationSpec{apiSpecExpected, apiSpecDifferent}, + []admin20231115.ReplicationSpec{apiSpecExpected, apiSpecDifferent}, []any{tfSameIDSameZone, tfdiffIDDiffZone}, 2, }, } for name, tc := range testCases { t.Run(name, func(t *testing.T) { - peeringAPI := mockAdminLatest.NetworkPeeringApi{} + peeringAPI := mockadmin.NetworkPeeringApi{} - peeringAPI.EXPECT().ListPeeringContainerByCloudProviderWithParams(mock.Anything, mock.Anything).Return(adminLatest.ListPeeringContainerByCloudProviderApiRequest{ApiService: &peeringAPI}) - containerResult := []adminLatest.CloudProviderContainer{{Id: conversion.StringPtr("c1"), RegionName: ®ionName, ProviderName: &providerName}} - peeringAPI.EXPECT().ListPeeringContainerByCloudProviderExecute(mock.Anything).Return(&adminLatest.PaginatedCloudProviderContainer{Results: &containerResult}, nil, nil) + peeringAPI.EXPECT().ListPeeringContainerByCloudProviderWithParams(mock.Anything, mock.Anything).Return(admin.ListPeeringContainerByCloudProviderApiRequest{ApiService: &peeringAPI}) + containerResult := []admin.CloudProviderContainer{{Id: conversion.StringPtr("c1"), RegionName: ®ionName, ProviderName: &providerName}} + peeringAPI.EXPECT().ListPeeringContainerByCloudProviderExecute(mock.Anything).Return(&admin.PaginatedCloudProviderContainer{Results: &containerResult}, nil, nil) - client := &adminLatest.APIClient{ + client := &admin.APIClient{ NetworkPeeringApi: &peeringAPI, } resourceData := schema.TestResourceDataRaw(t, testSchema, map[string]any{"project_id": "p1"}) @@ -157,7 +158,7 @@ type Result struct { func TestUpgradeRefreshFunc(t *testing.T) { testCases := []struct { - mockCluster *admin.AdvancedClusterDescription + mockCluster *admin20231115.AdvancedClusterDescription mockResponse *http.Response expectedResult Result mockError error @@ -219,11 +220,11 @@ func TestUpgradeRefreshFunc(t *testing.T) { }, { name: "Successful", - mockCluster: &admin.AdvancedClusterDescription{StateName: conversion.StringPtr("stateName")}, + mockCluster: &admin20231115.AdvancedClusterDescription{StateName: conversion.StringPtr("stateName")}, mockResponse: &http.Response{StatusCode: 200}, expectedError: false, expectedResult: Result{ - response: &admin.AdvancedClusterDescription{StateName: conversion.StringPtr("stateName")}, + response: &admin20231115.AdvancedClusterDescription{StateName: conversion.StringPtr("stateName")}, state: "stateName", error: nil, }, @@ -232,9 +233,9 @@ func TestUpgradeRefreshFunc(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - testObject := mockadmin.NewClustersApi(t) + testObject := mockadmin20231115.NewClustersApi(t) - testObject.EXPECT().GetCluster(mock.Anything, mock.Anything, mock.Anything).Return(admin.GetClusterApiRequest{ApiService: testObject}).Once() + testObject.EXPECT().GetCluster(mock.Anything, mock.Anything, mock.Anything).Return(admin20231115.GetClusterApiRequest{ApiService: testObject}).Once() testObject.EXPECT().GetClusterExecute(mock.Anything).Return(tc.mockCluster, tc.mockResponse, tc.mockError).Once() result, stateName, err := advancedcluster.UpgradeRefreshFunc(context.Background(), dummyClusterName, dummyProjectID, testObject)() @@ -251,7 +252,7 @@ func TestUpgradeRefreshFunc(t *testing.T) { func TestResourceListAdvancedRefreshFunc(t *testing.T) { testCases := []struct { - mockCluster *admin.PaginatedAdvancedClusterDescription + mockCluster *admin.PaginatedClusterDescription20240710 mockResponse *http.Response expectedResult Result mockError error @@ -313,7 +314,7 @@ func TestResourceListAdvancedRefreshFunc(t *testing.T) { }, { name: "Successful but with at least one cluster not idle", - mockCluster: &admin.PaginatedAdvancedClusterDescription{Results: &advancedClusters}, + mockCluster: &admin.PaginatedClusterDescription20240710{Results: &advancedClusters}, mockResponse: &http.Response{StatusCode: 200}, expectedError: false, expectedResult: Result{ @@ -324,11 +325,11 @@ func TestResourceListAdvancedRefreshFunc(t *testing.T) { }, { name: "Successful", - mockCluster: &admin.PaginatedAdvancedClusterDescription{}, + mockCluster: &admin.PaginatedClusterDescription20240710{}, mockResponse: &http.Response{StatusCode: 200}, expectedError: false, expectedResult: Result{ - response: &admin.PaginatedAdvancedClusterDescription{}, + response: &admin.PaginatedClusterDescription20240710{}, state: "IDLE", error: nil, }, diff --git a/internal/service/advancedcluster/model_sdk_version_conversion.go b/internal/service/advancedcluster/model_sdk_version_conversion.go index 55b66c00f9..d99841741c 100644 --- a/internal/service/advancedcluster/model_sdk_version_conversion.go +++ b/internal/service/advancedcluster/model_sdk_version_conversion.go @@ -2,7 +2,7 @@ package advancedcluster import ( admin20231115 "go.mongodb.org/atlas-sdk/v20231115014/admin" - "go.mongodb.org/atlas-sdk/v20240530001/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" ) @@ -11,15 +11,23 @@ import ( // - These functions must not contain any business logic. // - All will be removed once we rely on a single API version. -func convertTagsToLatest(tags *[]admin20231115.ResourceTag) *[]admin.ResourceTag { +func convertTagsPtrToLatest(tags *[]admin20231115.ResourceTag) *[]admin.ResourceTag { if tags == nil { return nil } - tagSlice := *tags - results := make([]admin.ResourceTag, len(tagSlice)) - for i := range len(tagSlice) { - tag := tagSlice[i] - results[i] = admin.ResourceTag{ + result := convertTagsToLatest(*tags) + return &result +} + +func convertTagsPtrToOldSDK(tags *[]admin.ResourceTag) *[]admin20231115.ResourceTag { + if tags == nil { + return nil + } + tagsSlice := *tags + results := make([]admin20231115.ResourceTag, len(tagsSlice)) + for i := range len(tagsSlice) { + tag := tagsSlice[i] + results[i] = admin20231115.ResourceTag{ Key: tag.Key, Value: tag.Value, } @@ -27,6 +35,18 @@ func convertTagsToLatest(tags *[]admin20231115.ResourceTag) *[]admin.ResourceTag return &results } +func convertTagsToLatest(tags []admin20231115.ResourceTag) []admin.ResourceTag { + results := make([]admin.ResourceTag, len(tags)) + for i := range len(tags) { + tag := tags[i] + results[i] = admin.ResourceTag{ + Key: tag.Key, + Value: tag.Value, + } + } + return results +} + func convertBiConnectToOldSDK(biconnector *admin.BiConnector) *admin20231115.BiConnector { if biconnector == nil { return nil @@ -298,7 +318,7 @@ func convertClusterDescToLatestExcludeRepSpecs(oldClusterDesc *admin20231115.Adv StateName: oldClusterDesc.StateName, TerminationProtectionEnabled: oldClusterDesc.TerminationProtectionEnabled, VersionReleaseSystem: oldClusterDesc.VersionReleaseSystem, - Tags: convertTagsToLatest(oldClusterDesc.Tags), + Tags: convertTagsPtrToLatest(oldClusterDesc.Tags), BiConnector: convertBiConnectToLatest(oldClusterDesc.BiConnector), ConnectionStrings: convertConnectionStringToLatest(oldClusterDesc.ConnectionStrings), Labels: convertLabelsToLatest(oldClusterDesc.Labels), diff --git a/internal/service/advancedcluster/resource_advanced_cluster.go b/internal/service/advancedcluster/resource_advanced_cluster.go index e83245f8d6..6bfe607f14 100644 --- a/internal/service/advancedcluster/resource_advanced_cluster.go +++ b/internal/service/advancedcluster/resource_advanced_cluster.go @@ -13,18 +13,17 @@ import ( "time" admin20231115 "go.mongodb.org/atlas-sdk/v20231115014/admin" - "go.mongodb.org/atlas-sdk/v20240530001/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/spf13/cast" - "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/constant" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/validate" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" + "github.com/spf13/cast" ) const ( @@ -384,8 +383,8 @@ func resourceCreate(ctx context.Context, d *schema.ResourceData, meta any) diag. return diag.FromErr(fmt.Errorf("accept_data_risks_and_force_replica_set_reconfig can not be set in creation, only in update")) } } - connV220231115 := meta.(*config.MongoDBClient).AtlasV2 - connV2 := meta.(*config.MongoDBClient).AtlasV2Preview + connV220231115 := meta.(*config.MongoDBClient).AtlasV220231115 + connV2 := meta.(*config.MongoDBClient).AtlasV2 projectID := d.Get("project_id").(string) var rootDiskSizeGB *float64 @@ -419,7 +418,7 @@ func resourceCreate(ctx context.Context, d *schema.ResourceData, meta any) diag. } if _, ok := d.GetOk("tags"); ok { - params.Tags = convertTagsToLatest(conversion.ExpandTagsFromSetSchema(d)) + params.Tags = conversion.ExpandTagsFromSetSchema(d) } if v, ok := d.GetOk("mongo_db_major_version"); ok { params.MongoDBMajorVersion = conversion.StringPtr(FormatMongoDBMajorVersion(v.(string))) @@ -500,8 +499,8 @@ func CreateStateChangeConfig(ctx context.Context, connV2 *admin.APIClient, proje } func resourceRead(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics { - connV220231115 := meta.(*config.MongoDBClient).AtlasV2 - connV2 := meta.(*config.MongoDBClient).AtlasV2Preview + connV220231115 := meta.(*config.MongoDBClient).AtlasV220231115 + connV2 := meta.(*config.MongoDBClient).AtlasV2 ids := conversion.DecodeStateID(d.Id()) projectID := ids["project_id"] clusterName := ids["cluster_name"] @@ -682,7 +681,7 @@ func resourceUpdateOrUpgrade(ctx context.Context, d *schema.ResourceData, meta a } func resourceUpgrade(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics { - connV220231115 := meta.(*config.MongoDBClient).AtlasV2 + connV220231115 := meta.(*config.MongoDBClient).AtlasV220231115 ids := conversion.DecodeStateID(d.Id()) projectID := ids["project_id"] clusterName := ids["cluster_name"] @@ -709,8 +708,8 @@ func resourceUpgrade(ctx context.Context, d *schema.ResourceData, meta any) diag } func resourceUpdate(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics { - connV220231115 := meta.(*config.MongoDBClient).AtlasV2 - connV2 := meta.(*config.MongoDBClient).AtlasV2Preview + connV220231115 := meta.(*config.MongoDBClient).AtlasV220231115 + connV2 := meta.(*config.MongoDBClient).AtlasV2 ids := conversion.DecodeStateID(d.Id()) projectID := ids["project_id"] clusterName := ids["cluster_name"] @@ -747,7 +746,7 @@ func resourceUpdate(ctx context.Context, d *schema.ResourceData, meta any) diag. } if d.HasChange("tags") { - cluster.Tags = conversion.ExpandTagsFromSetSchema(d) + cluster.Tags = convertTagsPtrToOldSDK(conversion.ExpandTagsFromSetSchema(d)) } if d.HasChange("mongo_db_major_version") { @@ -838,7 +837,7 @@ func resourceUpdate(ctx context.Context, d *schema.ResourceData, meta any) diag. } func resourceDelete(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics { - connV2 := meta.(*config.MongoDBClient).AtlasV2Preview + connV2 := meta.(*config.MongoDBClient).AtlasV2 ids := conversion.DecodeStateID(d.Id()) projectID := ids["project_id"] clusterName := ids["cluster_name"] diff --git a/internal/service/advancedcluster/resource_advanced_cluster_test.go b/internal/service/advancedcluster/resource_advanced_cluster_test.go index 5c07e1e142..c376a4b5d5 100644 --- a/internal/service/advancedcluster/resource_advanced_cluster_test.go +++ b/internal/service/advancedcluster/resource_advanced_cluster_test.go @@ -12,7 +12,8 @@ import ( "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + admin20231115 "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( @@ -219,7 +220,7 @@ func TestAccClusterAdvancedCluster_advancedConfig(t *testing.T) { projectID = acc.ProjectIDExecution(t) clusterName = acc.RandomClusterName() clusterNameUpdated = acc.RandomClusterName() - processArgs = &admin.ClusterDescriptionProcessArgs{ + processArgs = &admin20231115.ClusterDescriptionProcessArgs{ DefaultReadConcern: conversion.StringPtr("available"), DefaultWriteConcern: conversion.StringPtr("1"), FailIndexKeyTooLong: conversion.Pointer(false), @@ -231,7 +232,7 @@ func TestAccClusterAdvancedCluster_advancedConfig(t *testing.T) { SampleSizeBIConnector: conversion.Pointer(110), TransactionLifetimeLimitSeconds: conversion.Pointer[int64](300), } - processArgsUpdated = &admin.ClusterDescriptionProcessArgs{ + processArgsUpdated = &admin20231115.ClusterDescriptionProcessArgs{ DefaultReadConcern: conversion.StringPtr("available"), DefaultWriteConcern: conversion.StringPtr("0"), FailIndexKeyTooLong: conversion.Pointer(false), @@ -267,7 +268,7 @@ func TestAccClusterAdvancedCluster_defaultWrite(t *testing.T) { projectID = acc.ProjectIDExecution(t) clusterName = acc.RandomClusterName() clusterNameUpdated = acc.RandomClusterName() - processArgs = &admin.ClusterDescriptionProcessArgs{ + processArgs = &admin20231115.ClusterDescriptionProcessArgs{ DefaultReadConcern: conversion.StringPtr("available"), DefaultWriteConcern: conversion.StringPtr("1"), JavascriptEnabled: conversion.Pointer(true), @@ -277,7 +278,7 @@ func TestAccClusterAdvancedCluster_defaultWrite(t *testing.T) { SampleRefreshIntervalBIConnector: conversion.Pointer(310), SampleSizeBIConnector: conversion.Pointer(110), } - processArgsUpdated = &admin.ClusterDescriptionProcessArgs{ + processArgsUpdated = &admin20231115.ClusterDescriptionProcessArgs{ DefaultReadConcern: conversion.StringPtr("available"), DefaultWriteConcern: conversion.StringPtr("majority"), JavascriptEnabled: conversion.Pointer(true), @@ -487,6 +488,31 @@ func TestAccClusterAdvancedClusterConfig_selfManagedShardingIncorrectType(t *tes }) } +func TestAccClusterAdvancedClusterConfig_symmetricGeoShardedOldSchema(t *testing.T) { + acc.SkipTestForCI(t) // TODO: CLOUDP-260154 for ensuring this use case is supported + var ( + orgID = os.Getenv("MONGODB_ATLAS_ORG_ID") + projectName = acc.RandomProjectName() // No ProjectIDExecution to avoid cross-region limits because multi-region + clusterName = acc.RandomClusterName() + ) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acc.PreCheckBasic(t) }, + ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, + CheckDestroy: acc.CheckDestroyCluster, + Steps: []resource.TestStep{ + { + Config: configMultiZoneWithShards(orgID, projectName, clusterName, 2, 2, false), + Check: checkMultiZoneWithShards(clusterName, 2, 2), + }, + { + Config: configMultiZoneWithShards(orgID, projectName, clusterName, 3, 3, false), + Check: checkMultiZoneWithShards(clusterName, 3, 3), + }, + }, + }) +} + func TestAccClusterAdvancedClusterConfig_symmetricShardedNewSchema(t *testing.T) { var ( orgID = os.Getenv("MONGODB_ATLAS_ORG_ID") @@ -547,7 +573,7 @@ func checkExists(resourceName string) resource.TestCheckFunc { return fmt.Errorf("no ID is set") } ids := conversion.DecodeStateID(rs.Primary.ID) - if _, _, err := acc.ConnV2Preview().ClustersApi.GetCluster(context.Background(), ids["project_id"], ids["cluster_name"]).Execute(); err == nil { + if _, _, err := acc.ConnV2().ClustersApi.GetCluster(context.Background(), ids["project_id"], ids["cluster_name"]).Execute(); err == nil { return nil } return fmt.Errorf("cluster(%s:%s) does not exist", rs.Primary.Attributes["project_id"], rs.Primary.ID) @@ -910,7 +936,7 @@ func checkSingleProviderPaused(name string, paused bool) resource.TestCheckFunc "paused": strconv.FormatBool(paused)}) } -func configAdvanced(projectID, clusterName string, p *admin.ClusterDescriptionProcessArgs) string { +func configAdvanced(projectID, clusterName string, p *admin20231115.ClusterDescriptionProcessArgs) string { return fmt.Sprintf(` resource "mongodbatlas_advanced_cluster" "test" { project_id = %[1]q @@ -976,7 +1002,7 @@ func checkAdvanced(name, tls string) resource.TestCheckFunc { resource.TestCheckResourceAttrSet(dataSourcePluralName, "results.0.name")) } -func configAdvancedDefaultWrite(projectID, clusterName string, p *admin.ClusterDescriptionProcessArgs) string { +func configAdvancedDefaultWrite(projectID, clusterName string, p *admin20231115.ClusterDescriptionProcessArgs) string { return fmt.Sprintf(` resource "mongodbatlas_advanced_cluster" "test" { project_id = %[1]q diff --git a/internal/service/alertconfiguration/data_source_alert_configuration.go b/internal/service/alertconfiguration/data_source_alert_configuration.go index 16c07c7aac..2aebfb60c1 100644 --- a/internal/service/alertconfiguration/data_source_alert_configuration.go +++ b/internal/service/alertconfiguration/data_source_alert_configuration.go @@ -14,7 +14,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" "github.com/zclconf/go-cty/cty" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) var _ datasource.DataSource = &alertConfigurationDS{} diff --git a/internal/service/alertconfiguration/data_source_alert_configuration_test.go b/internal/service/alertconfiguration/data_source_alert_configuration_test.go index edf53b99f4..8c32684ad7 100644 --- a/internal/service/alertconfiguration/data_source_alert_configuration_test.go +++ b/internal/service/alertconfiguration/data_source_alert_configuration_test.go @@ -21,7 +21,7 @@ func TestAccConfigDSAlertConfiguration_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasicDS(projectID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(dataSourceName), resource.TestCheckResourceAttr(dataSourceName, "project_id", projectID), resource.TestCheckResourceAttr(dataSourceName, "notification.#", "1"), @@ -47,7 +47,7 @@ func TestAccConfigDSAlertConfiguration_withThreshold(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithThreshold(projectID, true, 1), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(dataSourceName), resource.TestCheckResourceAttr(dataSourceName, "project_id", projectID), resource.TestCheckResourceAttr(dataSourceName, "notification.#", "1"), @@ -73,7 +73,7 @@ func TestAccConfigDSAlertConfiguration_withOutput(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithOutputs(projectID, outputLabel), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(dataSourceName), resource.TestCheckResourceAttr(dataSourceName, "project_id", projectID), resource.TestCheckResourceAttr(dataSourceName, "notification.#", "1"), @@ -102,7 +102,7 @@ func TestAccConfigDSAlertConfiguration_withPagerDuty(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithPagerDutyDS(projectID, serviceKey, true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(dataSourceName), resource.TestCheckResourceAttr(dataSourceName, "project_id", projectID), ), diff --git a/internal/service/alertconfiguration/data_source_alert_configurations.go b/internal/service/alertconfiguration/data_source_alert_configurations.go index f4b2790037..6b178aae06 100644 --- a/internal/service/alertconfiguration/data_source_alert_configurations.go +++ b/internal/service/alertconfiguration/data_source_alert_configurations.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const alertConfigurationsDataSourceName = "alert_configurations" diff --git a/internal/service/alertconfiguration/data_source_alert_configurations_test.go b/internal/service/alertconfiguration/data_source_alert_configurations_test.go index c725a7ec5e..61bb45de90 100644 --- a/internal/service/alertconfiguration/data_source_alert_configurations_test.go +++ b/internal/service/alertconfiguration/data_source_alert_configurations_test.go @@ -26,7 +26,7 @@ func TestAccConfigDSAlertConfigurations_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasicPluralDS(projectID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkCount(dataSourcePluralName), resource.TestCheckResourceAttr(dataSourcePluralName, "project_id", projectID), resource.TestCheckNoResourceAttr(dataSourcePluralName, "total_count"), @@ -48,7 +48,7 @@ func TestAccConfigDSAlertConfigurations_withOutputTypes(t *testing.T) { Steps: []resource.TestStep{ { Config: configOutputType(projectID, outputTypes), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkCount(dataSourcePluralName), resource.TestCheckResourceAttr(dataSourcePluralName, "project_id", projectID), resource.TestCheckResourceAttr(dataSourcePluralName, "results.0.output.#", "2"), @@ -86,7 +86,7 @@ func TestAccConfigDSAlertConfigurations_totalCount(t *testing.T) { Steps: []resource.TestStep{ { Config: configTotalCount(projectID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkCount(dataSourcePluralName), resource.TestCheckResourceAttr(dataSourcePluralName, "project_id", projectID), resource.TestCheckResourceAttrSet(dataSourcePluralName, "total_count"), diff --git a/internal/service/alertconfiguration/model_alert_configuration.go b/internal/service/alertconfiguration/model_alert_configuration.go index b0f2fb1daa..ef42960051 100644 --- a/internal/service/alertconfiguration/model_alert_configuration.go +++ b/internal/service/alertconfiguration/model_alert_configuration.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func NewNotificationList(list []TfNotificationModel) (*[]admin.AlertsNotificationRootForGroup, error) { diff --git a/internal/service/alertconfiguration/model_alert_configuration_test.go b/internal/service/alertconfiguration/model_alert_configuration_test.go index 6c0ff81cfe..7fa162fd7d 100644 --- a/internal/service/alertconfiguration/model_alert_configuration_test.go +++ b/internal/service/alertconfiguration/model_alert_configuration_test.go @@ -7,7 +7,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/service/alertconfiguration" "github.com/stretchr/testify/assert" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/alertconfiguration/resource_alert_configuration.go b/internal/service/alertconfiguration/resource_alert_configuration.go index b15bc85e7e..29b72498f1 100644 --- a/internal/service/alertconfiguration/resource_alert_configuration.go +++ b/internal/service/alertconfiguration/resource_alert_configuration.go @@ -20,7 +20,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/alertconfiguration/resource_alert_configuration_migration_test.go b/internal/service/alertconfiguration/resource_alert_configuration_migration_test.go index 150d49bee5..3c5320e8f6 100644 --- a/internal/service/alertconfiguration/resource_alert_configuration_migration_test.go +++ b/internal/service/alertconfiguration/resource_alert_configuration_migration_test.go @@ -21,7 +21,7 @@ func TestMigConfigRSAlertConfiguration_withNotificationsMetricThreshold(t *testi { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "notification.#", "2"), @@ -45,7 +45,7 @@ func TestMigConfigRSAlertConfiguration_withThreshold(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "notification.#", "1"), @@ -71,7 +71,7 @@ func TestMigConfigRSAlertConfiguration_withEmptyOptionalBlocks(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "notification.#", "1"), @@ -108,7 +108,7 @@ func TestMigConfigRSAlertConfiguration_withMultipleMatchers(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "matcher.#", "2"), @@ -132,7 +132,7 @@ func TestMigConfigRSAlertConfiguration_withEmptyOptionalAttributes(t *testing.T) { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "notification.#", "1"), diff --git a/internal/service/alertconfiguration/resource_alert_configuration_test.go b/internal/service/alertconfiguration/resource_alert_configuration_test.go index 7dd80a1b1c..6f32d1a295 100644 --- a/internal/service/alertconfiguration/resource_alert_configuration_test.go +++ b/internal/service/alertconfiguration/resource_alert_configuration_test.go @@ -35,7 +35,7 @@ func TestAccConfigRSAlertConfiguration_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasicRS(projectID, true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsUsingProxy(proxyPort, resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "notification.#", "2"), @@ -43,7 +43,7 @@ func TestAccConfigRSAlertConfiguration_basic(t *testing.T) { }, { Config: configBasicRS(projectID, false), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsUsingProxy(proxyPort, resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "notification.#", "2"), @@ -93,7 +93,7 @@ func TestAccConfigRSAlertConfiguration_withEmptyMatcherMetricThresholdConfig(t * Steps: []resource.TestStep{ { Config: configWithEmptyMatcherMetricThresholdConfig(projectID, true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsUsingProxy(proxyPort, resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "notification.#", "1"), @@ -116,14 +116,14 @@ func TestAccConfigRSAlertConfiguration_withNotifications(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithNotifications(projectID, true, true, false), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsUsingProxy(proxyPort, resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), }, { Config: configWithNotifications(projectID, false, false, true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsUsingProxy(proxyPort, resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), @@ -163,7 +163,7 @@ func TestAccConfigRSAlertConfiguration_withMatchers(t *testing.T) { "operator": "CONTAINS", "value": "MONGOS", }), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsUsingProxy(proxyPort, resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), @@ -180,7 +180,7 @@ func TestAccConfigRSAlertConfiguration_withMatchers(t *testing.T) { "operator": "EQUALS", "value": "PRIMARY", }), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsUsingProxy(proxyPort, resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), @@ -203,14 +203,14 @@ func TestAccConfigRSAlertConfiguration_withMetricUpdated(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithMetricUpdated(projectID, true, 99.0), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsUsingProxy(proxyPort, resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), }, { Config: configWithMetricUpdated(projectID, false, 89.7), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsUsingProxy(proxyPort, resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), @@ -233,14 +233,14 @@ func TestAccConfigRSAlertConfiguration_withThresholdUpdated(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithThresholdUpdated(projectID, true, 1), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsUsingProxy(proxyPort, resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), }, { Config: configWithThresholdUpdated(projectID, false, 3), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsUsingProxy(proxyPort, resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), @@ -270,7 +270,7 @@ func TestAccConfigRSAlertConfiguration_withoutRoles(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithoutRoles(projectID, true, 99.0), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsUsingProxy(proxyPort, resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), @@ -293,7 +293,7 @@ func TestAccConfigRSAlertConfiguration_withoutOptionalAttributes(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithEmptyOptionalAttributes(projectID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsUsingProxy(proxyPort, resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), @@ -347,7 +347,7 @@ func TestAccConfigRSAlertConfiguration_updatePagerDutyWithNotifierId(t *testing. Steps: []resource.TestStep{ { Config: configWithPagerDutyNotifierID(projectID, notifierID, 10, &serviceKey), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsUsingProxy(proxyPort, resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "notification.0.delay_min", "10"), @@ -356,7 +356,7 @@ func TestAccConfigRSAlertConfiguration_updatePagerDutyWithNotifierId(t *testing. }, { Config: configWithPagerDutyNotifierID(projectID, notifierID, 15, nil), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsUsingProxy(proxyPort, resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "notification.0.delay_min", "15"), @@ -382,7 +382,7 @@ func TestAccConfigRSAlertConfiguration_withDataDog(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithDataDog(projectID, ddAPIKey, ddRegion, true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsUsingProxy(proxyPort, resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), @@ -406,7 +406,7 @@ func TestAccConfigRSAlertConfiguration_withPagerDuty(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithPagerDuty(projectID, serviceKey, true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsUsingProxy(proxyPort, resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), @@ -437,7 +437,7 @@ func TestAccConfigAlertConfiguration_PagerDutyUsingIntegrationID(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithPagerDutyIntegrationID(orgID, projectName, serviceKey), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsUsingProxy(nil, resourceName), resource.TestCheckResourceAttrSet(resourceName, "notification.0.integration_id"), resource.TestCheckResourceAttrSet(dataSourceName, "notification.0.integration_id"), @@ -462,7 +462,7 @@ func TestAccConfigRSAlertConfiguration_withOpsGenie(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithOpsGenie(projectID, apiKey, true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsUsingProxy(proxyPort, resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), @@ -486,7 +486,7 @@ func TestAccConfigRSAlertConfiguration_withVictorOps(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithVictorOps(projectID, apiKey, true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsUsingProxy(proxyPort, resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), diff --git a/internal/service/apikey/data_source_api_key_test.go b/internal/service/apikey/data_source_api_key_test.go index fe8fc05fb6..e9c9922d3b 100644 --- a/internal/service/apikey/data_source_api_key_test.go +++ b/internal/service/apikey/data_source_api_key_test.go @@ -25,7 +25,7 @@ func TestAccConfigDSAPIKey_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configDS(orgID, description, roleName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), resource.TestCheckResourceAttr(resourceName, "description", description), diff --git a/internal/service/apikey/data_source_api_keys.go b/internal/service/apikey/data_source_api_keys.go index 35426f3e44..85ef1db062 100644 --- a/internal/service/apikey/data_source_api_keys.go +++ b/internal/service/apikey/data_source_api_keys.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func PluralDataSource() *schema.Resource { diff --git a/internal/service/apikey/data_source_api_keys_test.go b/internal/service/apikey/data_source_api_keys_test.go index fab057922c..7b5c33b7b0 100644 --- a/internal/service/apikey/data_source_api_keys_test.go +++ b/internal/service/apikey/data_source_api_keys_test.go @@ -25,7 +25,7 @@ func TestAccConfigDSAPIKeys_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configDSPlural(orgID, description, roleName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), resource.TestCheckResourceAttr(resourceName, "description", description), diff --git a/internal/service/apikey/resource_api_key.go b/internal/service/apikey/resource_api_key.go index e0fdc75674..2bbd1449c9 100644 --- a/internal/service/apikey/resource_api_key.go +++ b/internal/service/apikey/resource_api_key.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func Resource() *schema.Resource { diff --git a/internal/service/apikey/resource_api_key_migration_test.go b/internal/service/apikey/resource_api_key_migration_test.go index 6fa43504e6..568dc81d0f 100644 --- a/internal/service/apikey/resource_api_key_migration_test.go +++ b/internal/service/apikey/resource_api_key_migration_test.go @@ -25,7 +25,7 @@ func TestMigConfigAPIKey_basic(t *testing.T) { { Config: config, ExternalProviders: mig.ExternalProviders(), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), resource.TestCheckResourceAttr(resourceName, "description", description), diff --git a/internal/service/apikey/resource_api_key_test.go b/internal/service/apikey/resource_api_key_test.go index b9e4983401..9d860fd3e5 100644 --- a/internal/service/apikey/resource_api_key_test.go +++ b/internal/service/apikey/resource_api_key_test.go @@ -29,7 +29,7 @@ func TestAccConfigRSAPIKey_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(orgID, description, roleName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), resource.TestCheckResourceAttr(resourceName, "description", description), @@ -37,7 +37,7 @@ func TestAccConfigRSAPIKey_basic(t *testing.T) { }, { Config: configBasic(orgID, descriptionUpdate, roleNameUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), resource.TestCheckResourceAttr(resourceName, "description", descriptionUpdate), diff --git a/internal/service/atlasuser/data_source_atlas_user.go b/internal/service/atlasuser/data_source_atlas_user.go index 06df30c7dc..5bae40ac96 100644 --- a/internal/service/atlasuser/data_source_atlas_user.go +++ b/internal/service/atlasuser/data_source_atlas_user.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/atlasuser/data_source_atlas_user_test.go b/internal/service/atlasuser/data_source_atlas_user_test.go index 4731a1fe47..42d0a594e4 100644 --- a/internal/service/atlasuser/data_source_atlas_user_test.go +++ b/internal/service/atlasuser/data_source_atlas_user_test.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func TestAccConfigDSAtlasUser_ByUserID(t *testing.T) { @@ -26,7 +26,7 @@ func TestAccConfigDSAtlasUser_ByUserID(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccDSMongoDBAtlasUserByUserID(userID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( dataSourceChecksForUser(dataSourceName, "", user)..., ), }, @@ -47,7 +47,7 @@ func TestAccConfigDSAtlasUser_ByUsername(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccDSMongoDBAtlasUserByUsername(username), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( dataSourceChecksForUser(dataSourceName, "", user)..., ), }, diff --git a/internal/service/atlasuser/data_source_atlas_users.go b/internal/service/atlasuser/data_source_atlas_users.go index 88a8a46737..70f6973475 100644 --- a/internal/service/atlasuser/data_source_atlas_users.go +++ b/internal/service/atlasuser/data_source_atlas_users.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/atlasuser/data_source_atlas_users_test.go b/internal/service/atlasuser/data_source_atlas_users_test.go index cd602c4339..29f926b319 100644 --- a/internal/service/atlasuser/data_source_atlas_users_test.go +++ b/internal/service/atlasuser/data_source_atlas_users_test.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/mongodb/terraform-provider-mongodbatlas/internal/service/atlasuser" "github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func TestAccConfigDSAtlasUsers_ByOrgID(t *testing.T) { @@ -30,7 +30,7 @@ func TestAccConfigDSAtlasUsers_ByOrgID(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccDSMongoDBAtlasUsersByOrgID(orgID), - Check: resource.ComposeTestCheckFunc(checks...), + Check: resource.ComposeAggregateTestCheckFunc(checks...), }, }, }) @@ -51,7 +51,7 @@ func TestAccConfigDSAtlasUsers_ByProjectID(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccDSMongoDBAtlasUsersByProjectID(projectName, orgID, projectOwnerID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(dataSourceName, "project_id"), resource.TestCheckResourceAttr(dataSourceName, "total_count", "1"), resource.TestCheckResourceAttr(dataSourceName, "results.#", "1"), // we know project will only have the project owner @@ -82,7 +82,7 @@ func TestAccConfigDSAtlasUsers_ByTeamID(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccDSMongoDBAtlasUsersByTeamID(orgID, teamName, username), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(dataSourceName, "team_id"), resource.TestCheckResourceAttr(dataSourceName, "org_id", orgID), resource.TestCheckResourceAttr(dataSourceName, "total_count", "1"), @@ -116,7 +116,7 @@ func TestAccConfigDSAtlasUsers_UsingPagination(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccDSMongoDBAtlasUsersByTeamWithPagination(orgID, teamName, username, itemsPerPage, pageNum), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(dataSourceName, "team_id"), resource.TestCheckResourceAttr(dataSourceName, "org_id", orgID), resource.TestCheckResourceAttr(dataSourceName, "total_count", "1"), diff --git a/internal/service/auditing/resource_auditing.go b/internal/service/auditing/resource_auditing.go index 41670d827f..bd4024eee5 100644 --- a/internal/service/auditing/resource_auditing.go +++ b/internal/service/auditing/resource_auditing.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/auditing/resource_auditing_migration_test.go b/internal/service/auditing/resource_auditing_migration_test.go index a13b0c034a..fc4fc7d3b4 100644 --- a/internal/service/auditing/resource_auditing_migration_test.go +++ b/internal/service/auditing/resource_auditing_migration_test.go @@ -23,7 +23,7 @@ func TestMigGenericAuditing_basic(t *testing.T) { { Config: config, ExternalProviders: mig.ExternalProviders(), - Check: resource.ComposeTestCheckFunc(checks(auditFilter, true, true)...), + Check: resource.ComposeAggregateTestCheckFunc(checks(auditFilter, true, true)...), }, mig.TestStepCheckEmptyPlan(config), }, diff --git a/internal/service/auditing/resource_auditing_test.go b/internal/service/auditing/resource_auditing_test.go index 49f7e9716c..100b80afc8 100644 --- a/internal/service/auditing/resource_auditing_test.go +++ b/internal/service/auditing/resource_auditing_test.go @@ -30,11 +30,11 @@ func TestAccGenericAuditing_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(projectID, auditFilter, true, true), - Check: resource.ComposeTestCheckFunc(checks(auditFilter, true, true)...), + Check: resource.ComposeAggregateTestCheckFunc(checks(auditFilter, true, true)...), }, { Config: configBasic(projectID, "{}", false, false), - Check: resource.ComposeTestCheckFunc(checks("{}", false, false)...), + Check: resource.ComposeAggregateTestCheckFunc(checks("{}", false, false)...), }, { ResourceName: resourceName, diff --git a/internal/service/backupcompliancepolicy/resource_backup_compliance_policy.go b/internal/service/backupcompliancepolicy/resource_backup_compliance_policy.go index cec407fc6c..b542c87056 100644 --- a/internal/service/backupcompliancepolicy/resource_backup_compliance_policy.go +++ b/internal/service/backupcompliancepolicy/resource_backup_compliance_policy.go @@ -8,7 +8,7 @@ import ( "net/http" "strings" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" diff --git a/internal/service/backupcompliancepolicy/resource_backup_compliance_policy_test.go b/internal/service/backupcompliancepolicy/resource_backup_compliance_policy_test.go index a198c7268d..bd0c81dc53 100644 --- a/internal/service/backupcompliancepolicy/resource_backup_compliance_policy_test.go +++ b/internal/service/backupcompliancepolicy/resource_backup_compliance_policy_test.go @@ -35,7 +35,7 @@ func TestAccBackupCompliancePolicy_update(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithoutOptionals(projectName, orgID, projectOwnerID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "authorized_user_first_name", "First"), resource.TestCheckResourceAttr(resourceName, "authorized_user_last_name", "Last"), @@ -46,7 +46,7 @@ func TestAccBackupCompliancePolicy_update(t *testing.T) { }, { Config: configBasic(projectName, orgID, projectOwnerID, true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "authorized_user_first_name", "First"), resource.TestCheckResourceAttr(resourceName, "authorized_user_last_name", "Last"), @@ -91,7 +91,7 @@ func TestAccBackupCompliancePolicy_withoutRestoreWindowDays(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithoutRestoreDays(projectName, orgID, projectOwnerID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "copy_protection_enabled", "false"), resource.TestCheckResourceAttr(resourceName, "encryption_at_rest_enabled", "false"), @@ -116,7 +116,7 @@ func basicTestCase(tb testing.TB, useYearly bool) *resource.TestCase { Steps: []resource.TestStep{ { Config: configBasic(projectName, orgID, projectOwnerID, useYearly), - Check: resource.ComposeTestCheckFunc(basicChecks()...), + Check: resource.ComposeAggregateTestCheckFunc(basicChecks()...), }, { ResourceName: resourceName, diff --git a/internal/service/cloudbackupschedule/resource_cloud_backup_schedule.go b/internal/service/cloudbackupschedule/resource_cloud_backup_schedule.go index 9a77376a19..202a3cfb2d 100644 --- a/internal/service/cloudbackupschedule/resource_cloud_backup_schedule.go +++ b/internal/service/cloudbackupschedule/resource_cloud_backup_schedule.go @@ -12,7 +12,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" "github.com/spf13/cast" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( @@ -492,9 +492,9 @@ func cloudBackupScheduleCreateOrUpdate(ctx context.Context, connV2 *admin.APICli } req := &admin.DiskBackupSnapshotSchedule{} - - if v, ok := d.GetOk("copy_settings"); ok && len(v.([]any)) > 0 { - req.CopySettings = expandCopySettings(v.([]any)) + copySettings := d.Get("copy_settings") + if copySettings != nil && (conversion.HasElementsSliceOrMap(copySettings) || d.HasChange("copy_settings")) { + req.CopySettings = expandCopySettings(copySettings.([]any)) } var policiesItem []admin.DiskBackupApiPolicyItem @@ -642,11 +642,7 @@ func expandCopySetting(tfMap map[string]any) *admin.DiskBackupCopySetting { } func expandCopySettings(tfList []any) *[]admin.DiskBackupCopySetting { - if len(tfList) == 0 { - return nil - } - - var copySettings []admin.DiskBackupCopySetting + copySettings := make([]admin.DiskBackupCopySetting, 0) for _, tfMapRaw := range tfList { tfMap, ok := tfMapRaw.(map[string]any) diff --git a/internal/service/cloudbackupschedule/resource_cloud_backup_schedule_migration_test.go b/internal/service/cloudbackupschedule/resource_cloud_backup_schedule_migration_test.go index 55d991a9c8..2caacc8108 100644 --- a/internal/service/cloudbackupschedule/resource_cloud_backup_schedule_migration_test.go +++ b/internal/service/cloudbackupschedule/resource_cloud_backup_schedule_migration_test.go @@ -7,7 +7,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc" "github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/mig" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func TestMigBackupRSCloudBackupSchedule_basic(t *testing.T) { @@ -28,7 +28,7 @@ func TestMigBackupRSCloudBackupSchedule_basic(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "cluster_name", clusterInfo.ClusterName), resource.TestCheckResourceAttr(resourceName, "cluster_name", clusterInfo.ClusterName), diff --git a/internal/service/cloudbackupschedule/resource_cloud_backup_schedule_test.go b/internal/service/cloudbackupschedule/resource_cloud_backup_schedule_test.go index d3cd652f2b..8dbabca280 100644 --- a/internal/service/cloudbackupschedule/resource_cloud_backup_schedule_test.go +++ b/internal/service/cloudbackupschedule/resource_cloud_backup_schedule_test.go @@ -10,7 +10,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/constant" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) var ( @@ -34,7 +34,7 @@ func TestAccBackupRSCloudBackupSchedule_basic(t *testing.T) { ReferenceMinuteOfHour: conversion.Pointer(45), RestoreWindowDays: conversion.Pointer(4), }), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "cluster_name", clusterInfo.ClusterName), resource.TestCheckResourceAttr(resourceName, "reference_hour_of_day", "3"), @@ -62,7 +62,7 @@ func TestAccBackupRSCloudBackupSchedule_basic(t *testing.T) { ReferenceMinuteOfHour: conversion.Pointer(0), RestoreWindowDays: conversion.Pointer(7), }, true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "cluster_name", clusterInfo.ClusterName), resource.TestCheckResourceAttr(resourceName, "reference_hour_of_day", "0"), @@ -105,7 +105,7 @@ func TestAccBackupRSCloudBackupSchedule_basic(t *testing.T) { ReferenceMinuteOfHour: conversion.Pointer(0), RestoreWindowDays: conversion.Pointer(7), }), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "cluster_name", clusterInfo.ClusterName), resource.TestCheckResourceAttr(resourceName, "auto_export_enabled", "false"), @@ -165,7 +165,7 @@ func TestAccBackupRSCloudBackupSchedule_export(t *testing.T) { Steps: []resource.TestStep{ { Config: configExportPolicies(&clusterInfo, policyName, roleName, bucketName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "cluster_name", clusterInfo.ClusterName), resource.TestCheckResourceAttr(resourceName, "auto_export_enabled", "true"), @@ -197,7 +197,7 @@ func TestAccBackupRSCloudBackupSchedule_onePolicy(t *testing.T) { ReferenceMinuteOfHour: conversion.Pointer(45), RestoreWindowDays: conversion.Pointer(4), }), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "cluster_name", clusterInfo.ClusterName), resource.TestCheckResourceAttr(resourceName, "reference_hour_of_day", "3"), @@ -231,7 +231,7 @@ func TestAccBackupRSCloudBackupSchedule_onePolicy(t *testing.T) { ReferenceMinuteOfHour: conversion.Pointer(0), RestoreWindowDays: conversion.Pointer(7), }), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "cluster_name", clusterInfo.ClusterName), resource.TestCheckResourceAttr(resourceName, "reference_hour_of_day", "0"), @@ -254,7 +254,45 @@ func TestAccBackupRSCloudBackupSchedule_copySettings(t *testing.T) { var ( projectID = acc.ProjectIDExecution(t) clusterName = acc.RandomClusterName() + checkMap = map[string]string{ + "cluster_name": clusterName, + "reference_hour_of_day": "3", + "reference_minute_of_hour": "45", + "restore_window_days": "1", + "policy_item_hourly.#": "1", + "policy_item_daily.#": "1", + "policy_item_weekly.#": "1", + "policy_item_monthly.#": "1", + "policy_item_yearly.#": "1", + "policy_item_hourly.0.frequency_interval": "1", + "policy_item_hourly.0.retention_unit": "days", + "policy_item_hourly.0.retention_value": "1", + "policy_item_daily.0.frequency_interval": "1", + "policy_item_daily.0.retention_unit": "days", + "policy_item_daily.0.retention_value": "2", + "policy_item_weekly.0.frequency_interval": "4", + "policy_item_weekly.0.retention_unit": "weeks", + "policy_item_weekly.0.retention_value": "3", + "policy_item_monthly.0.frequency_interval": "5", + "policy_item_monthly.0.retention_unit": "months", + "policy_item_monthly.0.retention_value": "4", + "policy_item_yearly.0.frequency_interval": "1", + "policy_item_yearly.0.retention_unit": "years", + "policy_item_yearly.0.retention_value": "1", + } + copySettingsChecks = map[string]string{ + "copy_settings.#": "1", + "copy_settings.0.cloud_provider": "AWS", + "copy_settings.0.region_name": "US_EAST_1", + "copy_settings.0.should_copy_oplogs": "true", + } + emptyCopySettingsChecks = map[string]string{ + "copy_settings.#": "0", + } ) + checksDefault := acc.AddAttrChecks(resourceName, []resource.TestCheckFunc{checkExists(resourceName)}, checkMap) + checksCreate := acc.AddAttrChecks(resourceName, checksDefault, copySettingsChecks) + checksUpdate := acc.AddAttrChecks(resourceName, checksDefault, emptyCopySettingsChecks) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acc.PreCheckBasic(t) }, @@ -262,41 +300,20 @@ func TestAccBackupRSCloudBackupSchedule_copySettings(t *testing.T) { CheckDestroy: checkDestroy, Steps: []resource.TestStep{ { - Config: configCopySettings(projectID, clusterName, &admin.DiskBackupSnapshotSchedule{ + Config: configCopySettings(projectID, clusterName, false, &admin.DiskBackupSnapshotSchedule{ ReferenceHourOfDay: conversion.Pointer(3), ReferenceMinuteOfHour: conversion.Pointer(45), RestoreWindowDays: conversion.Pointer(1), }), - Check: resource.ComposeTestCheckFunc( - checkExists(resourceName), - resource.TestCheckResourceAttr(resourceName, "cluster_name", clusterName), - resource.TestCheckResourceAttr(resourceName, "reference_hour_of_day", "3"), - resource.TestCheckResourceAttr(resourceName, "reference_minute_of_hour", "45"), - resource.TestCheckResourceAttr(resourceName, "restore_window_days", "1"), - resource.TestCheckResourceAttr(resourceName, "policy_item_hourly.#", "1"), - resource.TestCheckResourceAttr(resourceName, "policy_item_daily.#", "1"), - resource.TestCheckResourceAttr(resourceName, "policy_item_weekly.#", "1"), - resource.TestCheckResourceAttr(resourceName, "policy_item_monthly.#", "1"), - resource.TestCheckResourceAttr(resourceName, "policy_item_yearly.#", "1"), - resource.TestCheckResourceAttr(resourceName, "policy_item_hourly.0.frequency_interval", "1"), - resource.TestCheckResourceAttr(resourceName, "policy_item_hourly.0.retention_unit", "days"), - resource.TestCheckResourceAttr(resourceName, "policy_item_hourly.0.retention_value", "1"), - resource.TestCheckResourceAttr(resourceName, "policy_item_daily.0.frequency_interval", "1"), - resource.TestCheckResourceAttr(resourceName, "policy_item_daily.0.retention_unit", "days"), - resource.TestCheckResourceAttr(resourceName, "policy_item_daily.0.retention_value", "2"), - resource.TestCheckResourceAttr(resourceName, "policy_item_weekly.0.frequency_interval", "4"), - resource.TestCheckResourceAttr(resourceName, "policy_item_weekly.0.retention_unit", "weeks"), - resource.TestCheckResourceAttr(resourceName, "policy_item_weekly.0.retention_value", "3"), - resource.TestCheckResourceAttr(resourceName, "policy_item_monthly.0.frequency_interval", "5"), - resource.TestCheckResourceAttr(resourceName, "policy_item_monthly.0.retention_unit", "months"), - resource.TestCheckResourceAttr(resourceName, "policy_item_monthly.0.retention_value", "4"), - resource.TestCheckResourceAttr(resourceName, "policy_item_yearly.0.frequency_interval", "1"), - resource.TestCheckResourceAttr(resourceName, "policy_item_yearly.0.retention_unit", "years"), - resource.TestCheckResourceAttr(resourceName, "policy_item_yearly.0.retention_value", "1"), - resource.TestCheckResourceAttr(resourceName, "copy_settings.0.cloud_provider", "AWS"), - resource.TestCheckResourceAttr(resourceName, "copy_settings.0.region_name", "US_EAST_1"), - resource.TestCheckResourceAttr(resourceName, "copy_settings.0.should_copy_oplogs", "true"), - ), + Check: resource.ComposeAggregateTestCheckFunc(checksCreate...), + }, + { + Config: configCopySettings(projectID, clusterName, true, &admin.DiskBackupSnapshotSchedule{ + ReferenceHourOfDay: conversion.Pointer(3), + ReferenceMinuteOfHour: conversion.Pointer(45), + RestoreWindowDays: conversion.Pointer(1), + }), + Check: resource.ComposeAggregateTestCheckFunc(checksUpdate...), }, }, }) @@ -317,7 +334,7 @@ func TestAccBackupRSCloudBackupScheduleImport_basic(t *testing.T) { ReferenceMinuteOfHour: conversion.Pointer(45), RestoreWindowDays: conversion.Pointer(4), }), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "cluster_name", clusterInfo.ClusterName), resource.TestCheckResourceAttr(resourceName, "reference_hour_of_day", "3"), @@ -371,7 +388,7 @@ func TestAccBackupRSCloudBackupSchedule_azure(t *testing.T) { RetentionUnit: "days", RetentionValue: 1, }), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "cluster_name", clusterInfo.ClusterName), resource.TestCheckResourceAttr(resourceName, "policy_item_hourly.0.frequency_interval", "1"), @@ -384,7 +401,7 @@ func TestAccBackupRSCloudBackupSchedule_azure(t *testing.T) { RetentionUnit: "days", RetentionValue: 3, }), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "cluster_name", clusterInfo.ClusterName), resource.TestCheckResourceAttr(resourceName, "policy_item_hourly.0.frequency_interval", "2"), @@ -507,7 +524,23 @@ func configDefault(info *acc.ClusterInfo, p *admin.DiskBackupSnapshotSchedule) s `, info.ClusterNameStr, info.ProjectIDStr, p.GetReferenceHourOfDay(), p.GetReferenceMinuteOfHour(), p.GetRestoreWindowDays()) } -func configCopySettings(projectID, clusterName string, p *admin.DiskBackupSnapshotSchedule) string { +func configCopySettings(projectID, clusterName string, emptyCopySettings bool, p *admin.DiskBackupSnapshotSchedule) string { + var copySettings string + if !emptyCopySettings { + copySettings = ` + copy_settings { + cloud_provider = "AWS" + frequencies = ["HOURLY", + "DAILY", + "WEEKLY", + "MONTHLY", + "YEARLY", + "ON_DEMAND"] + region_name = "US_EAST_1" + replication_spec_id = mongodbatlas_cluster.my_cluster.replication_specs.*.id[0] + should_copy_oplogs = true + }` + } return fmt.Sprintf(` resource "mongodbatlas_cluster" "my_cluster" { project_id = %[1]q @@ -564,20 +597,9 @@ func configCopySettings(projectID, clusterName string, p *admin.DiskBackupSnapsh retention_unit = "years" retention_value = 1 } - copy_settings { - cloud_provider = "AWS" - frequencies = ["HOURLY", - "DAILY", - "WEEKLY", - "MONTHLY", - "YEARLY", - "ON_DEMAND"] - region_name = "US_EAST_1" - replication_spec_id = mongodbatlas_cluster.my_cluster.replication_specs.*.id[0] - should_copy_oplogs = true - } + %s } - `, projectID, clusterName, p.GetReferenceHourOfDay(), p.GetReferenceMinuteOfHour(), p.GetRestoreWindowDays()) + `, projectID, clusterName, p.GetReferenceHourOfDay(), p.GetReferenceMinuteOfHour(), p.GetRestoreWindowDays(), copySettings) } func configOnePolicy(info *acc.ClusterInfo, p *admin.DiskBackupSnapshotSchedule) string { diff --git a/internal/service/cloudbackupsnapshot/data_source_cloud_backup_snapshots.go b/internal/service/cloudbackupsnapshot/data_source_cloud_backup_snapshots.go index c1e2fa3eed..c5cc844e62 100644 --- a/internal/service/cloudbackupsnapshot/data_source_cloud_backup_snapshots.go +++ b/internal/service/cloudbackupsnapshot/data_source_cloud_backup_snapshots.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func PluralDataSource() *schema.Resource { diff --git a/internal/service/cloudbackupsnapshot/model_cloud_backup_snapshot.go b/internal/service/cloudbackupsnapshot/model_cloud_backup_snapshot.go index 00ea9cdc57..6c3539b16f 100644 --- a/internal/service/cloudbackupsnapshot/model_cloud_backup_snapshot.go +++ b/internal/service/cloudbackupsnapshot/model_cloud_backup_snapshot.go @@ -4,7 +4,7 @@ import ( "errors" "regexp" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func SplitSnapshotImportID(id string) (*admin.GetReplicaSetBackupApiParams, error) { diff --git a/internal/service/cloudbackupsnapshot/model_cloud_backup_snapshot_test.go b/internal/service/cloudbackupsnapshot/model_cloud_backup_snapshot_test.go index 59e3a91dc3..2279919f71 100644 --- a/internal/service/cloudbackupsnapshot/model_cloud_backup_snapshot_test.go +++ b/internal/service/cloudbackupsnapshot/model_cloud_backup_snapshot_test.go @@ -5,7 +5,7 @@ import ( "github.com/go-test/deep" "github.com/mongodb/terraform-provider-mongodbatlas/internal/service/cloudbackupsnapshot" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func TestSplitSnapshotImportID(t *testing.T) { diff --git a/internal/service/cloudbackupsnapshot/resource_cloud_backup_snapshot.go b/internal/service/cloudbackupsnapshot/resource_cloud_backup_snapshot.go index c2e8e8f8f1..beb904109f 100644 --- a/internal/service/cloudbackupsnapshot/resource_cloud_backup_snapshot.go +++ b/internal/service/cloudbackupsnapshot/resource_cloud_backup_snapshot.go @@ -14,7 +14,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" "github.com/mongodb/terraform-provider-mongodbatlas/internal/service/cluster" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func Resource() *schema.Resource { diff --git a/internal/service/cloudbackupsnapshot/resource_cloud_backup_snapshot_migration_test.go b/internal/service/cloudbackupsnapshot/resource_cloud_backup_snapshot_migration_test.go index 3ceff53768..6db8a17ea7 100644 --- a/internal/service/cloudbackupsnapshot/resource_cloud_backup_snapshot_migration_test.go +++ b/internal/service/cloudbackupsnapshot/resource_cloud_backup_snapshot_migration_test.go @@ -23,7 +23,7 @@ func TestMigBackupRSCloudBackupSnapshot_basic(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "type", "replicaSet"), @@ -42,6 +42,7 @@ func TestMigBackupRSCloudBackupSnapshot_basic(t *testing.T) { } func TestMigBackupRSCloudBackupSnapshot_sharded(t *testing.T) { + acc.SkipTestForCI(t) // TODO: CLOUDP-260154 for ensuring this use case is supported var ( projectID = acc.ProjectIDExecution(t) clusterName = acc.RandomClusterName() @@ -57,7 +58,7 @@ func TestMigBackupRSCloudBackupSnapshot_sharded(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "type", "shardedCluster"), diff --git a/internal/service/cloudbackupsnapshot/resource_cloud_backup_snapshot_test.go b/internal/service/cloudbackupsnapshot/resource_cloud_backup_snapshot_test.go index 65015afc3e..0bb2eb1fbd 100644 --- a/internal/service/cloudbackupsnapshot/resource_cloud_backup_snapshot_test.go +++ b/internal/service/cloudbackupsnapshot/resource_cloud_backup_snapshot_test.go @@ -32,7 +32,7 @@ func TestAccBackupRSCloudBackupSnapshot_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(&clusterInfo, description, retentionInDays), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "type", "replicaSet"), @@ -67,6 +67,7 @@ func TestAccBackupRSCloudBackupSnapshot_basic(t *testing.T) { } func TestAccBackupRSCloudBackupSnapshot_sharded(t *testing.T) { + acc.SkipTestForCI(t) // TODO: CLOUDP-260154 for ensuring this use case is supported var ( projectID = acc.ProjectIDExecution(t) clusterName = acc.RandomClusterName() @@ -81,7 +82,7 @@ func TestAccBackupRSCloudBackupSnapshot_sharded(t *testing.T) { Steps: []resource.TestStep{ { Config: configSharded(projectID, clusterName, description, retentionInDays), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "type", "shardedCluster"), diff --git a/internal/service/cloudbackupsnapshotexportbucket/data_source_cloud_backup_snapshot_export_buckets.go b/internal/service/cloudbackupsnapshotexportbucket/data_source_cloud_backup_snapshot_export_buckets.go index 8ab51bbb2f..8b1b93feef 100644 --- a/internal/service/cloudbackupsnapshotexportbucket/data_source_cloud_backup_snapshot_export_buckets.go +++ b/internal/service/cloudbackupsnapshotexportbucket/data_source_cloud_backup_snapshot_export_buckets.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func PluralDataSource() *schema.Resource { @@ -83,7 +83,7 @@ func dataSourceRead(ctx context.Context, d *schema.ResourceData, meta any) diag. return nil } -func flattenBuckets(buckets []admin.DiskBackupSnapshotAWSExportBucket) []map[string]any { +func flattenBuckets(buckets []admin.DiskBackupSnapshotExportBucket) []map[string]any { var results []map[string]any if len(buckets) == 0 { diff --git a/internal/service/cloudbackupsnapshotexportbucket/resource_cloud_backup_snapshot_export_bucket.go b/internal/service/cloudbackupsnapshotexportbucket/resource_cloud_backup_snapshot_export_bucket.go index 5db931461a..0da3e4a58f 100644 --- a/internal/service/cloudbackupsnapshotexportbucket/resource_cloud_backup_snapshot_export_bucket.go +++ b/internal/service/cloudbackupsnapshotexportbucket/resource_cloud_backup_snapshot_export_bucket.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func Resource() *schema.Resource { @@ -72,7 +72,7 @@ func resourceCreate(ctx context.Context, d *schema.ResourceData, meta any) diag. return diag.Errorf("atlas only supports AWS") } - request := &admin.DiskBackupSnapshotAWSExportBucket{ + request := &admin.DiskBackupSnapshotExportBucket{ IamRoleId: conversion.StringPtr(d.Get("iam_role_id").(string)), BucketName: conversion.StringPtr(d.Get("bucket_name").(string)), CloudProvider: &cloudProvider, diff --git a/internal/service/cloudbackupsnapshotexportbucket/resource_cloud_backup_snapshot_export_bucket_test.go b/internal/service/cloudbackupsnapshotexportbucket/resource_cloud_backup_snapshot_export_bucket_test.go index 55e8b50f0d..e2ba34e1c3 100644 --- a/internal/service/cloudbackupsnapshotexportbucket/resource_cloud_backup_snapshot_export_bucket_test.go +++ b/internal/service/cloudbackupsnapshotexportbucket/resource_cloud_backup_snapshot_export_bucket_test.go @@ -40,7 +40,7 @@ func basicTestCase(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configBasic(projectID, bucketName, policyName, roleName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "bucket_name", bucketName), diff --git a/internal/service/cloudbackupsnapshotexportjob/resource_cloud_backup_snapshot_export_job_test.go b/internal/service/cloudbackupsnapshotexportjob/resource_cloud_backup_snapshot_export_job_test.go index c5ee88466d..4b451363e5 100644 --- a/internal/service/cloudbackupsnapshotexportjob/resource_cloud_backup_snapshot_export_job_test.go +++ b/internal/service/cloudbackupsnapshotexportjob/resource_cloud_backup_snapshot_export_job_test.go @@ -59,7 +59,7 @@ func basicTestCase(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configBasic(projectID, bucketName, roleName, policyName, clusterInfo.ClusterNameStr, clusterInfo.ClusterTerraformStr), - Check: resource.ComposeTestCheckFunc(checks...), + Check: resource.ComposeAggregateTestCheckFunc(checks...), }, { ResourceName: resourceName, diff --git a/internal/service/cloudbackupsnapshotrestorejob/data_source_cloud_backup_snapshot_restore_jobs.go b/internal/service/cloudbackupsnapshotrestorejob/data_source_cloud_backup_snapshot_restore_jobs.go index c2490cc147..78d743e3ab 100644 --- a/internal/service/cloudbackupsnapshotrestorejob/data_source_cloud_backup_snapshot_restore_jobs.go +++ b/internal/service/cloudbackupsnapshotrestorejob/data_source_cloud_backup_snapshot_restore_jobs.go @@ -10,7 +10,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/constant" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func PluralDataSource() *schema.Resource { diff --git a/internal/service/cloudbackupsnapshotrestorejob/resource_cloud_backup_snapshot_restore_job.go b/internal/service/cloudbackupsnapshotrestorejob/resource_cloud_backup_snapshot_restore_job.go index 2ae6240ba1..682e36a27f 100644 --- a/internal/service/cloudbackupsnapshotrestorejob/resource_cloud_backup_snapshot_restore_job.go +++ b/internal/service/cloudbackupsnapshotrestorejob/resource_cloud_backup_snapshot_restore_job.go @@ -13,7 +13,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/constant" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func Resource() *schema.Resource { diff --git a/internal/service/cloudbackupsnapshotrestorejob/resource_cloud_backup_snapshot_restore_job_test.go b/internal/service/cloudbackupsnapshotrestorejob/resource_cloud_backup_snapshot_restore_job_test.go index 7418f22183..188b026b33 100644 --- a/internal/service/cloudbackupsnapshotrestorejob/resource_cloud_backup_snapshot_restore_job_test.go +++ b/internal/service/cloudbackupsnapshotrestorejob/resource_cloud_backup_snapshot_restore_job_test.go @@ -38,7 +38,7 @@ func TestAccCloudBackupSnapshotRestoreJob_basicDownload(t *testing.T) { Steps: []resource.TestStep{ { Config: configDownload(projectID, clusterName, description, retentionInDays, useSnapshotID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "delivery_type_config.0.download", "true"), ), @@ -70,7 +70,7 @@ func basicTestCase(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configBasic(projectID, clusterName, description, retentionInDays), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "delivery_type_config.0.automated", "true"), resource.TestCheckResourceAttr(resourceName, "delivery_type_config.0.target_cluster_name", clusterName), diff --git a/internal/service/cloudprovideraccess/resource_cloud_provider_access_authorization.go b/internal/service/cloudprovideraccess/resource_cloud_provider_access_authorization.go index 866225fe31..43c2c06a53 100644 --- a/internal/service/cloudprovideraccess/resource_cloud_provider_access_authorization.go +++ b/internal/service/cloudprovideraccess/resource_cloud_provider_access_authorization.go @@ -12,7 +12,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/constant" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) /* diff --git a/internal/service/cloudprovideraccess/resource_cloud_provider_access_authorization_test.go b/internal/service/cloudprovideraccess/resource_cloud_provider_access_authorization_test.go index a567d1be78..eb614d68b9 100644 --- a/internal/service/cloudprovideraccess/resource_cloud_provider_access_authorization_test.go +++ b/internal/service/cloudprovideraccess/resource_cloud_provider_access_authorization_test.go @@ -59,7 +59,7 @@ func basicAuthorizationTestCase(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configAuthorizationAWS(projectID, policyName, roleName, federatedDatabaseInstanceName, testS3Bucket), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttrSet(resourceName, "role_id"), @@ -69,7 +69,7 @@ func basicAuthorizationTestCase(tb testing.TB) *resource.TestCase { }, { Config: configAuthorizationAWS(projectID, policyName, roleNameUpdated, federatedDatabaseInstanceName, testS3Bucket), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttrSet(resourceName, "role_id"), diff --git a/internal/service/cloudprovideraccess/resource_cloud_provider_access_setup.go b/internal/service/cloudprovideraccess/resource_cloud_provider_access_setup.go index f1fa66be18..d796f48bdc 100644 --- a/internal/service/cloudprovideraccess/resource_cloud_provider_access_setup.go +++ b/internal/service/cloudprovideraccess/resource_cloud_provider_access_setup.go @@ -6,7 +6,7 @@ import ( "net/http" "regexp" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" diff --git a/internal/service/cloudprovideraccess/resource_cloud_provider_access_setup_test.go b/internal/service/cloudprovideraccess/resource_cloud_provider_access_setup_test.go index 04efe80e85..29023957ef 100644 --- a/internal/service/cloudprovideraccess/resource_cloud_provider_access_setup_test.go +++ b/internal/service/cloudprovideraccess/resource_cloud_provider_access_setup_test.go @@ -33,7 +33,7 @@ func TestAccCloudProviderAccessSetupAzure_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configSetupAzure(projectID, atlasAzureAppID, servicePrincipalID, tenantID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "role_id"), resource.TestCheckResourceAttrSet(resourceName, "azure_config.0.atlas_azure_app_id"), @@ -70,7 +70,7 @@ func basicSetupTestCase(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configSetupAWS(projectID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // same as regular cloud resource checkExists(resourceName), resource.TestCheckResourceAttrSet(dataSourceName, "aws_config.0.atlas_assumed_role_external_id"), diff --git a/internal/service/cluster/resource_cluster_test.go b/internal/service/cluster/resource_cluster_test.go index 1c2a0f6f7e..50dedc053c 100644 --- a/internal/service/cluster/resource_cluster_test.go +++ b/internal/service/cluster/resource_cluster_test.go @@ -42,7 +42,7 @@ func basicTestCase(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configAWS(projectID, clusterName, true, true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -64,7 +64,7 @@ func basicTestCase(tb testing.TB) *resource.TestCase { }, { Config: configAWS(projectID, clusterName, false, false), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -116,7 +116,7 @@ func partialAdvancedConfTestCase(tb testing.TB) *resource.TestCase { SampleSizeBIConnector: conversion.Pointer[int64](110), TransactionLifetimeLimitSeconds: conversion.Pointer[int64](300), }), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "advanced_configuration.0.fail_index_key_too_long", "false"), resource.TestCheckResourceAttr(resourceName, "advanced_configuration.0.javascript_enabled", "true"), @@ -141,7 +141,7 @@ func partialAdvancedConfTestCase(tb testing.TB) *resource.TestCase { Config: configAdvancedConfPartial(projectID, clusterName, "false", &matlas.ProcessArgs{ MinimumEnabledTLSProtocol: "TLS1_2", }), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "advanced_configuration.0.fail_index_key_too_long", "false"), resource.TestCheckResourceAttr(resourceName, "advanced_configuration.0.javascript_enabled", "true"), @@ -180,7 +180,7 @@ func TestAccCluster_basic_DefaultWriteRead_AdvancedConf(t *testing.T) { SampleSizeBIConnector: conversion.Pointer[int64](110), TransactionLifetimeLimitSeconds: conversion.Pointer[int64](300), }), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "advanced_configuration.0.default_read_concern", "available"), resource.TestCheckResourceAttr(resourceName, "advanced_configuration.0.default_write_concern", "1"), @@ -196,7 +196,7 @@ func TestAccCluster_basic_DefaultWriteRead_AdvancedConf(t *testing.T) { Config: configAdvancedConfPartialDefault(projectID, clusterName, "false", &matlas.ProcessArgs{ MinimumEnabledTLSProtocol: "TLS1_2", }), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "advanced_configuration.0.default_read_concern", "available"), resource.TestCheckResourceAttr(resourceName, "advanced_configuration.0.default_write_concern", "1"), @@ -239,7 +239,7 @@ func TestAccCluster_emptyAdvancedConf(t *testing.T) { SampleSizeBIConnector: conversion.Pointer[int64](110), TransactionLifetimeLimitSeconds: conversion.Pointer[int64](300), }), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "advanced_configuration.0.fail_index_key_too_long", "false"), resource.TestCheckResourceAttr(resourceName, "advanced_configuration.0.javascript_enabled", "true"), resource.TestCheckResourceAttr(resourceName, "advanced_configuration.0.minimum_enabled_tls_protocol", "TLS1_1"), @@ -276,7 +276,7 @@ func TestAccCluster_basicAdvancedConf(t *testing.T) { SampleSizeBIConnector: conversion.Pointer[int64](110), TransactionLifetimeLimitSeconds: conversion.Pointer[int64](300), }), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "advanced_configuration.0.fail_index_key_too_long", "false"), resource.TestCheckResourceAttr(resourceName, "advanced_configuration.0.javascript_enabled", "true"), @@ -299,7 +299,7 @@ func TestAccCluster_basicAdvancedConf(t *testing.T) { SampleSizeBIConnector: conversion.Pointer[int64](0), TransactionLifetimeLimitSeconds: conversion.Pointer[int64](60), }), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "advanced_configuration.0.fail_index_key_too_long", "false"), resource.TestCheckResourceAttr(resourceName, "advanced_configuration.0.javascript_enabled", "false"), @@ -330,7 +330,7 @@ func TestAccCluster_basicAzure(t *testing.T) { Steps: []resource.TestStep{ { Config: configAzure(orgID, projectName, clusterName, "true", "M30", true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -341,7 +341,7 @@ func TestAccCluster_basicAzure(t *testing.T) { }, { Config: configAzure(orgID, projectName, clusterName, "false", "M30", true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -369,7 +369,7 @@ func TestAccCluster_basicGCP(t *testing.T) { Steps: []resource.TestStep{ { Config: configGCP(orgID, projectName, clusterName, "true"), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -381,7 +381,7 @@ func TestAccCluster_basicGCP(t *testing.T) { }, { Config: configGCP(orgID, projectName, clusterName, "false"), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -410,7 +410,7 @@ func TestAccCluster_WithBiConnectorGCP(t *testing.T) { Steps: []resource.TestStep{ { Config: configGCPWithBiConnector(orgID, projectName, clusterName, "true", false), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -423,7 +423,7 @@ func TestAccCluster_WithBiConnectorGCP(t *testing.T) { }, { Config: configGCPWithBiConnector(orgID, projectName, clusterName, "false", true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -479,7 +479,7 @@ func TestAccCluster_MultiRegion(t *testing.T) { Steps: []resource.TestStep{ { Config: configMultiRegion(orgID, projectName, clusterName, "true", createRegionsConfig), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "mongo_uri"), resource.TestCheckResourceAttrSet(resourceName, "project_id"), @@ -494,7 +494,7 @@ func TestAccCluster_MultiRegion(t *testing.T) { }, { Config: configMultiRegion(orgID, projectName, clusterName, "false", updatedRegionsConfig), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "mongo_uri"), resource.TestCheckResourceAttrSet(resourceName, "project_id"), @@ -549,7 +549,7 @@ func TestAccCluster_ProviderRegionName(t *testing.T) { }, { Config: configSingleRegionWithProviderRegionName(orgID, projectName, clusterName, "false"), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "mongo_uri"), resource.TestCheckResourceAttrSet(resourceName, "project_id"), @@ -564,7 +564,7 @@ func TestAccCluster_ProviderRegionName(t *testing.T) { }, { Config: configMultiRegion(orgID, projectName, clusterName, "false", updatedRegionsConfig), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "mongo_uri"), resource.TestCheckResourceAttrSet(resourceName, "project_id"), @@ -604,7 +604,7 @@ func TestAccCluster_Global(t *testing.T) { Steps: []resource.TestStep{ { Config: acc.ConfigClusterGlobal(orgID, projectName, clusterName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "mongo_uri"), resource.TestCheckResourceAttrSet(resourceName, "project_id"), @@ -637,7 +637,7 @@ func TestAccCluster_AWSWithLabels(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccMongoDBAtlasClusterAWSConfigdWithLabels(projectID, clusterName, "false", "M10", "US_WEST_2", []matlas.Label{}), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -663,7 +663,7 @@ func TestAccCluster_AWSWithLabels(t *testing.T) { }, }, ), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -685,7 +685,7 @@ func TestAccCluster_AWSWithLabels(t *testing.T) { }, }, ), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -713,7 +713,7 @@ func TestAccCluster_WithTags(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithTags(orgID, projectName, clusterName, "false", "M10", "US_WEST_2", []matlas.Tag{}), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -736,7 +736,7 @@ func TestAccCluster_WithTags(t *testing.T) { }, }, ), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -761,7 +761,7 @@ func TestAccCluster_WithTags(t *testing.T) { }, }, ), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -805,7 +805,7 @@ func TestAccCluster_withPrivateEndpointLink(t *testing.T) { { Config: configWithPrivateEndpointLink( awsAccessKey, awsSecretKey, projectID, providerName, region, vpcID, subnetID, securityGroupID, clusterName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), ), @@ -839,7 +839,7 @@ func TestAccCluster_withAzureNetworkPeering(t *testing.T) { Steps: []resource.TestStep{ { Config: configAzureWithNetworkPeering(projectID, providerName, directoryID, subcrptionID, resourceGroupName, vNetName, clusterName, atlasCidrBlock, region), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "name"), @@ -869,7 +869,7 @@ func TestAccCluster_withGCPNetworkPeering(t *testing.T) { Steps: []resource.TestStep{ { Config: configGCPWithNetworkPeering(gcpProjectID, gcpRegion, projectID, providerName, gcpPeeringName, clusterName, gcpClusterRegion), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -904,7 +904,7 @@ func TestAccCluster_withAzureAndContainerID(t *testing.T) { Steps: []resource.TestStep{ { Config: configAzureWithContainerID(projectID, clusterName, providerName, region, directoryID, subcrptionID, resourceGroupName, vNetName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "name"), resource.TestCheckResourceAttrSet(resourceName, "container_id"), @@ -935,7 +935,7 @@ func TestAccCluster_withAWSAndContainerID(t *testing.T) { Steps: []resource.TestStep{ { Config: configAWSWithContainerID(awsAccessKey, awsSecretKey, projectID, clusterName, providerName, awsRegion, vpcCIDRBlock, awsAccountID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "name"), resource.TestCheckResourceAttrSet(resourceName, "container_id"), @@ -965,7 +965,7 @@ func TestAccCluster_withGCPAndContainerID(t *testing.T) { Steps: []resource.TestStep{ { Config: configGCPWithContainerID(gcpProjectID, gcpRegion, projectID, clusterName, providerName, gcpClusterRegion, gcpPeeringName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), resource.TestCheckResourceAttr(resourceName, "disk_size_gb", "5"), @@ -999,7 +999,7 @@ func TestAccCluster_withAutoScalingAWS(t *testing.T) { Steps: []resource.TestStep{ { Config: configAWSWithAutoscaling(projectID, clusterName, "true", "false", "true", "false", minSize, maxSize, instanceSize), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -1018,7 +1018,7 @@ func TestAccCluster_withAutoScalingAWS(t *testing.T) { }, { Config: configAWSWithAutoscaling(projectID, clusterName, "false", "true", "true", "true", minSizeUpdated, maxSizeUpdated, instanceSizeUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -1049,7 +1049,7 @@ func TestAccCluster_tenant(t *testing.T) { Steps: []resource.TestStep{ { Config: configTenant(orgID, projectName, clusterName, "M2", "2", dbMajorVersion), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -1059,7 +1059,7 @@ func TestAccCluster_tenant(t *testing.T) { }, { Config: configTenantUpdated(orgID, projectName, clusterName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -1087,7 +1087,7 @@ func TestAccCluster_tenant_m5(t *testing.T) { Steps: []resource.TestStep{ { Config: configTenant(orgID, projectName, clusterName, "M5", "5", dbMajorVersion), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -1114,7 +1114,7 @@ func TestAccCluster_basicGCPRegionNameWesternUS(t *testing.T) { Steps: []resource.TestStep{ { Config: configGCPRegionName(orgID, projectName, clusterName, regionName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), resource.TestCheckResourceAttr(resourceName, "provider_region_name", regionName), @@ -1139,7 +1139,7 @@ func TestAccCluster_basicGCPRegionNameUSWest2(t *testing.T) { Steps: []resource.TestStep{ { Config: configGCPRegionName(orgID, projectName, clusterName, regionName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), resource.TestCheckResourceAttr(resourceName, "provider_region_name", regionName), @@ -1238,7 +1238,7 @@ func TestAccCluster_RegionsConfig(t *testing.T) { Steps: []resource.TestStep{ { Config: configRegions(orgID, projectName, clusterName, replications), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), resource.TestCheckResourceAttr(resourceName, "replication_specs.#", "3"), @@ -1246,7 +1246,7 @@ func TestAccCluster_RegionsConfig(t *testing.T) { }, { Config: configRegions(orgID, projectName, clusterName, replicationsUpdate), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), resource.TestCheckResourceAttr(resourceName, "replication_specs.#", "2"), @@ -1254,7 +1254,7 @@ func TestAccCluster_RegionsConfig(t *testing.T) { }, { Config: configRegions(orgID, projectName, clusterName, replicationsShardsUpdate), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), resource.TestCheckResourceAttr(resourceName, "replication_specs.#", "2"), @@ -1280,7 +1280,7 @@ func TestAccCluster_basicAWS_UnpauseToPaused(t *testing.T) { Steps: []resource.TestStep{ { Config: configAWSPaused(projectID, clusterName, true, false), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -1293,7 +1293,7 @@ func TestAccCluster_basicAWS_UnpauseToPaused(t *testing.T) { }, { Config: configAWSPaused(projectID, clusterName, false, true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -1328,7 +1328,7 @@ func TestAccCluster_basicAWS_PausedToUnpaused(t *testing.T) { Steps: []resource.TestStep{ { Config: configAWSPaused(projectID, clusterName, true, true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), @@ -1341,7 +1341,7 @@ func TestAccCluster_basicAWS_PausedToUnpaused(t *testing.T) { }, { Config: configAWSPaused(projectID, clusterName, false, false), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", clusterName), diff --git a/internal/service/clusteroutagesimulation/resource_cluster_outage_simulation.go b/internal/service/clusteroutagesimulation/resource_cluster_outage_simulation.go index fff252de53..284d1d04c2 100644 --- a/internal/service/clusteroutagesimulation/resource_cluster_outage_simulation.go +++ b/internal/service/clusteroutagesimulation/resource_cluster_outage_simulation.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/clusteroutagesimulation/resource_cluster_outage_simulation_migration_test.go b/internal/service/clusteroutagesimulation/resource_cluster_outage_simulation_migration_test.go index c58d288034..3a9cc5f190 100644 --- a/internal/service/clusteroutagesimulation/resource_cluster_outage_simulation_migration_test.go +++ b/internal/service/clusteroutagesimulation/resource_cluster_outage_simulation_migration_test.go @@ -22,7 +22,7 @@ func TestMigOutageSimulationCluster_SingleRegion_basic(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "cluster_name", clusterName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "outage_filters.#"), @@ -50,7 +50,7 @@ func TestMigOutageSimulationCluster_MultiRegion_basic(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "cluster_name", clusterName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "outage_filters.#"), diff --git a/internal/service/clusteroutagesimulation/resource_cluster_outage_simulation_test.go b/internal/service/clusteroutagesimulation/resource_cluster_outage_simulation_test.go index 60a2d9f9fc..a1224b620e 100644 --- a/internal/service/clusteroutagesimulation/resource_cluster_outage_simulation_test.go +++ b/internal/service/clusteroutagesimulation/resource_cluster_outage_simulation_test.go @@ -29,7 +29,7 @@ func TestAccOutageSimulationCluster_SingleRegion_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configSingleRegion(projectID, clusterName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "cluster_name", clusterName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "outage_filters.#"), @@ -62,7 +62,7 @@ func TestAccOutageSimulationCluster_MultiRegion_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configMultiRegion(projectID, clusterName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "cluster_name", clusterName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "outage_filters.#"), diff --git a/internal/service/controlplaneipaddresses/data_source_test.go b/internal/service/controlplaneipaddresses/data_source_test.go index 5058af3f9f..5cd421da6c 100644 --- a/internal/service/controlplaneipaddresses/data_source_test.go +++ b/internal/service/controlplaneipaddresses/data_source_test.go @@ -15,7 +15,7 @@ func TestAccControlPlaneIpAddressesDS_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrWith(dataSourceName, "outbound.aws.us-east-1.0", acc.CIDRBlockExpression()), ), }, diff --git a/internal/service/controlplaneipaddresses/model.go b/internal/service/controlplaneipaddresses/model.go index a440f66308..a99a367c56 100644 --- a/internal/service/controlplaneipaddresses/model.go +++ b/internal/service/controlplaneipaddresses/model.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func NewTFControlPlaneIPAddresses(ctx context.Context, apiResp *admin.ControlPlaneIPAddresses) (*TFControlPlaneIpAddressesModel, diag.Diagnostics) { diff --git a/internal/service/controlplaneipaddresses/model_test.go b/internal/service/controlplaneipaddresses/model_test.go index 9d7f9b6fb3..c550719e7f 100644 --- a/internal/service/controlplaneipaddresses/model_test.go +++ b/internal/service/controlplaneipaddresses/model_test.go @@ -9,7 +9,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/service/controlplaneipaddresses" "github.com/stretchr/testify/assert" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) type sdkToTFModelTestCase struct { diff --git a/internal/service/customdbrole/data_source_custom_db_role_test.go b/internal/service/customdbrole/data_source_custom_db_role_test.go index cd6ee894b4..9fe37d7098 100644 --- a/internal/service/customdbrole/data_source_custom_db_role_test.go +++ b/internal/service/customdbrole/data_source_custom_db_role_test.go @@ -26,7 +26,7 @@ func TestAccConfigDSCustomDBRole_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configDS(orgID, projectName, roleName, "INSERT", databaseName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Test for Resource checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), diff --git a/internal/service/customdbrole/data_source_custom_db_roles.go b/internal/service/customdbrole/data_source_custom_db_roles.go index c127f071d7..a46c8f9542 100644 --- a/internal/service/customdbrole/data_source_custom_db_roles.go +++ b/internal/service/customdbrole/data_source_custom_db_roles.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func PluralDataSource() *schema.Resource { diff --git a/internal/service/customdbrole/data_source_custom_db_roles_test.go b/internal/service/customdbrole/data_source_custom_db_roles_test.go index 43f2020357..5550d7560b 100644 --- a/internal/service/customdbrole/data_source_custom_db_roles_test.go +++ b/internal/service/customdbrole/data_source_custom_db_roles_test.go @@ -26,7 +26,7 @@ func TestAccConfigDSCustomDBRoles_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configDSPlural(orgID, projectName, roleName, "INSERT", databaseName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Test for Resource checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), diff --git a/internal/service/customdbrole/resource_custom_db_role.go b/internal/service/customdbrole/resource_custom_db_role.go index 206d4de1f5..1ba4bab266 100644 --- a/internal/service/customdbrole/resource_custom_db_role.go +++ b/internal/service/customdbrole/resource_custom_db_role.go @@ -17,7 +17,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" "github.com/spf13/cast" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func Resource() *schema.Resource { diff --git a/internal/service/customdbrole/resource_custom_db_role_migration_test.go b/internal/service/customdbrole/resource_custom_db_role_migration_test.go index cc67a1058f..3adb574d31 100644 --- a/internal/service/customdbrole/resource_custom_db_role_migration_test.go +++ b/internal/service/customdbrole/resource_custom_db_role_migration_test.go @@ -25,7 +25,7 @@ func TestMigConfigCustomDBRoles_Basic(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "role_name", roleName), diff --git a/internal/service/customdbrole/resource_custom_db_role_test.go b/internal/service/customdbrole/resource_custom_db_role_test.go index 87a67c032c..af2e6282b6 100644 --- a/internal/service/customdbrole/resource_custom_db_role_test.go +++ b/internal/service/customdbrole/resource_custom_db_role_test.go @@ -32,7 +32,7 @@ func TestAccConfigRSCustomDBRoles_Basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(orgID, projectName, roleName, "INSERT", databaseName1), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "role_name", roleName), @@ -43,7 +43,7 @@ func TestAccConfigRSCustomDBRoles_Basic(t *testing.T) { }, { Config: configBasic(orgID, projectName, roleName, "UPDATE", databaseName2), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "role_name", roleName), @@ -141,7 +141,7 @@ func TestAccConfigRSCustomDBRoles_WithInheritedRoles(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithInheritedRoles(orgID, projectName, inheritRole, testRole), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // For Inherited Roles // inherited Role [0] @@ -172,7 +172,7 @@ func TestAccConfigRSCustomDBRoles_WithInheritedRoles(t *testing.T) { }, { Config: configWithInheritedRoles(orgID, projectName, inheritRoleUpdated, testRoleUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // For Inherited Role // inherited Role [0] @@ -332,7 +332,7 @@ func TestAccConfigRSCustomDBRoles_MultipleCustomRoles(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithMultiple(orgID, projectName, inheritRole, testRole), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // For Inherited Role checkExists(InheritedRoleResourceName), @@ -353,7 +353,7 @@ func TestAccConfigRSCustomDBRoles_MultipleCustomRoles(t *testing.T) { }, { Config: configWithMultiple(orgID, projectName, inheritRoleUpdated, testRoleUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // For Inherited Role checkExists(InheritedRoleResourceName), @@ -393,7 +393,7 @@ func TestAccConfigRSCustomDBRoles_MultipleResources(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(orgID, projectName, roleName, "INSERT", acc.RandomClusterName()), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "role_name", roleName), @@ -494,7 +494,7 @@ func TestAccConfigRSCustomDBRoles_UpdatedInheritRoles(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithMultiple(orgID, projectName, inheritRole, testRole), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // For Inherited Role checkExists(InheritedRoleResourceName), @@ -514,7 +514,7 @@ func TestAccConfigRSCustomDBRoles_UpdatedInheritRoles(t *testing.T) { }, { Config: configWithMultiple(orgID, projectName, inheritRoleUpdated, testRole), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // For Inherited Role checkExists(InheritedRoleResourceName), diff --git a/internal/service/customdnsconfigurationclusteraws/data_source_custom_dns_configuration_cluster_aws_test.go b/internal/service/customdnsconfigurationclusteraws/data_source_custom_dns_configuration_cluster_aws_test.go index 591d8c8811..13a265220c 100644 --- a/internal/service/customdnsconfigurationclusteraws/data_source_custom_dns_configuration_cluster_aws_test.go +++ b/internal/service/customdnsconfigurationclusteraws/data_source_custom_dns_configuration_cluster_aws_test.go @@ -21,7 +21,7 @@ func TestAccConfigDSCustomDNSConfigurationAWS_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configDS(orgID, projectName, true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(dataSourceName), resource.TestCheckResourceAttrSet(dataSourceName, "project_id"), resource.TestCheckResourceAttr(dataSourceName, "enabled", "true"), diff --git a/internal/service/customdnsconfigurationclusteraws/resource_custom_dns_configuration_cluster_aws.go b/internal/service/customdnsconfigurationclusteraws/resource_custom_dns_configuration_cluster_aws.go index ba6894ce4c..5ce4f48c4e 100644 --- a/internal/service/customdnsconfigurationclusteraws/resource_custom_dns_configuration_cluster_aws.go +++ b/internal/service/customdnsconfigurationclusteraws/resource_custom_dns_configuration_cluster_aws.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/customdnsconfigurationclusteraws/resource_custom_dns_configuration_cluster_aws_migration_test.go b/internal/service/customdnsconfigurationclusteraws/resource_custom_dns_configuration_cluster_aws_migration_test.go index 4dc6ae83df..e78b164e72 100644 --- a/internal/service/customdnsconfigurationclusteraws/resource_custom_dns_configuration_cluster_aws_migration_test.go +++ b/internal/service/customdnsconfigurationclusteraws/resource_custom_dns_configuration_cluster_aws_migration_test.go @@ -23,7 +23,7 @@ func TestMigConfigRSCustomDNSConfigurationAWS_basic(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "enabled", "true"), diff --git a/internal/service/customdnsconfigurationclusteraws/resource_custom_dns_configuration_cluster_aws_test.go b/internal/service/customdnsconfigurationclusteraws/resource_custom_dns_configuration_cluster_aws_test.go index 65580fc4cd..68a2ed2985 100644 --- a/internal/service/customdnsconfigurationclusteraws/resource_custom_dns_configuration_cluster_aws_test.go +++ b/internal/service/customdnsconfigurationclusteraws/resource_custom_dns_configuration_cluster_aws_test.go @@ -26,7 +26,7 @@ func TestAccConfigRSCustomDNSConfigurationAWS_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(orgID, projectName, true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "enabled", "true"), @@ -34,7 +34,7 @@ func TestAccConfigRSCustomDNSConfigurationAWS_basic(t *testing.T) { }, { Config: configBasic(orgID, projectName, false), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "enabled", "false"), @@ -42,7 +42,7 @@ func TestAccConfigRSCustomDNSConfigurationAWS_basic(t *testing.T) { }, { Config: configBasic(orgID, projectName, true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "enabled", "true"), diff --git a/internal/service/databaseuser/data_source_database_user_test.go b/internal/service/databaseuser/data_source_database_user_test.go index f85131c710..4504a1d48d 100644 --- a/internal/service/databaseuser/data_source_database_user_test.go +++ b/internal/service/databaseuser/data_source_database_user_test.go @@ -21,7 +21,7 @@ func TestAccConfigDSDatabaseUser_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configDS(projectID, username, roleName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(dataSourceName), resource.TestCheckResourceAttr(dataSourceName, "project_id", projectID), resource.TestCheckResourceAttr(dataSourceName, "username", username), diff --git a/internal/service/databaseuser/data_source_database_users_test.go b/internal/service/databaseuser/data_source_database_users_test.go index 4f30975910..835a6e7786 100644 --- a/internal/service/databaseuser/data_source_database_users_test.go +++ b/internal/service/databaseuser/data_source_database_users_test.go @@ -21,7 +21,7 @@ func TestAccConfigDSDatabaseUsers_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configDSPlural(projectID, username, roleName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(dataSourcePluralName, "project_id", projectID), resource.TestCheckResourceAttr(dataSourcePluralName, "results.#", "2"), resource.TestCheckResourceAttrSet(dataSourcePluralName, "results.0.username"), diff --git a/internal/service/databaseuser/model_database_user.go b/internal/service/databaseuser/model_database_user.go index d1cd75cdcc..113f31f4e5 100644 --- a/internal/service/databaseuser/model_database_user.go +++ b/internal/service/databaseuser/model_database_user.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func NewMongoDBDatabaseUser(ctx context.Context, statePasswordValue types.String, dbUserModel *TfDatabaseUserModel) (*admin.CloudDatabaseUser, diag.Diagnostics) { diff --git a/internal/service/databaseuser/model_database_user_test.go b/internal/service/databaseuser/model_database_user_test.go index 6033aeb2f1..4ba4f849cb 100644 --- a/internal/service/databaseuser/model_database_user_test.go +++ b/internal/service/databaseuser/model_database_user_test.go @@ -9,7 +9,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/service/databaseuser" "github.com/stretchr/testify/assert" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) var ( diff --git a/internal/service/databaseuser/resource_database_user_migration_test.go b/internal/service/databaseuser/resource_database_user_migration_test.go index 3d1114a0d1..081a6f8212 100644 --- a/internal/service/databaseuser/resource_database_user_migration_test.go +++ b/internal/service/databaseuser/resource_database_user_migration_test.go @@ -3,7 +3,7 @@ package databaseuser_test import ( "testing" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" @@ -24,7 +24,7 @@ func TestMigConfigRSDatabaseUser_Basic(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", username), resource.TestCheckResourceAttr(resourceName, "password", "test-acc-password"), @@ -52,7 +52,7 @@ func TestMigConfigRSDatabaseUser_withX509TypeCustomer(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "username", username), resource.TestCheckResourceAttr(resourceName, "x509_type", x509Type), @@ -77,7 +77,7 @@ func TestMigConfigRSDatabaseUser_withAWSIAMType(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", username), resource.TestCheckResourceAttr(resourceName, "aws_iam_type", "USER"), @@ -115,7 +115,7 @@ func TestMigConfigRSDatabaseUser_withLabels(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", username), @@ -142,7 +142,7 @@ func TestMigConfigRSDatabaseUser_withEmptyLabels(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", username), resource.TestCheckResourceAttr(resourceName, "password", "test-acc-password"), @@ -182,7 +182,7 @@ func TestMigConfigRSDatabaseUser_withRoles(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", username), resource.TestCheckResourceAttr(resourceName, "password", password), @@ -217,7 +217,7 @@ func TestMigConfigRSDatabaseUser_withScopes(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", username), resource.TestCheckResourceAttr(resourceName, "password", password), @@ -246,7 +246,7 @@ func TestMigConfigRSDatabaseUser_withEmptyScopes(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "username", username), resource.TestCheckResourceAttr(resourceName, "password", password), @@ -272,7 +272,7 @@ func TestMigConfigRSDatabaseUser_withLDAPAuthType(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", username), resource.TestCheckResourceAttr(resourceName, "ldap_auth_type", "USER"), diff --git a/internal/service/databaseuser/resource_database_user_test.go b/internal/service/databaseuser/resource_database_user_test.go index a4c3f7dffc..c384b94de3 100644 --- a/internal/service/databaseuser/resource_database_user_test.go +++ b/internal/service/databaseuser/resource_database_user_test.go @@ -11,7 +11,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/service/databaseuser" "github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( @@ -33,7 +33,7 @@ func TestAccConfigRSDatabaseUser_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: acc.ConfigDatabaseUserBasic(projectID, username, "atlasAdmin", "First Key", "First value"), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", username), @@ -48,7 +48,7 @@ func TestAccConfigRSDatabaseUser_basic(t *testing.T) { }, { Config: acc.ConfigDatabaseUserBasic(projectID, username, "read", "Second Key", "Second value"), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", username), @@ -86,7 +86,7 @@ func TestAccConfigRSDatabaseUser_withX509TypeCustomer(t *testing.T) { Steps: []resource.TestStep{ { Config: acc.ConfigDatabaseUserWithX509Type(projectID, username, x509Type, "atlasAdmin", "First Key", "First value"), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", username), @@ -119,7 +119,7 @@ func TestAccConfigRSDatabaseUser_withX509TypeManaged(t *testing.T) { Steps: []resource.TestStep{ { Config: acc.ConfigDatabaseUserWithX509Type(projectID, username, x509Type, "atlasAdmin", "First Key", "First value"), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", username), @@ -145,7 +145,7 @@ func TestAccConfigRSDatabaseUser_withAWSIAMType(t *testing.T) { Steps: []resource.TestStep{ { Config: acc.ConfigDatabaseUserWithAWSIAMType(projectID, username, "atlasAdmin", "First Key", "First value"), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "username", username), @@ -177,7 +177,7 @@ func TestAccConfigRSDatabaseUser_withLabels(t *testing.T) { Steps: []resource.TestStep{ { Config: acc.ConfigDatabaseUserWithLabels(projectID, username, "atlasAdmin", nil), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", username), @@ -199,7 +199,7 @@ func TestAccConfigRSDatabaseUser_withLabels(t *testing.T) { }, }, ), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", username), @@ -225,7 +225,7 @@ func TestAccConfigRSDatabaseUser_withLabels(t *testing.T) { }, }, ), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", username), @@ -265,7 +265,7 @@ func TestAccConfigRSDatabaseUser_withRoles(t *testing.T) { }, }, ), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", username), @@ -285,7 +285,7 @@ func TestAccConfigRSDatabaseUser_withRoles(t *testing.T) { }, }, ), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", username), @@ -324,7 +324,7 @@ func TestAccConfigRSDatabaseUser_withScopes(t *testing.T) { }, }, ), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", username), @@ -346,7 +346,7 @@ func TestAccConfigRSDatabaseUser_withScopes(t *testing.T) { }, }, ), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", username), @@ -387,7 +387,7 @@ func TestAccConfigRSDatabaseUser_updateToEmptyScopes(t *testing.T) { }, }, ), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", username), @@ -402,7 +402,7 @@ func TestAccConfigRSDatabaseUser_updateToEmptyScopes(t *testing.T) { }, { Config: acc.ConfigDatabaseUserWithScopes(projectID, username, password, "atlasAdmin", nil), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", username), @@ -439,7 +439,7 @@ func TestAccConfigRSDatabaseUser_updateToEmptyLabels(t *testing.T) { }, }, ), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "labels.#", "2"), @@ -451,7 +451,7 @@ func TestAccConfigRSDatabaseUser_updateToEmptyLabels(t *testing.T) { }, { Config: acc.ConfigDatabaseUserWithLabels(projectID, username, "atlasAdmin", nil), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "labels.#", "0"), ), @@ -473,7 +473,7 @@ func TestAccConfigRSDatabaseUser_withLDAPAuthType(t *testing.T) { Steps: []resource.TestStep{ { Config: acc.ConfigDatabaseUserWithLDAPAuthType(projectID, username, "atlasAdmin", "First Key", "First value"), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", username), @@ -509,7 +509,7 @@ func TestAccCOnfigRSDatabaseUser_withOIDCAuthType(t *testing.T) { Steps: []resource.TestStep{ { Config: acc.ConfigDataBaseUserWithOIDCAuthType(projectID, usernameWorkforce, workforceAuthType, "admin", "atlasAdmin"), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", usernameWorkforce), @@ -519,7 +519,7 @@ func TestAccCOnfigRSDatabaseUser_withOIDCAuthType(t *testing.T) { }, { Config: acc.ConfigDataBaseUserWithOIDCAuthType(projectID, usernameWorkload, workloadAuthType, "$external", "atlasAdmin"), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "username", usernameWorkload), diff --git a/internal/service/datalakepipeline/data_source_data_lake_pipeline_run.go b/internal/service/datalakepipeline/data_source_data_lake_pipeline_run.go index d62db2c0ad..e772c39cf6 100644 --- a/internal/service/datalakepipeline/data_source_data_lake_pipeline_run.go +++ b/internal/service/datalakepipeline/data_source_data_lake_pipeline_run.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const errorDataLakePipelineRunRead = "error reading MongoDB Atlas DataLake Run (%s): %s" diff --git a/internal/service/datalakepipeline/data_source_data_lake_pipeline_run_test.go b/internal/service/datalakepipeline/data_source_data_lake_pipeline_run_test.go index 7768399b65..a83c112cc6 100644 --- a/internal/service/datalakepipeline/data_source_data_lake_pipeline_run_test.go +++ b/internal/service/datalakepipeline/data_source_data_lake_pipeline_run_test.go @@ -25,7 +25,7 @@ func TestAccDataLakeRunDS_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configRunDS(projectID, pipelineName, runID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(dataSourceName, "project_id"), resource.TestCheckResourceAttr(dataSourceName, "pipeline_name", pipelineName), resource.TestCheckResourceAttrSet(dataSourceName, "id"), diff --git a/internal/service/datalakepipeline/data_source_data_lake_pipeline_runs.go b/internal/service/datalakepipeline/data_source_data_lake_pipeline_runs.go index 93bb7bbe68..ef548c46b9 100644 --- a/internal/service/datalakepipeline/data_source_data_lake_pipeline_runs.go +++ b/internal/service/datalakepipeline/data_source_data_lake_pipeline_runs.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const errorDataLakePipelineRunList = "error reading MongoDB Atlas DataLake Runs (%s): %s" diff --git a/internal/service/datalakepipeline/data_source_data_lake_pipeline_runs_test.go b/internal/service/datalakepipeline/data_source_data_lake_pipeline_runs_test.go index bb89cd57d0..92d5548e20 100644 --- a/internal/service/datalakepipeline/data_source_data_lake_pipeline_runs_test.go +++ b/internal/service/datalakepipeline/data_source_data_lake_pipeline_runs_test.go @@ -24,7 +24,7 @@ func TestAccDataLakeRunDSPlural_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configRunDSPlural(projectID, pipelineName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(dataSourceName, "project_id"), resource.TestCheckResourceAttr(dataSourceName, "pipeline_name", pipelineName), resource.TestCheckResourceAttrSet(dataSourceName, "results.#"), diff --git a/internal/service/datalakepipeline/data_source_data_lake_pipelines.go b/internal/service/datalakepipeline/data_source_data_lake_pipelines.go index 2dab6da217..41adab2c44 100644 --- a/internal/service/datalakepipeline/data_source_data_lake_pipelines.go +++ b/internal/service/datalakepipeline/data_source_data_lake_pipelines.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const errorDataLakePipelineList = "error creating MongoDB Atlas DataLake Pipelines: %s" diff --git a/internal/service/datalakepipeline/resource_data_lake_pipeline.go b/internal/service/datalakepipeline/resource_data_lake_pipeline.go index cb9cbdcd26..9d76b99053 100644 --- a/internal/service/datalakepipeline/resource_data_lake_pipeline.go +++ b/internal/service/datalakepipeline/resource_data_lake_pipeline.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/datalakepipeline/resource_data_lake_pipeline_migration_test.go b/internal/service/datalakepipeline/resource_data_lake_pipeline_migration_test.go index d41d1d831f..271cb8fd37 100644 --- a/internal/service/datalakepipeline/resource_data_lake_pipeline_migration_test.go +++ b/internal/service/datalakepipeline/resource_data_lake_pipeline_migration_test.go @@ -25,7 +25,7 @@ func TestMigcDataLakePipeline_basic(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", name), diff --git a/internal/service/datalakepipeline/resource_data_lake_pipeline_test.go b/internal/service/datalakepipeline/resource_data_lake_pipeline_test.go index b83a96f5f2..81f765bc70 100644 --- a/internal/service/datalakepipeline/resource_data_lake_pipeline_test.go +++ b/internal/service/datalakepipeline/resource_data_lake_pipeline_test.go @@ -31,7 +31,7 @@ func TestAccDataLakePipeline_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasicWithPluralDS(orgID, projectName, firstClusterName, secondClusterName, firstPipelineName, secondPipelineName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", firstPipelineName), diff --git a/internal/service/encryptionatrest/model_encryption_at_rest.go b/internal/service/encryptionatrest/model_encryption_at_rest.go index eeea1f927f..d52e8ada5b 100644 --- a/internal/service/encryptionatrest/model_encryption_at_rest.go +++ b/internal/service/encryptionatrest/model_encryption_at_rest.go @@ -5,7 +5,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func NewTfEncryptionAtRestRSModel(ctx context.Context, projectID string, encryptionResp *admin.EncryptionAtRest) *TfEncryptionAtRestRSModel { diff --git a/internal/service/encryptionatrest/model_encryption_at_rest_test.go b/internal/service/encryptionatrest/model_encryption_at_rest_test.go index 96ba4f4fc5..e451e85c9c 100644 --- a/internal/service/encryptionatrest/model_encryption_at_rest_test.go +++ b/internal/service/encryptionatrest/model_encryption_at_rest_test.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/mongodb/terraform-provider-mongodbatlas/internal/service/encryptionatrest" "github.com/stretchr/testify/assert" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) var ( diff --git a/internal/service/encryptionatrest/resource_encryption_at_rest.go b/internal/service/encryptionatrest/resource_encryption_at_rest.go index 55dd3a4906..8ba9b7de6b 100644 --- a/internal/service/encryptionatrest/resource_encryption_at_rest.go +++ b/internal/service/encryptionatrest/resource_encryption_at_rest.go @@ -24,7 +24,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/validate" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" "github.com/mongodb/terraform-provider-mongodbatlas/internal/service/project" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/encryptionatrest/resource_encryption_at_rest_migration_test.go b/internal/service/encryptionatrest/resource_encryption_at_rest_migration_test.go index 7fb143fbce..279738d987 100644 --- a/internal/service/encryptionatrest/resource_encryption_at_rest_migration_test.go +++ b/internal/service/encryptionatrest/resource_encryption_at_rest_migration_test.go @@ -9,7 +9,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc" "github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/mig" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func TestMigEncryptionAtRest_basicAWS(t *testing.T) { @@ -34,7 +34,7 @@ func TestMigEncryptionAtRest_basicAWS(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: testAccMongoDBAtlasEncryptionAtRestConfigAwsKms(projectID, &awsKms), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMongoDBAtlasEncryptionAtRestExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "aws_kms_config.0.enabled", "true"), @@ -86,7 +86,7 @@ func TestMigEncryptionAtRest_withRole_basicAWS(t *testing.T) { ExternalProviders: acc.ExternalProvidersOnlyAWS(), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, Config: testAccMongoDBAtlasEncryptionAtRestConfigAwsKmsWithRole(awsKms.GetRegion(), accessKeyID, secretKey, projectID, policyName, roleName, false, &awsKms), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMongoDBAtlasEncryptionAtRestExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "aws_kms_config.0.enabled", "true"), @@ -131,7 +131,7 @@ func TestMigEncryptionAtRest_basicAzure(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: testAccMongoDBAtlasEncryptionAtRestConfigAzureKeyVault(projectID, &azureKeyVault), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMongoDBAtlasEncryptionAtRestExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "azure_key_vault_config.0.enabled", "true"), @@ -175,7 +175,7 @@ func TestMigEncryptionAtRest_basicGCP(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: testAccMongoDBAtlasEncryptionAtRestConfigGoogleCloudKms(projectID, &googleCloudKms), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMongoDBAtlasEncryptionAtRestExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "google_cloud_kms_config.0.enabled", "true"), @@ -219,7 +219,7 @@ func TestMigEncryptionAtRest_basicAWS_from_v1_11_0(t *testing.T) { { ExternalProviders: acc.ExternalProvidersWithAWS("1.11.0"), Config: testAccMongoDBAtlasEncryptionAtRestConfigAwsKms(projectID, &awsKms), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMongoDBAtlasEncryptionAtRestExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "aws_kms_config.0.enabled", "true"), diff --git a/internal/service/encryptionatrest/resource_encryption_at_rest_test.go b/internal/service/encryptionatrest/resource_encryption_at_rest_test.go index 12ce988a66..d44e941a0b 100644 --- a/internal/service/encryptionatrest/resource_encryption_at_rest_test.go +++ b/internal/service/encryptionatrest/resource_encryption_at_rest_test.go @@ -16,8 +16,8 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" - "go.mongodb.org/atlas-sdk/v20231115014/admin" - "go.mongodb.org/atlas-sdk/v20231115014/mockadmin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" + "go.mongodb.org/atlas-sdk/v20240530002/mockadmin" ) const ( @@ -131,7 +131,7 @@ func TestAccEncryptionAtRest_basicAWS(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccMongoDBAtlasEncryptionAtRestConfigAwsKms(projectID, &awsKms), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMongoDBAtlasEncryptionAtRestExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "aws_kms_config.0.enabled", "true"), @@ -144,7 +144,7 @@ func TestAccEncryptionAtRest_basicAWS(t *testing.T) { }, { Config: testAccMongoDBAtlasEncryptionAtRestConfigAwsKms(projectID, &awsKmsUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMongoDBAtlasEncryptionAtRestExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "aws_kms_config.0.enabled", "true"), @@ -204,7 +204,7 @@ func TestAccEncryptionAtRest_basicAzure(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccMongoDBAtlasEncryptionAtRestConfigAzureKeyVault(projectID, &azureKeyVault), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMongoDBAtlasEncryptionAtRestExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "azure_key_vault_config.0.enabled", "true"), @@ -215,7 +215,7 @@ func TestAccEncryptionAtRest_basicAzure(t *testing.T) { }, { Config: testAccMongoDBAtlasEncryptionAtRestConfigAzureKeyVault(projectID, &azureKeyVaultUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMongoDBAtlasEncryptionAtRestExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "azure_key_vault_config.0.enabled", "true"), @@ -263,7 +263,7 @@ func TestAccEncryptionAtRest_basicGCP(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccMongoDBAtlasEncryptionAtRestConfigGoogleCloudKms(projectID, &googleCloudKms), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMongoDBAtlasEncryptionAtRestExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "google_cloud_kms_config.0.enabled", "true"), @@ -271,7 +271,7 @@ func TestAccEncryptionAtRest_basicGCP(t *testing.T) { }, { Config: testAccMongoDBAtlasEncryptionAtRestConfigGoogleCloudKms(projectID, &googleCloudKmsUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMongoDBAtlasEncryptionAtRestExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "google_cloud_kms_config.0.enabled", "true"), @@ -316,7 +316,7 @@ func TestAccEncryptionAtRestWithRole_basicAWS(t *testing.T) { }, { Config: testAccMongoDBAtlasEncryptionAtRestConfigAwsKmsWithRole(awsKms.GetRegion(), accessKeyID, secretKey, projectID, policyName, roleName, true, &awsKms), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMongoDBAtlasEncryptionAtRestExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), diff --git a/internal/service/eventtrigger/data_source_event_trigger_test.go b/internal/service/eventtrigger/data_source_event_trigger_test.go index b86bce6d50..c8a24b384d 100644 --- a/internal/service/eventtrigger/data_source_event_trigger_test.go +++ b/internal/service/eventtrigger/data_source_event_trigger_test.go @@ -42,7 +42,7 @@ func TestAccEventTriggerDS_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccMongoDBAtlasDataSourceEventTriggerConfig(projectID, appID, `"INSERT", "UPDATE"`, &event), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), ), }, diff --git a/internal/service/eventtrigger/data_source_event_triggers_test.go b/internal/service/eventtrigger/data_source_event_triggers_test.go index c5cc2e6e37..a063148583 100644 --- a/internal/service/eventtrigger/data_source_event_triggers_test.go +++ b/internal/service/eventtrigger/data_source_event_triggers_test.go @@ -43,7 +43,7 @@ func TestAccEventTriggerDSPlural_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccMongoDBAtlasEventTriggersDataSourceConfig(projectID, appID, `"INSERT", "UPDATE"`, &event), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), ), }, diff --git a/internal/service/eventtrigger/resource_event_trigger_test.go b/internal/service/eventtrigger/resource_event_trigger_test.go index 3a53331359..769d0d33b5 100644 --- a/internal/service/eventtrigger/resource_event_trigger_test.go +++ b/internal/service/eventtrigger/resource_event_trigger_test.go @@ -55,14 +55,14 @@ func TestAccEventTrigger_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configDatabaseTrigger(projectID, appID, `"INSERT", "UPDATE"`, &event, false, false), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), }, { Config: configDatabaseTrigger(projectID, appID, `"INSERT", "UPDATE", "DELETE"`, &eventUpdated, true, true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), @@ -106,7 +106,7 @@ func TestAccEventTrigger_databaseNoCollection(t *testing.T) { Steps: []resource.TestStep{ { Config: configDatabaseNoCollectionTrigger(projectID, appID, `"INSERT", "UPDATE"`, &event), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "config_database", event.Config.Database), @@ -167,14 +167,14 @@ func TestAccEventTrigger_databaseEventProccesor(t *testing.T) { Steps: []resource.TestStep{ { Config: configDatabaseEPTrigger(projectID, appID, `"INSERT", "UPDATE"`, eventBridgeAwsAccountID, eventBridgeAwsRegion, &event), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), }, { Config: configDatabaseEPTrigger(projectID, appID, `"INSERT", "UPDATE", "DELETE"`, eventBridgeAwsAccountID, eventBridgeAwsRegion, &eventUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), @@ -226,14 +226,14 @@ func TestAccEventTrigger_authBasic(t *testing.T) { Steps: []resource.TestStep{ { Config: configAuthenticationTrigger(projectID, appID, `"anon-user", "local-userpass"`, &event), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), }, { Config: configAuthenticationTrigger(projectID, appID, `"anon-user", "local-userpass", "api-key"`, &eventUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), @@ -287,14 +287,14 @@ func TestAccEventTrigger_authEventProcessor(t *testing.T) { Steps: []resource.TestStep{ { Config: configAuthenticationEPTrigger(projectID, appID, `"anon-user", "local-userpass"`, eventBridgeAwsAccountID, eventBridgeAwsRegion, &event), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), }, { Config: configAuthenticationEPTrigger(projectID, appID, `"anon-user", "local-userpass", "api-key"`, eventBridgeAwsAccountID, eventBridgeAwsRegion, &eventUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), @@ -343,14 +343,14 @@ func TestAccEventTrigger_scheduleBasic(t *testing.T) { Steps: []resource.TestStep{ { Config: configScheduleTrigger(projectID, appID, &event), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), }, { Config: configScheduleTrigger(projectID, appID, &eventUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), @@ -401,14 +401,14 @@ func TestAccEventTrigger_scheduleEventProcessor(t *testing.T) { Steps: []resource.TestStep{ { Config: configScheduleEPTrigger(projectID, appID, eventBridgeAwsAccountID, eventBridgeAwsRegion, &event), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), }, { Config: configScheduleEPTrigger(projectID, appID, eventBridgeAwsAccountID, eventBridgeAwsRegion, &eventUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), @@ -457,14 +457,14 @@ func TestAccEventTrigger_functionBasic(t *testing.T) { Steps: []resource.TestStep{ { Config: configScheduleTrigger(projectID, appID, &event), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), }, { Config: configScheduleTrigger(projectID, appID, &eventUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), diff --git a/internal/service/federateddatabaseinstance/data_source_federated_database_instance_test.go b/internal/service/federateddatabaseinstance/data_source_federated_database_instance_test.go index 42f6b174df..8a8158e399 100644 --- a/internal/service/federateddatabaseinstance/data_source_federated_database_instance_test.go +++ b/internal/service/federateddatabaseinstance/data_source_federated_database_instance_test.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func TestAccFederatedDatabaseInstanceDS_s3Bucket(t *testing.T) { @@ -34,7 +34,7 @@ func TestAccFederatedDatabaseInstanceDS_s3Bucket(t *testing.T) { ExternalProviders: acc.ExternalProvidersOnlyAWS(), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, Config: configDSWithS3Bucket(policyName, roleName, projectName, orgID, name, testS3Bucket), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName, &federatedInstance), checkAttributes(&federatedInstance, name), resource.TestCheckResourceAttrSet(resourceName, "project_id"), diff --git a/internal/service/federateddatabaseinstance/data_source_federated_database_instances.go b/internal/service/federateddatabaseinstance/data_source_federated_database_instances.go index b5c2ecefce..327ec41abe 100644 --- a/internal/service/federateddatabaseinstance/data_source_federated_database_instances.go +++ b/internal/service/federateddatabaseinstance/data_source_federated_database_instances.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" diff --git a/internal/service/federateddatabaseinstance/data_source_federated_database_instances_test.go b/internal/service/federateddatabaseinstance/data_source_federated_database_instances_test.go index 5d2d7ff9c0..982cc7febe 100644 --- a/internal/service/federateddatabaseinstance/data_source_federated_database_instances_test.go +++ b/internal/service/federateddatabaseinstance/data_source_federated_database_instances_test.go @@ -29,7 +29,7 @@ func TestAccFederatedDatabaseInstanceDSPlural_basic(t *testing.T) { ExternalProviders: acc.ExternalProvidersOnlyAWS(), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, Config: configDSPlural(policyName, roleName, projectName, orgID, firstName, secondName, testS3Bucket), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "results.#"), ), diff --git a/internal/service/federateddatabaseinstance/resource_federated_database_instance.go b/internal/service/federateddatabaseinstance/resource_federated_database_instance.go index c562882835..f637f53a24 100644 --- a/internal/service/federateddatabaseinstance/resource_federated_database_instance.go +++ b/internal/service/federateddatabaseinstance/resource_federated_database_instance.go @@ -7,7 +7,7 @@ import ( "net/http" "strings" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -714,7 +714,9 @@ func newUrls(urlsFromConfig []any) *[]string { func newCloudProviderConfig(d *schema.ResourceData) *admin.DataLakeCloudProviderConfig { if cloudProvider, ok := d.Get("cloud_provider_config").([]any); ok && len(cloudProvider) == 1 { - return admin.NewDataLakeCloudProviderConfig(*newAWSConfig(cloudProvider)) + cloudProviderConfig := admin.DataLakeCloudProviderConfig{} + cloudProviderConfig.Aws = newAWSConfig(cloudProvider) + return &cloudProviderConfig } return nil diff --git a/internal/service/federateddatabaseinstance/resource_federated_database_instance_migration_test.go b/internal/service/federateddatabaseinstance/resource_federated_database_instance_migration_test.go index 6c8016bf09..ead5ad5561 100644 --- a/internal/service/federateddatabaseinstance/resource_federated_database_instance_migration_test.go +++ b/internal/service/federateddatabaseinstance/resource_federated_database_instance_migration_test.go @@ -25,7 +25,7 @@ func TestMigFederatedDatabaseInstance_basic(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: configFirstSteps(name, projectName, orgID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", name), resource.TestCheckResourceAttrSet(resourceName, "storage_stores.0.read_preference.0.tag_sets.#"), diff --git a/internal/service/federateddatabaseinstance/resource_federated_database_instance_test.go b/internal/service/federateddatabaseinstance/resource_federated_database_instance_test.go index 5183b7dd17..7c95aa741b 100644 --- a/internal/service/federateddatabaseinstance/resource_federated_database_instance_test.go +++ b/internal/service/federateddatabaseinstance/resource_federated_database_instance_test.go @@ -42,11 +42,11 @@ func TestAccFederatedDatabaseInstance_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configFirstSteps(name, projectName, orgID), - Check: resource.ComposeTestCheckFunc(firstStepChecks...), + Check: resource.ComposeAggregateTestCheckFunc(firstStepChecks...), }, { Config: configFirstStepsUpdate(name, projectName, orgID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", name), resource.TestCheckResourceAttrSet(resourceName, "storage_stores.0.read_preference.0.tag_sets.#"), @@ -95,7 +95,7 @@ func TestAccFederatedDatabaseInstance_s3bucket(t *testing.T) { ExternalProviders: acc.ExternalProvidersOnlyAWS(), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, Config: configWithS3Bucket(policyName, roleName, projectName, orgID, name, testS3Bucket), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", name), ), @@ -128,7 +128,7 @@ func TestAccFederatedDatabaseInstance_atlasCluster(t *testing.T) { { ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, Config: configWithCluster(orgID, projectName, clusterName1, clusterName2, name), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "name", name), resource.TestCheckResourceAttrSet(resourceName, "storage_stores.0.read_preference.0.tag_sets.#"), diff --git a/internal/service/federatedquerylimit/data_source_federated_query_limits.go b/internal/service/federatedquerylimit/data_source_federated_query_limits.go index b69044e2df..20b8257250 100644 --- a/internal/service/federatedquerylimit/data_source_federated_query_limits.go +++ b/internal/service/federatedquerylimit/data_source_federated_query_limits.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func PluralDataSource() *schema.Resource { diff --git a/internal/service/federatedquerylimit/resource_federated_query_limit.go b/internal/service/federatedquerylimit/resource_federated_query_limit.go index 7b6694d515..58ceb1f7d5 100644 --- a/internal/service/federatedquerylimit/resource_federated_query_limit.go +++ b/internal/service/federatedquerylimit/resource_federated_query_limit.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/federatedquerylimit/resource_federated_query_limit_test.go b/internal/service/federatedquerylimit/resource_federated_query_limit_test.go index 847476a94e..786ce2a083 100644 --- a/internal/service/federatedquerylimit/resource_federated_query_limit_test.go +++ b/internal/service/federatedquerylimit/resource_federated_query_limit_test.go @@ -44,7 +44,7 @@ func basicTestCase(tb testing.TB) *resource.TestCase { ExternalProviders: acc.ExternalProvidersOnlyAWS(), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, Config: configBasic(policyName, roleName, projectName, orgID, tenantName, testS3Bucket), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "tenant_name"), resource.TestCheckResourceAttr(resourceName, "limit_name", limitName), diff --git a/internal/service/federatedsettingsidentityprovider/data_source_federated_settings_identity_provider_test.go b/internal/service/federatedsettingsidentityprovider/data_source_federated_settings_identity_provider_test.go index 5054e6ca49..b881efc52f 100644 --- a/internal/service/federatedsettingsidentityprovider/data_source_federated_settings_identity_provider_test.go +++ b/internal/service/federatedsettingsidentityprovider/data_source_federated_settings_identity_provider_test.go @@ -21,7 +21,7 @@ func TestAccFederatedSettingsIdentityProviderDS_samlBasic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasicDS(federatedSettingsID, idpID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "federation_settings_id"), resource.TestCheckResourceAttrSet(resourceName, "associated_orgs.#"), resource.TestCheckResourceAttrSet(resourceName, "acs_url"), diff --git a/internal/service/federatedsettingsidentityprovider/data_source_federated_settings_identity_providers.go b/internal/service/federatedsettingsidentityprovider/data_source_federated_settings_identity_providers.go index 4b2a598929..73645c947a 100644 --- a/internal/service/federatedsettingsidentityprovider/data_source_federated_settings_identity_providers.go +++ b/internal/service/federatedsettingsidentityprovider/data_source_federated_settings_identity_providers.go @@ -5,7 +5,7 @@ import ( "errors" "fmt" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" diff --git a/internal/service/federatedsettingsidentityprovider/data_source_federated_settings_identity_providers_test.go b/internal/service/federatedsettingsidentityprovider/data_source_federated_settings_identity_providers_test.go index 073011305f..65fdfa7a5c 100644 --- a/internal/service/federatedsettingsidentityprovider/data_source_federated_settings_identity_providers_test.go +++ b/internal/service/federatedsettingsidentityprovider/data_source_federated_settings_identity_providers_test.go @@ -23,14 +23,14 @@ func TestAccFederatedSettingsIdentityProvidersDS_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configPluralDS(federatedSettingsID, conversion.StringPtr(federatedsettingsidentityprovider.WORKFORCE), []string{oidcProtocol, samlProtocol}), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(dataSourceName, "federation_settings_id"), resource.TestCheckResourceAttr(dataSourceName, "results.#", "2"), ), }, { Config: configPluralDS(federatedSettingsID, conversion.StringPtr(federatedsettingsidentityprovider.WORKFORCE), []string{samlProtocol}), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(dataSourceName, "federation_settings_id"), resource.TestCheckResourceAttr(dataSourceName, "results.#", "1"), resource.TestCheckResourceAttr(dataSourceName, "results.0.display_name", "SAML-test"), @@ -38,7 +38,7 @@ func TestAccFederatedSettingsIdentityProvidersDS_basic(t *testing.T) { }, { Config: configPluralDS(federatedSettingsID, conversion.StringPtr(federatedsettingsidentityprovider.WORKFORCE), []string{oidcProtocol}), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(dataSourceName, "federation_settings_id"), resource.TestCheckResourceAttr(dataSourceName, "results.#", "1"), resource.TestCheckResourceAttr(dataSourceName, "results.0.display_name", "OIDC-test"), @@ -46,7 +46,7 @@ func TestAccFederatedSettingsIdentityProvidersDS_basic(t *testing.T) { }, { Config: configPluralDS(federatedSettingsID, conversion.StringPtr(federatedsettingsidentityprovider.WORKFORCE), []string{}), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(dataSourceName, "federation_settings_id"), resource.TestCheckResourceAttr(dataSourceName, "results.#", "1"), resource.TestCheckResourceAttr(dataSourceName, "results.0.display_name", "SAML-test"), // if no protocol is specified, it defaults to SAML @@ -54,7 +54,7 @@ func TestAccFederatedSettingsIdentityProvidersDS_basic(t *testing.T) { }, { Config: configPluralDS(federatedSettingsID, conversion.StringPtr(federatedsettingsidentityprovider.WORKLOAD), []string{}), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(dataSourceName, "federation_settings_id"), resource.TestCheckResourceAttr(dataSourceName, "results.#", "0"), ), diff --git a/internal/service/federatedsettingsidentityprovider/model_federated_settings_identity_provider.go b/internal/service/federatedsettingsidentityprovider/model_federated_settings_identity_provider.go index 0292f0fd3b..dfddcbcec5 100644 --- a/internal/service/federatedsettingsidentityprovider/model_federated_settings_identity_provider.go +++ b/internal/service/federatedsettingsidentityprovider/model_federated_settings_identity_provider.go @@ -4,7 +4,7 @@ import ( "sort" "strings" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" diff --git a/internal/service/federatedsettingsidentityprovider/model_federated_settings_identity_provider_test.go b/internal/service/federatedsettingsidentityprovider/model_federated_settings_identity_provider_test.go index cc79469ee5..a4a8f9b261 100644 --- a/internal/service/federatedsettingsidentityprovider/model_federated_settings_identity_provider_test.go +++ b/internal/service/federatedsettingsidentityprovider/model_federated_settings_identity_provider_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/stretchr/testify/assert" diff --git a/internal/service/federatedsettingsidentityprovider/resource_federated_settings_identity_provider_test.go b/internal/service/federatedsettingsidentityprovider/resource_federated_settings_identity_provider_test.go index 280dd433b6..4b7b5e4647 100644 --- a/internal/service/federatedsettingsidentityprovider/resource_federated_settings_identity_provider_test.go +++ b/internal/service/federatedsettingsidentityprovider/resource_federated_settings_identity_provider_test.go @@ -73,7 +73,7 @@ func basicSAMLTestCase(tb testing.TB) *resource.TestCase { }, { Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName, idpID), resource.TestCheckResourceAttr(resourceName, "federation_settings_id", federationSettingsID), resource.TestCheckResourceAttr(resourceName, "name", "SAML-test"), @@ -125,11 +125,11 @@ func basicOIDCWorkforceTestCase(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configOIDCWorkforceBasic(federationSettingsID, associatedDomain, description1, audience1), - Check: resource.ComposeTestCheckFunc(checks...), + Check: resource.ComposeAggregateTestCheckFunc(checks...), }, { Config: configOIDCWorkforceBasic(federationSettingsID, associatedDomain, description2, audience2), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsManaged(resourceName), resource.TestCheckResourceAttr(resourceName, "description", description2), resource.TestCheckResourceAttr(resourceName, "audience", audience2), diff --git a/internal/service/federatedsettingsorgconfig/data_source_federated_settings.go b/internal/service/federatedsettingsorgconfig/data_source_federated_settings.go index 91c8469cd6..62d6ce0ba4 100644 --- a/internal/service/federatedsettingsorgconfig/data_source_federated_settings.go +++ b/internal/service/federatedsettingsorgconfig/data_source_federated_settings.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func DataSourceSettings() *schema.Resource { diff --git a/internal/service/federatedsettingsorgconfig/data_source_federated_settings_connected_org_test.go b/internal/service/federatedsettingsorgconfig/data_source_federated_settings_connected_org_test.go index 2a185d2f5d..2af1a50f89 100644 --- a/internal/service/federatedsettingsorgconfig/data_source_federated_settings_connected_org_test.go +++ b/internal/service/federatedsettingsorgconfig/data_source_federated_settings_connected_org_test.go @@ -22,7 +22,7 @@ func TestAccFederatedSettingsOrgDS_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasicDS(federatedSettingsID, orgID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "federation_settings_id"), resource.TestCheckResourceAttrSet(resourceName, "role_mappings.#"), resource.TestCheckResourceAttrSet(resourceName, "data_access_identity_provider_ids.#"), diff --git a/internal/service/federatedsettingsorgconfig/data_source_federated_settings_connected_orgs.go b/internal/service/federatedsettingsorgconfig/data_source_federated_settings_connected_orgs.go index 695ec0c88e..d9a948215f 100644 --- a/internal/service/federatedsettingsorgconfig/data_source_federated_settings_connected_orgs.go +++ b/internal/service/federatedsettingsorgconfig/data_source_federated_settings_connected_orgs.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func PluralDataSource() *schema.Resource { diff --git a/internal/service/federatedsettingsorgconfig/data_source_federated_settings_connected_orgs_test.go b/internal/service/federatedsettingsorgconfig/data_source_federated_settings_connected_orgs_test.go index 306d1fb029..c33691f4ea 100644 --- a/internal/service/federatedsettingsorgconfig/data_source_federated_settings_connected_orgs_test.go +++ b/internal/service/federatedsettingsorgconfig/data_source_federated_settings_connected_orgs_test.go @@ -21,7 +21,7 @@ func TestAccFederatedSettingsOrgDSPlural_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasicPluralDS(federatedSettingsID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "federation_settings_id"), resource.TestCheckResourceAttrSet(resourceName, "results.#"), resource.TestCheckResourceAttrSet(resourceName, "results.0.identity_provider_id"), diff --git a/internal/service/federatedsettingsorgconfig/data_source_federated_settings_test.go b/internal/service/federatedsettingsorgconfig/data_source_federated_settings_test.go index 4ba6a3fdd5..c03072e955 100644 --- a/internal/service/federatedsettingsorgconfig/data_source_federated_settings_test.go +++ b/internal/service/federatedsettingsorgconfig/data_source_federated_settings_test.go @@ -25,7 +25,7 @@ func TestAccFederatedSettingsDS_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccMongoDBAtlasDataSourceFederatedSettingsConfig(orgID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMongoDBAtlasFederatedSettingsExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "org_id"), diff --git a/internal/service/federatedsettingsorgconfig/model_federated_settings_connected_orgs.go b/internal/service/federatedsettingsorgconfig/model_federated_settings_connected_orgs.go index f414c3d829..fdc06ffc07 100644 --- a/internal/service/federatedsettingsorgconfig/model_federated_settings_connected_orgs.go +++ b/internal/service/federatedsettingsorgconfig/model_federated_settings_connected_orgs.go @@ -4,7 +4,7 @@ import ( "sort" "strings" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) type roleMappingsByGroupName []admin.AuthFederationRoleMapping diff --git a/internal/service/federatedsettingsorgconfig/resource_federated_settings_connected_org_test.go b/internal/service/federatedsettingsorgconfig/resource_federated_settings_connected_org_test.go index 62646ab537..94542639b3 100644 --- a/internal/service/federatedsettingsorgconfig/resource_federated_settings_connected_org_test.go +++ b/internal/service/federatedsettingsorgconfig/resource_federated_settings_connected_org_test.go @@ -60,7 +60,7 @@ func basicTestCase(tb testing.TB) *resource.TestCase { }, { Config: configWithIdps, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "federation_settings_id", federationSettingsID), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), @@ -72,7 +72,7 @@ func basicTestCase(tb testing.TB) *resource.TestCase { }, { Config: configDetachedIdps, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "data_access_identity_provider_ids.#", "0"), resource.TestCheckResourceAttr(resourceName, "identity_provider_id", ""), @@ -80,7 +80,7 @@ func basicTestCase(tb testing.TB) *resource.TestCase { }, { Config: configWithDomainRestriction, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "domain_restriction_enabled", "true"), resource.TestCheckResourceAttrSet(resourceName, "user_conflicts.#"), diff --git a/internal/service/federatedsettingsorgrolemapping/data_source_federated_settings_org_role_mappings.go b/internal/service/federatedsettingsorgrolemapping/data_source_federated_settings_org_role_mappings.go index 51d02623ea..f8371255ff 100644 --- a/internal/service/federatedsettingsorgrolemapping/data_source_federated_settings_org_role_mappings.go +++ b/internal/service/federatedsettingsorgrolemapping/data_source_federated_settings_org_role_mappings.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/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func PluralDataSource() *schema.Resource { diff --git a/internal/service/federatedsettingsorgrolemapping/model_federated_settings_org_role_mapping.go b/internal/service/federatedsettingsorgrolemapping/model_federated_settings_org_role_mapping.go index d010b3b1b1..bd411c53fd 100644 --- a/internal/service/federatedsettingsorgrolemapping/model_federated_settings_org_role_mapping.go +++ b/internal/service/federatedsettingsorgrolemapping/model_federated_settings_org_role_mapping.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) type mRoleAssignment []admin.RoleAssignment diff --git a/internal/service/federatedsettingsorgrolemapping/resource_federated_settings_org_role_mapping.go b/internal/service/federatedsettingsorgrolemapping/resource_federated_settings_org_role_mapping.go index ec8df70c60..f9e9df91bd 100644 --- a/internal/service/federatedsettingsorgrolemapping/resource_federated_settings_org_role_mapping.go +++ b/internal/service/federatedsettingsorgrolemapping/resource_federated_settings_org_role_mapping.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func Resource() *schema.Resource { diff --git a/internal/service/federatedsettingsorgrolemapping/resource_federated_settings_org_role_mapping_test.go b/internal/service/federatedsettingsorgrolemapping/resource_federated_settings_org_role_mapping_test.go index 08d27c6540..6987f88630 100644 --- a/internal/service/federatedsettingsorgrolemapping/resource_federated_settings_org_role_mapping_test.go +++ b/internal/service/federatedsettingsorgrolemapping/resource_federated_settings_org_role_mapping_test.go @@ -52,11 +52,11 @@ func basicTestCase(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configBasic(federationSettingsID, orgID, groupID, extGroupName1), - Check: resource.ComposeTestCheckFunc(checks...), + Check: resource.ComposeAggregateTestCheckFunc(checks...), }, { Config: configBasic(federationSettingsID, orgID, groupID, extGroupName2), - Check: resource.ComposeTestCheckFunc(resource.TestCheckResourceAttr(resourceName, "external_group_name", extGroupName2)), + Check: resource.ComposeAggregateTestCheckFunc(resource.TestCheckResourceAttr(resourceName, "external_group_name", extGroupName2)), }, { Config: configBasic(federationSettingsID, orgID, groupID, extGroupName2), diff --git a/internal/service/globalclusterconfig/data_source_global_cluster_config_test.go b/internal/service/globalclusterconfig/data_source_global_cluster_config_test.go index 23e036a9aa..fb50184c0f 100644 --- a/internal/service/globalclusterconfig/data_source_global_cluster_config_test.go +++ b/internal/service/globalclusterconfig/data_source_global_cluster_config_test.go @@ -19,7 +19,7 @@ func TestAccClusterRSGlobalClusterDS_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(&clusterInfo, false, false), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(dataSourceName, "project_id"), resource.TestCheckResourceAttrSet(dataSourceName, "cluster_name"), ), diff --git a/internal/service/globalclusterconfig/resource_global_cluster_config.go b/internal/service/globalclusterconfig/resource_global_cluster_config.go index db158960ab..edcbd33111 100644 --- a/internal/service/globalclusterconfig/resource_global_cluster_config.go +++ b/internal/service/globalclusterconfig/resource_global_cluster_config.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/globalclusterconfig/resource_global_cluster_config_migration_test.go b/internal/service/globalclusterconfig/resource_global_cluster_config_migration_test.go index 070a57c10b..c70697344c 100644 --- a/internal/service/globalclusterconfig/resource_global_cluster_config_migration_test.go +++ b/internal/service/globalclusterconfig/resource_global_cluster_config_migration_test.go @@ -21,7 +21,7 @@ func TestMigClusterRSGlobalCluster_basic(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "custom_zone_mappings.#"), resource.TestCheckResourceAttrSet(resourceName, "custom_zone_mapping.%"), diff --git a/internal/service/globalclusterconfig/resource_global_cluster_config_test.go b/internal/service/globalclusterconfig/resource_global_cluster_config_test.go index 73f45a4c48..342a354f21 100644 --- a/internal/service/globalclusterconfig/resource_global_cluster_config_test.go +++ b/internal/service/globalclusterconfig/resource_global_cluster_config_test.go @@ -25,7 +25,7 @@ func TestAccClusterRSGlobalCluster_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(&clusterInfo, false, false), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "custom_zone_mappings.#"), resource.TestCheckResourceAttrSet(resourceName, "custom_zone_mapping.%"), @@ -57,7 +57,7 @@ func TestAccClusterRSGlobalCluster_withAWSAndBackup(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(&clusterInfo, false, false), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "managed_namespaces.#", "1"), resource.TestCheckResourceAttrSet(resourceName, "custom_zone_mappings.#"), @@ -90,7 +90,7 @@ func TestAccClusterRSGlobalCluster_database(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithDBConfig(&clusterInfo, customZone), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "managed_namespaces.#", "5"), resource.TestCheckResourceAttrSet(resourceName, "custom_zone_mappings.#"), diff --git a/internal/service/ldapconfiguration/resource_ldap_configuration.go b/internal/service/ldapconfiguration/resource_ldap_configuration.go index cc98a943ba..a64c54b400 100644 --- a/internal/service/ldapconfiguration/resource_ldap_configuration.go +++ b/internal/service/ldapconfiguration/resource_ldap_configuration.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/ldapconfiguration/resource_ldap_configuration_test.go b/internal/service/ldapconfiguration/resource_ldap_configuration_test.go index 35120ebf3d..7db034a5dd 100644 --- a/internal/service/ldapconfiguration/resource_ldap_configuration_test.go +++ b/internal/service/ldapconfiguration/resource_ldap_configuration_test.go @@ -40,7 +40,7 @@ func TestAccLDAPConfiguration_withVerify_CACertificateComplete(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithVerify(projectID, clusterName, hostname, username, password, caCertificate, cast.ToInt(port), true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "hostname", hostname), @@ -83,7 +83,7 @@ func basicTestCase(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configBasic(projectID, hostname, username, password, authEnabled, cast.ToInt(port)), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "hostname", hostname), diff --git a/internal/service/ldapverify/resource_ldap_verify.go b/internal/service/ldapverify/resource_ldap_verify.go index ecd1f5a61a..a8ad9cf9a1 100644 --- a/internal/service/ldapverify/resource_ldap_verify.go +++ b/internal/service/ldapverify/resource_ldap_verify.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/ldapverify/resource_ldap_verify_test.go b/internal/service/ldapverify/resource_ldap_verify_test.go index df5c5a03fb..cc285978aa 100644 --- a/internal/service/ldapverify/resource_ldap_verify_test.go +++ b/internal/service/ldapverify/resource_ldap_verify_test.go @@ -38,7 +38,7 @@ func TestAccLDAPVerify_withConfiguration_CACertificate(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithConfiguration(projectID, hostname, username, password, caCertificate, cast.ToInt(port), true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "request_id"), @@ -74,7 +74,7 @@ func basicTestCase(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configBasic(projectID, hostname, username, password, cast.ToInt(port)), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "request_id"), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), diff --git a/internal/service/maintenancewindow/data_source_maintenance_window_test.go b/internal/service/maintenancewindow/data_source_maintenance_window_test.go index 7188cfcc05..6d44f7377d 100644 --- a/internal/service/maintenancewindow/data_source_maintenance_window_test.go +++ b/internal/service/maintenancewindow/data_source_maintenance_window_test.go @@ -26,7 +26,7 @@ func TestAccConfigDSMaintenanceWindow_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configDS(orgID, projectName, dayOfWeek, hourOfDay), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(dataSourceName), resource.TestCheckResourceAttrSet(dataSourceName, "project_id"), resource.TestCheckResourceAttr(dataSourceName, "day_of_week", cast.ToString(dayOfWeek)), diff --git a/internal/service/maintenancewindow/resource_maintenance_window.go b/internal/service/maintenancewindow/resource_maintenance_window.go index 49cba64608..85ff7891b6 100644 --- a/internal/service/maintenancewindow/resource_maintenance_window.go +++ b/internal/service/maintenancewindow/resource_maintenance_window.go @@ -10,7 +10,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" "github.com/spf13/cast" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/maintenancewindow/resource_maintenance_window_migration_test.go b/internal/service/maintenancewindow/resource_maintenance_window_migration_test.go index f7a1b6021f..d5da2376fc 100644 --- a/internal/service/maintenancewindow/resource_maintenance_window_migration_test.go +++ b/internal/service/maintenancewindow/resource_maintenance_window_migration_test.go @@ -25,7 +25,7 @@ func TestMigConfigMaintenanceWindow_basic(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "day_of_week", cast.ToString(dayOfWeek)), diff --git a/internal/service/maintenancewindow/resource_maintenance_window_test.go b/internal/service/maintenancewindow/resource_maintenance_window_test.go index ac2ca659a3..86e090f91a 100644 --- a/internal/service/maintenancewindow/resource_maintenance_window_test.go +++ b/internal/service/maintenancewindow/resource_maintenance_window_test.go @@ -31,7 +31,7 @@ func TestAccConfigRSMaintenanceWindow_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(orgID, projectName, dayOfWeek, hourOfDay), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "day_of_week", cast.ToString(dayOfWeek)), @@ -41,7 +41,7 @@ func TestAccConfigRSMaintenanceWindow_basic(t *testing.T) { }, { Config: configBasic(orgID, projectName, dayOfWeek, hourOfDayUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "day_of_week", cast.ToString(dayOfWeek)), @@ -51,7 +51,7 @@ func TestAccConfigRSMaintenanceWindow_basic(t *testing.T) { }, { Config: configBasic(orgID, projectName, dayOfWeekUpdated, hourOfDay), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "day_of_week", cast.ToString(dayOfWeekUpdated)), @@ -61,7 +61,7 @@ func TestAccConfigRSMaintenanceWindow_basic(t *testing.T) { }, { Config: configBasic(orgID, projectName, dayOfWeek, hourOfDay), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "day_of_week", cast.ToString(dayOfWeek)), @@ -93,7 +93,7 @@ func TestAccConfigRSMaintenanceWindow_autoDeferActivated(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithAutoDeferEnabled(orgID, projectName, dayOfWeek, hourOfDay), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "day_of_week", cast.ToString(dayOfWeek)), diff --git a/internal/service/networkcontainer/data_source_network_containers.go b/internal/service/networkcontainer/data_source_network_containers.go index dc6ccd4a25..871928b474 100644 --- a/internal/service/networkcontainer/data_source_network_containers.go +++ b/internal/service/networkcontainer/data_source_network_containers.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func PluralDataSource() *schema.Resource { diff --git a/internal/service/networkcontainer/resource_network_container.go b/internal/service/networkcontainer/resource_network_container.go index f8ae639d47..b185391b36 100644 --- a/internal/service/networkcontainer/resource_network_container.go +++ b/internal/service/networkcontainer/resource_network_container.go @@ -17,7 +17,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" "github.com/spf13/cast" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/networkcontainer/resource_network_container_migration_test.go b/internal/service/networkcontainer/resource_network_container_migration_test.go index 0258e4e67a..3995d8e934 100644 --- a/internal/service/networkcontainer/resource_network_container_migration_test.go +++ b/internal/service/networkcontainer/resource_network_container_migration_test.go @@ -27,7 +27,7 @@ func TestMigNetworkContainer_basicAWS(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc(commonChecks(constant.AWS)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks(constant.AWS)...), }, mig.TestStepCheckEmptyPlan(config), }, @@ -50,7 +50,7 @@ func TestMigNetworkContainer_basicAzure(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc(commonChecks(constant.AZURE)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks(constant.AZURE)...), }, mig.TestStepCheckEmptyPlan(config), }, @@ -73,7 +73,7 @@ func TestMigNetworkContainer_basicGCP(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc(commonChecks(constant.GCP)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks(constant.GCP)...), }, mig.TestStepCheckEmptyPlan(config), }, diff --git a/internal/service/networkcontainer/resource_network_container_test.go b/internal/service/networkcontainer/resource_network_container_test.go index 11dc869fd1..6d41197a30 100644 --- a/internal/service/networkcontainer/resource_network_container_test.go +++ b/internal/service/networkcontainer/resource_network_container_test.go @@ -35,11 +35,11 @@ func TestAccNetworkContainer_basicAWS(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(projectID, cidrBlock, constant.AWS, "US_EAST_1"), - Check: resource.ComposeTestCheckFunc(commonChecks(constant.AWS)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks(constant.AWS)...), }, { Config: configBasic(projectID, cidrBlockUpdated, constant.AWS, "US_EAST_2"), - Check: resource.ComposeTestCheckFunc(commonChecks(constant.AWS)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks(constant.AWS)...), }, { ResourceName: resourceName, @@ -68,11 +68,11 @@ func TestAccNetworkContainer_basicAzure(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(projectID, cidrBlock, constant.AZURE, "US_EAST_2"), - Check: resource.ComposeTestCheckFunc(commonChecks(constant.AZURE)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks(constant.AZURE)...), }, { Config: configBasic(projectID, cidrBlockUpdated, constant.AZURE, "US_EAST_2"), - Check: resource.ComposeTestCheckFunc(commonChecks(constant.AZURE)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks(constant.AZURE)...), }, }, }) @@ -94,11 +94,11 @@ func TestAccNetworkContainer_basicGCP(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(projectID, gcpCidrBlock, constant.GCP, ""), - Check: resource.ComposeTestCheckFunc(commonChecks(constant.GCP)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks(constant.GCP)...), }, { Config: configBasic(projectID, cidrBlockUpdated, constant.GCP, ""), - Check: resource.ComposeTestCheckFunc(commonChecks(constant.GCP)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks(constant.GCP)...), }, }, }) @@ -119,7 +119,7 @@ func TestAccNetworkContainer_withRegionsGCP(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(projectID, gcpWithRegionsCidrBlock, constant.GCP, regions), - Check: resource.ComposeTestCheckFunc(commonChecks(constant.GCP)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks(constant.GCP)...), }, }, }) @@ -144,15 +144,15 @@ func TestAccNetworkContainer_updateIndividualFields(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(projectID, cidrBlock, constant.AWS, region), - Check: resource.ComposeTestCheckFunc(commonChecks(constant.AWS)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks(constant.AWS)...), }, { Config: configBasic(projectID, cidrBlockUpdated, constant.AWS, region), - Check: resource.ComposeTestCheckFunc(commonChecks(constant.AWS)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks(constant.AWS)...), }, { Config: configBasic(projectID, cidrBlockUpdated, constant.AWS, regionUpdated), - Check: resource.ComposeTestCheckFunc(commonChecks(constant.AWS)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks(constant.AWS)...), }, }, }) diff --git a/internal/service/networkpeering/data_source_network_peering.go b/internal/service/networkpeering/data_source_network_peering.go index f020874fb2..74ac732407 100644 --- a/internal/service/networkpeering/data_source_network_peering.go +++ b/internal/service/networkpeering/data_source_network_peering.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func DataSource() *schema.Resource { diff --git a/internal/service/networkpeering/data_source_network_peerings.go b/internal/service/networkpeering/data_source_network_peerings.go index 1d722399df..3dc1967aa0 100644 --- a/internal/service/networkpeering/data_source_network_peerings.go +++ b/internal/service/networkpeering/data_source_network_peerings.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func PluralDataSource() *schema.Resource { diff --git a/internal/service/networkpeering/resource_network_peering.go b/internal/service/networkpeering/resource_network_peering.go index f00fd13b89..1058774dd2 100644 --- a/internal/service/networkpeering/resource_network_peering.go +++ b/internal/service/networkpeering/resource_network_peering.go @@ -16,7 +16,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" "github.com/mongodb/terraform-provider-mongodbatlas/internal/service/networkcontainer" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/networkpeering/resource_network_peering_test.go b/internal/service/networkpeering/resource_network_peering_test.go index c4e50a456d..e530d4fa20 100644 --- a/internal/service/networkpeering/resource_network_peering_test.go +++ b/internal/service/networkpeering/resource_network_peering_test.go @@ -25,44 +25,7 @@ func TestAccNetworkNetworkPeering_basicAWS(t *testing.T) { resource.ParallelTest(t, *basicAWSTestCase(t)) } -func TestAccNetworkRSNetworkPeering_basicAzure(t *testing.T) { - var ( - projectID = acc.ProjectIDExecution(t) - directoryID = os.Getenv("AZURE_DIRECTORY_ID") - subscriptionID = os.Getenv("AZURE_SUBSCRIPTION_ID") - resourceGroupName = os.Getenv("AZURE_RESOURCE_GROUP_NAME") - vNetName = os.Getenv("AZURE_VNET_NAME") - providerName = "AZURE" - ) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t); acc.PreCheckPeeringEnvAzure(t) }, - ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, - CheckDestroy: acc.CheckDestroyNetworkPeering, - Steps: []resource.TestStep{ - { - Config: configAzure(projectID, providerName, directoryID, subscriptionID, resourceGroupName, vNetName), - Check: resource.ComposeTestCheckFunc( - checkExists(resourceName), - resource.TestCheckResourceAttrSet(resourceName, "project_id"), - resource.TestCheckResourceAttrSet(resourceName, "container_id"), - resource.TestCheckResourceAttr(resourceName, "provider_name", providerName), - resource.TestCheckResourceAttr(resourceName, "vnet_name", vNetName), - resource.TestCheckResourceAttr(resourceName, "azure_directory_id", directoryID), - ), - }, - { - ResourceName: resourceName, - ImportStateIdFunc: importStateIDFunc(resourceName), - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"container_id"}, - }, - }, - }) -} - -func TestAccNetworkRSNetworkPeering_updateBasicAzure(t *testing.T) { +func TestAccNetworkRSNetworkPeering_Azure(t *testing.T) { var ( projectID = acc.ProjectIDExecution(t) directoryID = os.Getenv("AZURE_DIRECTORY_ID") @@ -73,14 +36,14 @@ func TestAccNetworkRSNetworkPeering_updateBasicAzure(t *testing.T) { providerName = "AZURE" ) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acc.PreCheckBasic(t); acc.PreCheckPeeringEnvAzure(t) }, ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyNetworkPeering, Steps: []resource.TestStep{ { Config: configAzure(projectID, providerName, directoryID, subscriptionID, resourceGroupName, vNetName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "container_id"), @@ -91,7 +54,7 @@ func TestAccNetworkRSNetworkPeering_updateBasicAzure(t *testing.T) { }, { Config: configAzure(projectID, providerName, directoryID, subscriptionID, resourceGroupName, updatedvNetName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "container_id"), @@ -100,52 +63,18 @@ func TestAccNetworkRSNetworkPeering_updateBasicAzure(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "azure_directory_id", directoryID), ), }, - }, - }) -} - -func TestAccNetworkRSNetworkPeering_basicGCP(t *testing.T) { - acc.SkipTestForCI(t) // needs GCP configuration - - var ( - projectID = os.Getenv("MONGODB_ATLAS_PROJECT_ID") - providerName = "GCP" - gcpProjectID = os.Getenv("GCP_PROJECT_ID") - networkName = acc.RandomName() - ) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.PreCheck(t); acc.PreCheckPeeringEnvGCP(t) }, - ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, - CheckDestroy: acc.CheckDestroyNetworkPeering, - Steps: []resource.TestStep{ - { - Config: configGCP(projectID, providerName, gcpProjectID, networkName), - Check: resource.ComposeTestCheckFunc( - checkExists(resourceName), - resource.TestCheckResourceAttrSet(resourceName, "project_id"), - resource.TestCheckResourceAttrSet(resourceName, "container_id"), - - resource.TestCheckResourceAttr(resourceName, "provider_name", providerName), - resource.TestCheckResourceAttr(resourceName, "gcp_project_id", gcpProjectID), - resource.TestCheckResourceAttr(resourceName, "network_name", networkName), - - // computed values that are obtain from associated container, checks for existing prefix convention to ensure they are gcp related values - resource.TestCheckResourceAttrWith(resourceName, "atlas_gcp_project_id", acc.MatchesExpression("p-.*")), - resource.TestCheckResourceAttrWith(resourceName, "atlas_vpc_name", acc.MatchesExpression("nt-.*")), - ), - }, { - ResourceName: resourceName, - ImportStateIdFunc: importStateIDFunc(resourceName), - ImportState: true, - ImportStateVerify: true, + ResourceName: resourceName, + ImportStateIdFunc: importStateIDFunc(resourceName), + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"container_id"}, }, }, }) } -func TestAccNetworkRSNetworkPeering_updateBasicGCP(t *testing.T) { +func TestAccNetworkRSNetworkPeering_GCP(t *testing.T) { acc.SkipTestForCI(t) // needs GCP configuration var ( @@ -156,14 +85,14 @@ func TestAccNetworkRSNetworkPeering_updateBasicGCP(t *testing.T) { updatedNetworkName = acc.RandomName() ) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acc.PreCheck(t); acc.PreCheckPeeringEnvGCP(t) }, ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyNetworkPeering, Steps: []resource.TestStep{ { Config: configGCP(projectID, providerName, gcpProjectID, networkName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "container_id"), @@ -172,11 +101,15 @@ func TestAccNetworkRSNetworkPeering_updateBasicGCP(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "provider_name", providerName), resource.TestCheckResourceAttr(resourceName, "gcp_project_id", gcpProjectID), resource.TestCheckResourceAttr(resourceName, "network_name", networkName), + + // computed values that are obtain from associated container, checks for existing prefix convention to ensure they are gcp related values + resource.TestCheckResourceAttrWith(resourceName, "atlas_gcp_project_id", acc.MatchesExpression("p-.*")), + resource.TestCheckResourceAttrWith(resourceName, "atlas_vpc_name", acc.MatchesExpression("nt-.*")), ), }, { Config: configGCP(projectID, providerName, gcpProjectID, updatedNetworkName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "container_id"), @@ -185,8 +118,18 @@ func TestAccNetworkRSNetworkPeering_updateBasicGCP(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "provider_name", providerName), resource.TestCheckResourceAttr(resourceName, "gcp_project_id", gcpProjectID), resource.TestCheckResourceAttr(resourceName, "network_name", updatedNetworkName), + + // computed values that are obtain from associated container, checks for existing prefix convention to ensure they are gcp related values + resource.TestCheckResourceAttrWith(resourceName, "atlas_gcp_project_id", acc.MatchesExpression("p-.*")), + resource.TestCheckResourceAttrWith(resourceName, "atlas_vpc_name", acc.MatchesExpression("nt-.*")), ), }, + { + ResourceName: resourceName, + ImportStateIdFunc: importStateIDFunc(resourceName), + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -226,7 +169,7 @@ func TestAccNetworkRSNetworkPeering_AWSDifferentRegionName(t *testing.T) { Steps: []resource.TestStep{ { Config: configAWS(orgID, projectName, providerName, vpcID, awsAccountID, vpcCIDRBlock, containerRegion, peerRegion), - Check: resource.ComposeTestCheckFunc(checks...), + Check: resource.ComposeAggregateTestCheckFunc(checks...), }, }, }) @@ -253,7 +196,7 @@ func basicAWSTestCase(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configAWS(orgID, projectName, providerName, vpcID, awsAccountID, vpcCIDRBlock, containerRegion, peerRegion), - Check: resource.ComposeTestCheckFunc(checks...), + Check: resource.ComposeAggregateTestCheckFunc(checks...), }, { ResourceName: resourceName, diff --git a/internal/service/onlinearchive/resource_online_archive.go b/internal/service/onlinearchive/resource_online_archive.go index b3ab69a7eb..5f9b17b12b 100644 --- a/internal/service/onlinearchive/resource_online_archive.go +++ b/internal/service/onlinearchive/resource_online_archive.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/onlinearchive/resource_online_archive_migration_test.go b/internal/service/onlinearchive/resource_online_archive_migration_test.go index 67bf3a08ff..bce4755b2e 100644 --- a/internal/service/onlinearchive/resource_online_archive_migration_test.go +++ b/internal/service/onlinearchive/resource_online_archive_migration_test.go @@ -34,14 +34,14 @@ func TestMigBackupRSOnlineArchiveWithNoChangeBetweenVersions(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: configFirstStep(orgID, projectName, clusterName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( populateWithSampleData(resourceName, &cluster), ), }, { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(onlineArchiveResourceName, "partition_fields.0.field_name", "last_review"), ), }, diff --git a/internal/service/onlinearchive/resource_online_archive_test.go b/internal/service/onlinearchive/resource_online_archive_test.go index 1a502e7e2d..4386bb9fdf 100644 --- a/internal/service/onlinearchive/resource_online_archive_test.go +++ b/internal/service/onlinearchive/resource_online_archive_test.go @@ -38,13 +38,13 @@ func TestAccBackupRSOnlineArchive(t *testing.T) { // We need this step to pupulate the cluster with Sample Data // The online archive won't work if the cluster does not have data Config: configFirstStep(orgID, projectName, clusterName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( populateWithSampleData(resourceName, &cluster), ), }, { Config: configWithDailySchedule(orgID, projectName, clusterName, 1, 7), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "state"), resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "archive_id"), resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "collection_type"), @@ -60,7 +60,7 @@ func TestAccBackupRSOnlineArchive(t *testing.T) { }, { Config: configWithDailySchedule(orgID, projectName, clusterName, 2, 8), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "state"), resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "archive_id"), resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "collection_type"), @@ -76,7 +76,7 @@ func TestAccBackupRSOnlineArchive(t *testing.T) { }, { Config: testAccBackupRSOnlineArchiveConfigWithWeeklySchedule(orgID, projectName, clusterName, 2), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "state"), resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "archive_id"), resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "collection_type"), @@ -89,7 +89,7 @@ func TestAccBackupRSOnlineArchive(t *testing.T) { }, { Config: testAccBackupRSOnlineArchiveConfigWithMonthlySchedule(orgID, projectName, clusterName, 2), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "state"), resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "archive_id"), resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "collection_type"), @@ -102,7 +102,7 @@ func TestAccBackupRSOnlineArchive(t *testing.T) { }, { Config: configWithoutSchedule(orgID, projectName, clusterName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "state"), resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "archive_id"), resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "collection_type"), @@ -111,7 +111,7 @@ func TestAccBackupRSOnlineArchive(t *testing.T) { }, { Config: configWithoutSchedule(orgID, projectName, clusterName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(onlineArchiveResourceName, "partition_fields.0.field_name", "last_review"), ), }, @@ -138,13 +138,13 @@ func TestAccBackupRSOnlineArchiveBasic(t *testing.T) { // We need this step to pupulate the cluster with Sample Data // The online archive won't work if the cluster does not have data Config: configFirstStep(orgID, projectName, clusterName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( populateWithSampleData(resourceName, &cluster), ), }, { Config: configWithoutSchedule(orgID, projectName, clusterName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "state"), resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "archive_id"), resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "collection_type"), @@ -152,7 +152,7 @@ func TestAccBackupRSOnlineArchiveBasic(t *testing.T) { }, { Config: configWithDailySchedule(orgID, projectName, clusterName, 1, 1), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "state"), resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "archive_id"), resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "collection_type"), @@ -189,13 +189,13 @@ func TestAccBackupRSOnlineArchiveWithProcessRegion(t *testing.T) { // We need this step to pupulate the cluster with Sample Data // The online archive won't work if the cluster does not have data Config: configFirstStep(orgID, projectName, clusterName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( populateWithSampleData(resourceName, &cluster), ), }, { Config: configWithDataProcessRegion(orgID, projectName, clusterName, cloudProvider, processRegion), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(onlineArchiveResourceName, "data_process_region.0.cloud_provider", cloudProvider), resource.TestCheckResourceAttr(onlineArchiveResourceName, "data_process_region.0.region", processRegion), resource.TestCheckResourceAttr(onlineArchiveDataSourceName, "data_process_region.0.cloud_provider", cloudProvider), @@ -208,7 +208,7 @@ func TestAccBackupRSOnlineArchiveWithProcessRegion(t *testing.T) { }, { Config: configWithoutSchedule(orgID, projectName, clusterName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(onlineArchiveResourceName, "data_process_region.0.cloud_provider", cloudProvider), resource.TestCheckResourceAttr(onlineArchiveResourceName, "data_process_region.0.region", processRegion), ), diff --git a/internal/service/organization/data_source_organization_test.go b/internal/service/organization/data_source_organization_test.go index 1aebdaebfa..482b915cb3 100644 --- a/internal/service/organization/data_source_organization_test.go +++ b/internal/service/organization/data_source_organization_test.go @@ -20,7 +20,7 @@ func TestAccConfigDSOrganization_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccMongoDBAtlasOrganizationConfigWithDS(orgID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(datasourceName, "name"), resource.TestCheckResourceAttrSet(datasourceName, "id"), resource.TestCheckResourceAttrSet(datasourceName, "restrict_employee_access"), diff --git a/internal/service/organization/data_source_organizations.go b/internal/service/organization/data_source_organizations.go index 770c03338c..b1d209ef46 100644 --- a/internal/service/organization/data_source_organizations.go +++ b/internal/service/organization/data_source_organizations.go @@ -5,7 +5,7 @@ import ( "fmt" "log" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" diff --git a/internal/service/organization/data_source_organizations_test.go b/internal/service/organization/data_source_organizations_test.go index 28043ce7bb..5cd9e3a23a 100644 --- a/internal/service/organization/data_source_organizations_test.go +++ b/internal/service/organization/data_source_organizations_test.go @@ -18,7 +18,7 @@ func TestAccConfigDSOrganizations_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccMongoDBAtlasOrganizationsConfigWithDS(), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(datasourceName, "results.#"), resource.TestCheckResourceAttrSet(datasourceName, "results.0.name"), resource.TestCheckResourceAttrSet(datasourceName, "results.0.id"), @@ -40,7 +40,7 @@ func TestAccConfigDSOrganizations_withPagination(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccMongoDBAtlasOrganizationsConfigWithPagination(2, 5), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(datasourceName, "results.#"), ), }, diff --git a/internal/service/organization/resource_organization.go b/internal/service/organization/resource_organization.go index af728fadbd..6a7c38fc34 100644 --- a/internal/service/organization/resource_organization.go +++ b/internal/service/organization/resource_organization.go @@ -6,7 +6,7 @@ import ( "log" "net/http" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" diff --git a/internal/service/organization/resource_organization_migration_test.go b/internal/service/organization/resource_organization_migration_test.go index 344f5af8c6..469b3311be 100644 --- a/internal/service/organization/resource_organization_migration_test.go +++ b/internal/service/organization/resource_organization_migration_test.go @@ -27,7 +27,7 @@ func TestMigConfigRSOrganization_Basic(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: testAccMongoDBAtlasOrganizationConfigBasic(orgOwnerID, name, description, roleName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "org_id"), resource.TestCheckResourceAttrSet(resourceName, "description"), resource.TestCheckResourceAttr(resourceName, "description", description), diff --git a/internal/service/organization/resource_organization_test.go b/internal/service/organization/resource_organization_test.go index 322bcf48da..22095111ab 100644 --- a/internal/service/organization/resource_organization_test.go +++ b/internal/service/organization/resource_organization_test.go @@ -7,7 +7,7 @@ import ( "regexp" "testing" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" @@ -37,7 +37,7 @@ func TestAccConfigRSOrganization_Basic(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccMongoDBAtlasOrganizationConfigBasic(orgOwnerID, name, description, roleName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMongoDBAtlasOrganizationExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "org_id"), resource.TestCheckResourceAttr(resourceName, "description", description), @@ -48,7 +48,7 @@ func TestAccConfigRSOrganization_Basic(t *testing.T) { }, { Config: testAccMongoDBAtlasOrganizationConfigBasic(orgOwnerID, updatedName, description, roleName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMongoDBAtlasOrganizationExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "org_id"), resource.TestCheckResourceAttr(resourceName, "description", description), @@ -110,7 +110,7 @@ func TestAccConfigRSOrganization_Settings(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccMongoDBAtlasOrganizationConfigWithSettings(orgOwnerID, name, description, roleName, settingsConfig), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMongoDBAtlasOrganizationExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "org_id"), resource.TestCheckResourceAttr(resourceName, "description", description), @@ -121,7 +121,7 @@ func TestAccConfigRSOrganization_Settings(t *testing.T) { }, { Config: testAccMongoDBAtlasOrganizationConfigWithSettings(orgOwnerID, name, description, roleName, settingsConfigUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMongoDBAtlasOrganizationExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "org_id"), resource.TestCheckResourceAttr(resourceName, "description", description), @@ -132,7 +132,7 @@ func TestAccConfigRSOrganization_Settings(t *testing.T) { }, { Config: testAccMongoDBAtlasOrganizationConfigBasic(orgOwnerID, "org-name-updated", description, roleName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMongoDBAtlasOrganizationExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "org_id"), resource.TestCheckResourceAttrSet(resourceName, "description"), diff --git a/internal/service/orginvitation/data_source_org_invitation_test.go b/internal/service/orginvitation/data_source_org_invitation_test.go index eee4b19c17..34ef8f67bb 100644 --- a/internal/service/orginvitation/data_source_org_invitation_test.go +++ b/internal/service/orginvitation/data_source_org_invitation_test.go @@ -25,7 +25,7 @@ func TestAccConfigDSOrgInvitation_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configDS(orgID, name, initialRole), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(dataSourceName, "invitation_id"), resource.TestCheckResourceAttr(dataSourceName, "org_id", orgID), resource.TestCheckResourceAttr(dataSourceName, "username", name), diff --git a/internal/service/orginvitation/resource_org_invitation.go b/internal/service/orginvitation/resource_org_invitation.go index b978dcc1b6..fb64f43946 100644 --- a/internal/service/orginvitation/resource_org_invitation.go +++ b/internal/service/orginvitation/resource_org_invitation.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func Resource() *schema.Resource { diff --git a/internal/service/orginvitation/resource_org_invitation_migration_test.go b/internal/service/orginvitation/resource_org_invitation_migration_test.go index 2c9a2d44c1..8d4c995e49 100644 --- a/internal/service/orginvitation/resource_org_invitation_migration_test.go +++ b/internal/service/orginvitation/resource_org_invitation_migration_test.go @@ -25,7 +25,7 @@ func TestMigConfigOrgInvitation_basic(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "invitation_id"), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), diff --git a/internal/service/orginvitation/resource_org_invitation_test.go b/internal/service/orginvitation/resource_org_invitation_test.go index 313da5e312..5a2c4446a4 100644 --- a/internal/service/orginvitation/resource_org_invitation_test.go +++ b/internal/service/orginvitation/resource_org_invitation_test.go @@ -29,7 +29,7 @@ func TestAccConfigRSOrgInvitation_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(orgID, name, initialRole), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "invitation_id"), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), @@ -40,7 +40,7 @@ func TestAccConfigRSOrgInvitation_basic(t *testing.T) { }, { Config: configBasic(orgID, name, updateRoles), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "invitation_id"), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), diff --git a/internal/service/privateendpointregionalmode/resource_private_endpoint_regional_mode.go b/internal/service/privateendpointregionalmode/resource_private_endpoint_regional_mode.go index 8a8a47e7bd..f3eb5f7c95 100644 --- a/internal/service/privateendpointregionalmode/resource_private_endpoint_regional_mode.go +++ b/internal/service/privateendpointregionalmode/resource_private_endpoint_regional_mode.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" "github.com/mongodb/terraform-provider-mongodbatlas/internal/service/advancedcluster" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) type permCtxKey string diff --git a/internal/service/privateendpointregionalmode/resource_private_endpoint_regional_mode_test.go b/internal/service/privateendpointregionalmode/resource_private_endpoint_regional_mode_test.go index ccaf15227a..bc89b6732f 100644 --- a/internal/service/privateendpointregionalmode/resource_private_endpoint_regional_mode_test.go +++ b/internal/service/privateendpointregionalmode/resource_private_endpoint_regional_mode_test.go @@ -48,7 +48,7 @@ func TestAccPrivateEndpointRegionalMode_conn(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithDependencies(resourceSuffix, projectID, false, dependencies), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), checkModeClustersUpToDate(projectID, clusterName, clusterResourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), @@ -58,7 +58,7 @@ func TestAccPrivateEndpointRegionalMode_conn(t *testing.T) { }, { Config: configWithDependencies(resourceSuffix, projectID, true, dependencies), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), checkModeClustersUpToDate(projectID, clusterName, clusterResourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), @@ -87,7 +87,7 @@ func basicTestCase(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configBasic(orgID, projectName, false), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "enabled", "false"), @@ -98,7 +98,7 @@ func basicTestCase(tb testing.TB) *resource.TestCase { }, { Config: configBasic(orgID, projectName, true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "enabled", "true"), diff --git a/internal/service/privatelinkendpoint/data_source_privatelink_endpoint_test.go b/internal/service/privatelinkendpoint/data_source_privatelink_endpoint_test.go index 3b344f1cf8..e4838d9ab5 100644 --- a/internal/service/privatelinkendpoint/data_source_privatelink_endpoint_test.go +++ b/internal/service/privatelinkendpoint/data_source_privatelink_endpoint_test.go @@ -23,7 +23,7 @@ func TestAccNetworkDSPrivateLinkEndpoint_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configDS(projectID, providerName, region), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "private_link_id"), diff --git a/internal/service/privatelinkendpoint/resource_privatelink_endpoint.go b/internal/service/privatelinkendpoint/resource_privatelink_endpoint.go index 52543d35db..168bcbe263 100644 --- a/internal/service/privatelinkendpoint/resource_privatelink_endpoint.go +++ b/internal/service/privatelinkendpoint/resource_privatelink_endpoint.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/privatelinkendpoint/resource_privatelink_endpoint_migration_test.go b/internal/service/privatelinkendpoint/resource_privatelink_endpoint_migration_test.go index 5aaed4681d..97ad27497e 100644 --- a/internal/service/privatelinkendpoint/resource_privatelink_endpoint_migration_test.go +++ b/internal/service/privatelinkendpoint/resource_privatelink_endpoint_migration_test.go @@ -26,7 +26,7 @@ func TestMigNetworkPrivateLinkEndpoint_basic(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "provider_name", providerName), diff --git a/internal/service/privatelinkendpoint/resource_privatelink_endpoint_test.go b/internal/service/privatelinkendpoint/resource_privatelink_endpoint_test.go index d809ce6105..c260939d7b 100644 --- a/internal/service/privatelinkendpoint/resource_privatelink_endpoint_test.go +++ b/internal/service/privatelinkendpoint/resource_privatelink_endpoint_test.go @@ -28,7 +28,7 @@ func TestAccNetworkRSPrivateLinkEndpointAWS_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(orgID, projectName, providerName, region), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "provider_name"), @@ -63,7 +63,7 @@ func TestAccNetworkRSPrivateLinkEndpointAzure_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(orgID, projectName, providerName, region), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "provider_name"), @@ -98,7 +98,7 @@ func TestAccNetworkRSPrivateLinkEndpointGCP_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(orgID, projectName, providerName, region), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "provider_name"), diff --git a/internal/service/privatelinkendpointserverless/resource_privatelink_endpoint_serverless.go b/internal/service/privatelinkendpointserverless/resource_privatelink_endpoint_serverless.go index 5c3de42ceb..729332facc 100644 --- a/internal/service/privatelinkendpointserverless/resource_privatelink_endpoint_serverless.go +++ b/internal/service/privatelinkendpointserverless/resource_privatelink_endpoint_serverless.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" diff --git a/internal/service/privatelinkendpointserverless/resource_privatelink_endpoint_serverless_test.go b/internal/service/privatelinkendpointserverless/resource_privatelink_endpoint_serverless_test.go index 9cbf362214..0043a1f58f 100644 --- a/internal/service/privatelinkendpointserverless/resource_privatelink_endpoint_serverless_test.go +++ b/internal/service/privatelinkendpointserverless/resource_privatelink_endpoint_serverless_test.go @@ -34,7 +34,7 @@ func basicTestCase(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configBasic(projectID, instanceName, true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "instance_name", instanceName), ), diff --git a/internal/service/privatelinkendpointservice/resource_privatelink_endpoint_service.go b/internal/service/privatelinkendpointservice/resource_privatelink_endpoint_service.go index 721db88114..7c0ccbd942 100644 --- a/internal/service/privatelinkendpointservice/resource_privatelink_endpoint_service.go +++ b/internal/service/privatelinkendpointservice/resource_privatelink_endpoint_service.go @@ -17,7 +17,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" "github.com/mongodb/terraform-provider-mongodbatlas/internal/service/advancedcluster" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/privatelinkendpointservice/resource_privatelink_endpoint_service_test.go b/internal/service/privatelinkendpointservice/resource_privatelink_endpoint_service_test.go index 4a5162a421..ae0e822a77 100644 --- a/internal/service/privatelinkendpointservice/resource_privatelink_endpoint_service_test.go +++ b/internal/service/privatelinkendpointservice/resource_privatelink_endpoint_service_test.go @@ -50,7 +50,7 @@ func basicAWSTestCase(tb testing.TB) *resource.TestCase { Config: configCompleteAWS( awsAccessKey, awsSecretKey, projectID, providerName, region, vpcID, subnetID, securityGroupID, resourceSuffix, ), - Check: resource.ComposeTestCheckFunc(checks...), + Check: resource.ComposeAggregateTestCheckFunc(checks...), }, { ResourceName: resourceName, diff --git a/internal/service/privatelinkendpointservicedatafederationonlinearchive/data_source_privatelink_endpoint_service_data_federation_online_archive_test.go b/internal/service/privatelinkendpointservicedatafederationonlinearchive/data_source_privatelink_endpoint_service_data_federation_online_archive_test.go index c1f5c70fc1..882efe2c18 100644 --- a/internal/service/privatelinkendpointservicedatafederationonlinearchive/data_source_privatelink_endpoint_service_data_federation_online_archive_test.go +++ b/internal/service/privatelinkendpointservicedatafederationonlinearchive/data_source_privatelink_endpoint_service_data_federation_online_archive_test.go @@ -27,7 +27,7 @@ func TestAccNetworkPrivatelinkEndpointServiceDataFederationOnlineArchiveDS_basic Steps: []resource.TestStep{ { Config: dataSourcesConfigBasic(projectID, endpointID, customerEndpointDNSName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(dataSourcePrivatelinkEndpointServiceDataFederetionDataArchive, "project_id", projectID), resource.TestCheckResourceAttr(dataSourcePrivatelinkEndpointServiceDataFederetionDataArchive, "endpoint_id", endpointID), diff --git a/internal/service/privatelinkendpointservicedatafederationonlinearchive/data_source_privatelink_endpoint_service_data_federation_online_archives.go b/internal/service/privatelinkendpointservicedatafederationonlinearchive/data_source_privatelink_endpoint_service_data_federation_online_archives.go index c8c9e4238b..ac86d494a2 100644 --- a/internal/service/privatelinkendpointservicedatafederationonlinearchive/data_source_privatelink_endpoint_service_data_federation_online_archives.go +++ b/internal/service/privatelinkendpointservicedatafederationonlinearchive/data_source_privatelink_endpoint_service_data_federation_online_archives.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" "github.com/mongodb/terraform-provider-mongodbatlas/internal/service/datalakepipeline" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const errorPrivateEndpointServiceDataFederationOnlineArchiveList = "error reading Private Endpoings for projectId %s: %s" diff --git a/internal/service/privatelinkendpointservicedatafederationonlinearchive/data_source_privatelink_endpoint_service_data_federation_online_archives_test.go b/internal/service/privatelinkendpointservicedatafederationonlinearchive/data_source_privatelink_endpoint_service_data_federation_online_archives_test.go index 6c2433308c..86c54d6faa 100644 --- a/internal/service/privatelinkendpointservicedatafederationonlinearchive/data_source_privatelink_endpoint_service_data_federation_online_archives_test.go +++ b/internal/service/privatelinkendpointservicedatafederationonlinearchive/data_source_privatelink_endpoint_service_data_federation_online_archives_test.go @@ -26,7 +26,7 @@ func TestAccNetworkPrivatelinkEndpointServiceDataFederationOnlineArchivesDSPlura Steps: []resource.TestStep{ { Config: dataSourceConfigBasic(projectID, endpointID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(dataSourcePrivatelinkEndpointServiceDataFederetionDataArchives, "project_id", projectID), resource.TestCheckResourceAttrSet(dataSourcePrivatelinkEndpointServiceDataFederetionDataArchives, "results.#"), diff --git a/internal/service/privatelinkendpointservicedatafederationonlinearchive/resource_privatelink_endpoint_service_data_federation_online_archive.go b/internal/service/privatelinkendpointservicedatafederationonlinearchive/resource_privatelink_endpoint_service_data_federation_online_archive.go index 5c0fa899ab..70a41e734f 100644 --- a/internal/service/privatelinkendpointservicedatafederationonlinearchive/resource_privatelink_endpoint_service_data_federation_online_archive.go +++ b/internal/service/privatelinkendpointservicedatafederationonlinearchive/resource_privatelink_endpoint_service_data_federation_online_archive.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" diff --git a/internal/service/privatelinkendpointservicedatafederationonlinearchive/resource_privatelink_endpoint_service_data_federation_online_archive_migration_test.go b/internal/service/privatelinkendpointservicedatafederationonlinearchive/resource_privatelink_endpoint_service_data_federation_online_archive_migration_test.go index 98484a9a0c..cc8c60728a 100644 --- a/internal/service/privatelinkendpointservicedatafederationonlinearchive/resource_privatelink_endpoint_service_data_federation_online_archive_migration_test.go +++ b/internal/service/privatelinkendpointservicedatafederationonlinearchive/resource_privatelink_endpoint_service_data_federation_online_archive_migration_test.go @@ -23,7 +23,7 @@ func TestMigNetworkPrivatelinkEndpointServiceDataFederationOnlineArchive_basic(t { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "endpoint_id", endpointID), diff --git a/internal/service/privatelinkendpointservicedatafederationonlinearchive/resource_privatelink_endpoint_service_data_federation_online_archive_test.go b/internal/service/privatelinkendpointservicedatafederationonlinearchive/resource_privatelink_endpoint_service_data_federation_online_archive_test.go index fc09aba865..14c9516ec6 100644 --- a/internal/service/privatelinkendpointservicedatafederationonlinearchive/resource_privatelink_endpoint_service_data_federation_online_archive_test.go +++ b/internal/service/privatelinkendpointservicedatafederationonlinearchive/resource_privatelink_endpoint_service_data_federation_online_archive_test.go @@ -31,7 +31,7 @@ func TestAccNetworkPrivatelinkEndpointServiceDataFederationOnlineArchive_basic(t Steps: []resource.TestStep{ { Config: resourceConfigBasic(projectID, endpointID, comment), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "endpoint_id", endpointID), @@ -63,7 +63,7 @@ func TestAccNetworkPrivatelinkEndpointServiceDataFederationOnlineArchive_updateC Steps: []resource.TestStep{ { Config: resourceConfigBasic(projectID, endpointID, comment), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "endpoint_id", endpointID), @@ -74,7 +74,7 @@ func TestAccNetworkPrivatelinkEndpointServiceDataFederationOnlineArchive_updateC }, { Config: resourceConfigBasic(projectID, endpointID, commentUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "endpoint_id", endpointID), @@ -85,7 +85,7 @@ func TestAccNetworkPrivatelinkEndpointServiceDataFederationOnlineArchive_updateC }, { Config: resourceConfigBasic(projectID, endpointID, ""), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "endpoint_id", endpointID), @@ -110,7 +110,7 @@ func TestAccNetworkPrivatelinkEndpointServiceDataFederationOnlineArchive_basicWi Steps: []resource.TestStep{ { Config: resourceConfigBasicWithRegionDNSName(projectID, endpointID, comment, customerEndpointDNSName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), resource.TestCheckResourceAttr(resourceName, "endpoint_id", endpointID), diff --git a/internal/service/privatelinkendpointserviceserverless/data_source_privatelink_endpoints_service_serverless.go b/internal/service/privatelinkendpointserviceserverless/data_source_privatelink_endpoints_service_serverless.go index d979c39252..58bc37361f 100644 --- a/internal/service/privatelinkendpointserviceserverless/data_source_privatelink_endpoints_service_serverless.go +++ b/internal/service/privatelinkendpointserviceserverless/data_source_privatelink_endpoints_service_serverless.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func PluralDataSource() *schema.Resource { diff --git a/internal/service/privatelinkendpointserviceserverless/resource_privatelink_endpoint_service_serverless.go b/internal/service/privatelinkendpointserviceserverless/resource_privatelink_endpoint_service_serverless.go index 6c238b442f..ed335d3a18 100644 --- a/internal/service/privatelinkendpointserviceserverless/resource_privatelink_endpoint_service_serverless.go +++ b/internal/service/privatelinkendpointserviceserverless/resource_privatelink_endpoint_service_serverless.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" diff --git a/internal/service/privatelinkendpointserviceserverless/resource_privatelink_endpoint_service_serverless_migration_test.go b/internal/service/privatelinkendpointserviceserverless/resource_privatelink_endpoint_service_serverless_migration_test.go index 3401010a15..6070ae8a34 100644 --- a/internal/service/privatelinkendpointserviceserverless/resource_privatelink_endpoint_service_serverless_migration_test.go +++ b/internal/service/privatelinkendpointserviceserverless/resource_privatelink_endpoint_service_serverless_migration_test.go @@ -27,7 +27,7 @@ func TestMigServerlessPrivateLinkEndpointService_basic(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "provider_name", "AWS"), resource.TestCheckResourceAttr(resourceName, "comment", commentOrigin), @@ -57,7 +57,7 @@ func TestMigServerlessPrivateLinkEndpointService_AWSVPC(t *testing.T) { { ExternalProviders: mig.ExternalProvidersWithAWS(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "provider_name", "AWS"), ), diff --git a/internal/service/privatelinkendpointserviceserverless/resource_privatelink_endpoint_service_serverless_test.go b/internal/service/privatelinkendpointserviceserverless/resource_privatelink_endpoint_service_serverless_test.go index 730ce95258..d238d1f790 100644 --- a/internal/service/privatelinkendpointserviceserverless/resource_privatelink_endpoint_service_serverless_test.go +++ b/internal/service/privatelinkendpointserviceserverless/resource_privatelink_endpoint_service_serverless_test.go @@ -31,7 +31,7 @@ func TestAccServerlessPrivateLinkEndpointService_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(projectID, instanceName, commentOrigin), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "provider_name", "AWS"), resource.TestCheckResourceAttr(resourceName, "comment", commentOrigin), @@ -43,7 +43,7 @@ func TestAccServerlessPrivateLinkEndpointService_basic(t *testing.T) { }, { Config: configBasic(projectID, instanceName, commentUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "provider_name", "AWS"), resource.TestCheckResourceAttr(resourceName, "comment", commentUpdated), @@ -83,7 +83,7 @@ func TestAccServerlessPrivateLinkEndpointService_AWSEndpointCommentUpdate(t *tes Steps: []resource.TestStep{ { Config: configAWSEndpoint(projectID, instanceName, awsAccessKey, awsSecretKey, false, ""), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "provider_name", "AWS"), resource.TestCheckResourceAttrSet(datasourceEndpointsName, "project_id"), @@ -93,7 +93,7 @@ func TestAccServerlessPrivateLinkEndpointService_AWSEndpointCommentUpdate(t *tes }, { Config: configAWSEndpoint(projectID, instanceName, awsAccessKey, awsSecretKey, true, commentUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "provider_name", "AWS"), resource.TestCheckResourceAttr(resourceName, "comment", commentUpdated), diff --git a/internal/service/project/data_source_project.go b/internal/service/project/data_source_project.go index 268adf8c41..2cbc63330f 100644 --- a/internal/service/project/data_source_project.go +++ b/internal/service/project/data_source_project.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" "github.com/hashicorp/terraform-plugin-framework/datasource" diff --git a/internal/service/project/data_source_projects.go b/internal/service/project/data_source_projects.go index ff09c16f3b..eff493d60c 100644 --- a/internal/service/project/data_source_projects.go +++ b/internal/service/project/data_source_projects.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const projectsDataSourceName = "projects" diff --git a/internal/service/project/model_project.go b/internal/service/project/model_project.go index 7602a85bfd..628bbb687e 100644 --- a/internal/service/project/model_project.go +++ b/internal/service/project/model_project.go @@ -3,7 +3,7 @@ package project import ( "context" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/diag" diff --git a/internal/service/project/model_project_test.go b/internal/service/project/model_project_test.go index 735c137a66..81dca2d660 100644 --- a/internal/service/project/model_project_test.go +++ b/internal/service/project/model_project_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" diff --git a/internal/service/project/resource_project.go b/internal/service/project/resource_project.go index 7874cc7c64..c99bd7be9a 100644 --- a/internal/service/project/resource_project.go +++ b/internal/service/project/resource_project.go @@ -9,7 +9,7 @@ import ( "sort" "time" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/path" @@ -130,7 +130,7 @@ var TfLimitObjectType = types.ObjectType{AttrTypes: map[string]attr.Type{ // Resources that need to be cleaned up before a project can be deleted type AtlasProjectDependants struct { - AdvancedClusters *admin.PaginatedAdvancedClusterDescription + AdvancedClusters *admin.PaginatedClusterDescription20240710 } func (r *projectRS) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { diff --git a/internal/service/project/resource_project_migration_test.go b/internal/service/project/resource_project_migration_test.go index c4c4d25f5d..ec7ed63e1c 100644 --- a/internal/service/project/resource_project_migration_test.go +++ b/internal/service/project/resource_project_migration_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc" @@ -28,7 +28,7 @@ func TestMigProject_basic(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "org_id", orgID), ), }, @@ -67,7 +67,7 @@ func TestMigProject_withTeams(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "name", projectName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), @@ -94,7 +94,7 @@ func TestMigProject_withFalseDefaultSettings(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "name", projectName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), @@ -128,7 +128,7 @@ func TestMigProject_withLimits(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", projectName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), resource.TestCheckResourceAttr(resourceName, "limits.0.name", "atlas.project.deployment.clusters"), @@ -156,14 +156,14 @@ func TestMigGovProject_regionUsageRestrictionsDefault(t *testing.T) { { ExternalProviders: acc.ExternalProviders("1.15.3"), Config: configGovSimple(orgID, projectName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsGov(resourceName), ), }, { ExternalProviders: acc.ExternalProviders("1.16.0"), Config: configGovSimple(orgID, projectName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsGov(resourceName), ), ExpectError: regexp.MustCompile("Provider produced inconsistent result after apply"), diff --git a/internal/service/project/resource_project_test.go b/internal/service/project/resource_project_test.go index 8ed4463755..5cc5aa71ec 100644 --- a/internal/service/project/resource_project_test.go +++ b/internal/service/project/resource_project_test.go @@ -11,8 +11,8 @@ import ( "strings" "testing" - "go.mongodb.org/atlas-sdk/v20231115014/admin" - "go.mongodb.org/atlas-sdk/v20231115014/mockadmin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" + "go.mongodb.org/atlas-sdk/v20240530002/mockadmin" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-testing/helper/resource" @@ -451,7 +451,7 @@ func TestResourceProjectDependentsDeletingRefreshFunc(t *testing.T) { { name: "Error not from the API", mockResponses: AdvancedClusterDescriptionResponse{ - AdvancedClusterDescription: &admin.PaginatedAdvancedClusterDescription{}, + AdvancedClusterDescription: &admin.PaginatedClusterDescription20240710{}, Err: errors.New("Non-API error"), }, expectedError: true, @@ -459,7 +459,7 @@ func TestResourceProjectDependentsDeletingRefreshFunc(t *testing.T) { { name: "Error from the API", mockResponses: AdvancedClusterDescriptionResponse{ - AdvancedClusterDescription: &admin.PaginatedAdvancedClusterDescription{}, + AdvancedClusterDescription: &admin.PaginatedClusterDescription20240710{}, Err: &admin.GenericOpenAPIError{}, }, expectedError: true, @@ -467,9 +467,9 @@ func TestResourceProjectDependentsDeletingRefreshFunc(t *testing.T) { { name: "Successful API call", mockResponses: AdvancedClusterDescriptionResponse{ - AdvancedClusterDescription: &admin.PaginatedAdvancedClusterDescription{ + AdvancedClusterDescription: &admin.PaginatedClusterDescription20240710{ TotalCount: conversion.IntPtr(2), - Results: &[]admin.AdvancedClusterDescription{ + Results: &[]admin.ClusterDescription20240710{ {StateName: conversion.StringPtr("IDLE")}, {StateName: conversion.StringPtr("DELETING")}, }, @@ -551,7 +551,7 @@ func TestAccProject_basic(t *testing.T) { }, }, ), - Check: resource.ComposeTestCheckFunc(checks...), + Check: resource.ComposeAggregateTestCheckFunc(checks...), }, { Config: configBasic(orgID, projectName, projectOwnerID, false, @@ -570,7 +570,7 @@ func TestAccProject_basic(t *testing.T) { }, }, ), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "name", projectName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), @@ -592,7 +592,7 @@ func TestAccProject_basic(t *testing.T) { }, }, ), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "name", projectName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), @@ -625,7 +625,7 @@ func TestAccGovProject_withProjectOwner(t *testing.T) { Steps: []resource.TestStep{ { Config: configGovWithOwner(orgID, projectName, projectOwnerID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExistsGov(resourceName), resource.TestCheckResourceAttr(resourceName, "name", projectName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), @@ -651,7 +651,7 @@ func TestAccProject_withFalseDefaultSettings(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithFalseDefaultSettings(orgID, projectName, projectOwnerID), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "name", projectName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), @@ -675,7 +675,7 @@ func TestAccProject_withUpdatedSettings(t *testing.T) { Steps: []resource.TestStep{ { Config: acc.ConfigProjectWithSettings(projectName, orgID, projectOwnerID, false), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "name", projectName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), @@ -691,7 +691,7 @@ func TestAccProject_withUpdatedSettings(t *testing.T) { }, { Config: acc.ConfigProjectWithSettings(projectName, orgID, projectOwnerID, true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "with_default_alerts_settings", "true"), resource.TestCheckResourceAttr(resourceName, "is_collect_database_specifics_statistics_enabled", "true"), @@ -704,7 +704,7 @@ func TestAccProject_withUpdatedSettings(t *testing.T) { }, { Config: acc.ConfigProjectWithSettings(projectName, orgID, projectOwnerID, false), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "with_default_alerts_settings", "false"), resource.TestCheckResourceAttr(resourceName, "is_collect_database_specifics_statistics_enabled", "false"), @@ -734,7 +734,7 @@ func TestAccProject_withUpdatedRole(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithUpdatedRole(orgID, projectName, acc.GetProjectTeamsIDsWithPos(0), roleName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", projectName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), resource.TestCheckResourceAttr(resourceName, "cluster_count", clusterCount), @@ -742,7 +742,7 @@ func TestAccProject_withUpdatedRole(t *testing.T) { }, { Config: configWithUpdatedRole(orgID, projectName, acc.GetProjectTeamsIDsWithPos(0), roleNameUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", projectName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), resource.TestCheckResourceAttr(resourceName, "cluster_count", clusterCount), @@ -771,7 +771,7 @@ func TestAccProject_updatedToEmptyRoles(t *testing.T) { }, }, ), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "teams.#", "1"), resource.TestCheckResourceAttr(resourceName, "teams.0.team_id", acc.GetProjectTeamsIDsWithPos(0)), @@ -782,7 +782,7 @@ func TestAccProject_updatedToEmptyRoles(t *testing.T) { }, { Config: configBasic(orgID, projectName, "", false, nil), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "teams.#", "0"), ), @@ -829,7 +829,7 @@ func TestAccProject_withUpdatedLimits(t *testing.T) { Value: 1, }, }), - Check: resource.ComposeTestCheckFunc(checks...), + Check: resource.ComposeAggregateTestCheckFunc(checks...), }, { Config: configWithLimits(orgID, projectName, []*admin.DataFederationLimit{ @@ -838,7 +838,7 @@ func TestAccProject_withUpdatedLimits(t *testing.T) { Value: 2, }, }), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", projectName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), resource.TestCheckResourceAttr(resourceName, "limits.0.name", "atlas.project.deployment.nodesPerPrivateLinkRegion"), @@ -860,7 +860,7 @@ func TestAccProject_withUpdatedLimits(t *testing.T) { Value: 30, }, }), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", projectName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), resource.TestCheckTypeSetElemNestedAttrs( @@ -910,7 +910,7 @@ func TestAccProject_updatedToEmptyLimits(t *testing.T) { Value: 1, }, }), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "limits.#", "1"), resource.TestCheckResourceAttr(resourceName, "limits.0.name", "atlas.project.deployment.clusters"), resource.TestCheckResourceAttr(resourceName, "limits.0.value", "1"), @@ -918,7 +918,7 @@ func TestAccProject_updatedToEmptyLimits(t *testing.T) { }, { Config: configWithLimits(orgID, projectName, nil), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "limits.#", "0"), ), }, @@ -963,7 +963,7 @@ func TestAccProject_withInvalidLimitNameOnUpdate(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithLimits(orgID, projectName, []*admin.DataFederationLimit{}), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", projectName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), ), @@ -1011,7 +1011,7 @@ func TestAccProject_withTags(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithTags(orgID, projectName, nil), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", projectName), resource.TestCheckResourceAttr(resourceName, "org_id", orgID), resource.TestCheckResourceAttr(resourceName, "tags.#", "0"), @@ -1028,7 +1028,7 @@ func TestAccProject_withTags(t *testing.T) { }, { Config: configWithTags(orgID, projectName, tagsEmpty), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "tags.#", "0"), resource.TestCheckResourceAttr(dataSourceNameByID, "tags.#", "0"), ), @@ -1259,7 +1259,7 @@ type DeleteProjectLimitResponse struct { Err error } type AdvancedClusterDescriptionResponse struct { - AdvancedClusterDescription *admin.PaginatedAdvancedClusterDescription + AdvancedClusterDescription *admin.PaginatedClusterDescription20240710 HTTPResponse *http.Response Err error } diff --git a/internal/service/projectapikey/resource_project_api_key.go b/internal/service/projectapikey/resource_project_api_key.go index 8397e09bf0..518733b8f4 100644 --- a/internal/service/projectapikey/resource_project_api_key.go +++ b/internal/service/projectapikey/resource_project_api_key.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" matlas "go.mongodb.org/atlas/mongodbatlas" ) diff --git a/internal/service/projectapikey/resource_project_api_key_test.go b/internal/service/projectapikey/resource_project_api_key_test.go index e2f8a18d11..8654cfcce7 100644 --- a/internal/service/projectapikey/resource_project_api_key_test.go +++ b/internal/service/projectapikey/resource_project_api_key_test.go @@ -39,7 +39,7 @@ func basicTestCase(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configBasic(projectID, description, roleName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "description", description), resource.TestCheckResourceAttrSet(resourceName, "public_key"), resource.TestCheckResourceAttr(resourceName, "project_assignment.#", "1"), @@ -70,7 +70,7 @@ func TestAccProjectAPIKey_changingSingleProject(t *testing.T) { Steps: []resource.TestStep{ { Config: configChangingProject(orgID, projectName2, description, fmt.Sprintf("%q", projectID1)), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "description", description), resource.TestCheckResourceAttrSet(resourceName, "public_key"), resource.TestCheckResourceAttr(resourceName, "project_assignment.#", "1"), @@ -78,7 +78,7 @@ func TestAccProjectAPIKey_changingSingleProject(t *testing.T) { }, { Config: configChangingProject(orgID, projectName2, description, "mongodbatlas_project.proj2.id"), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "description", description), resource.TestCheckResourceAttrSet(resourceName, "public_key"), resource.TestCheckResourceAttr(resourceName, "project_assignment.#", "1"), @@ -103,7 +103,7 @@ func TestAccProjectAPIKey_multiple(t *testing.T) { Steps: []resource.TestStep{ { Config: configMultiple(projectID, description, roleName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "description"), resource.TestCheckResourceAttr(resourceName, "description", description), resource.TestCheckResourceAttrSet(resourceName, "project_assignment.0.project_id"), @@ -134,14 +134,14 @@ func TestAccProjectAPIKey_updateDescription(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(projectID, description, roleName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "description"), resource.TestCheckResourceAttr(resourceName, "description", description), ), }, { Config: configBasic(projectID, updatedDescription, roleName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "description"), resource.TestCheckResourceAttr(resourceName, "description", updatedDescription), ), @@ -167,7 +167,7 @@ func TestAccProjectAPIKey_recreateWhenDeletedExternally(t *testing.T) { Steps: []resource.TestStep{ { Config: projectAPIKeyConfig, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "description"), ), }, @@ -200,14 +200,14 @@ func TestAccProjectAPIKey_deleteProjectAndAssignment(t *testing.T) { Steps: []resource.TestStep{ { Config: configDeletedProjectAndAssignment(orgID, projectID1, projectName2, description, true), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "project_assignment.0.project_id"), resource.TestCheckResourceAttrSet(resourceName, "project_assignment.1.project_id"), ), }, { Config: configDeletedProjectAndAssignment(orgID, projectID1, projectName2, description, false), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "project_assignment.0.project_id"), ), }, diff --git a/internal/service/projectinvitation/data_source_project_invitation_test.go b/internal/service/projectinvitation/data_source_project_invitation_test.go index 7e08420b82..edf967dfd9 100644 --- a/internal/service/projectinvitation/data_source_project_invitation_test.go +++ b/internal/service/projectinvitation/data_source_project_invitation_test.go @@ -26,7 +26,7 @@ func TestAccProjectDSProjectInvitation_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccDataSourceMongoDBAtlasProjectInvitationConfig(orgID, projectName, name, initialRole), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(dataSourceName, "project_id"), resource.TestCheckResourceAttrSet(dataSourceName, "username"), resource.TestCheckResourceAttrSet(dataSourceName, "invitation_id"), diff --git a/internal/service/projectinvitation/resource_project_invitation.go b/internal/service/projectinvitation/resource_project_invitation.go index 744d4d4f26..4172d0081e 100644 --- a/internal/service/projectinvitation/resource_project_invitation.go +++ b/internal/service/projectinvitation/resource_project_invitation.go @@ -11,7 +11,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func Resource() *schema.Resource { diff --git a/internal/service/projectinvitation/resource_project_invitation_migration_test.go b/internal/service/projectinvitation/resource_project_invitation_migration_test.go index 3feadfad2a..2e94f92b24 100644 --- a/internal/service/projectinvitation/resource_project_invitation_migration_test.go +++ b/internal/service/projectinvitation/resource_project_invitation_migration_test.go @@ -26,7 +26,7 @@ func TestMigProjectInvitation_basic(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: configBasic(orgID, projectName, name, roles), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "invitation_id"), diff --git a/internal/service/projectinvitation/resource_project_invitation_test.go b/internal/service/projectinvitation/resource_project_invitation_test.go index d9a8c04328..ea16af94b2 100644 --- a/internal/service/projectinvitation/resource_project_invitation_test.go +++ b/internal/service/projectinvitation/resource_project_invitation_test.go @@ -30,7 +30,7 @@ func TestAccProjectRSProjectInvitation_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(orgID, projectName, name, initialRole), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "invitation_id"), @@ -41,7 +41,7 @@ func TestAccProjectRSProjectInvitation_basic(t *testing.T) { }, { Config: configBasic(orgID, projectName, name, updateRoles), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "invitation_id"), diff --git a/internal/service/projectipaccesslist/model_project_ip_access_list.go b/internal/service/projectipaccesslist/model_project_ip_access_list.go index 0d1facee88..a33e77c34f 100644 --- a/internal/service/projectipaccesslist/model_project_ip_access_list.go +++ b/internal/service/projectipaccesslist/model_project_ip_access_list.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func NewMongoDBProjectIPAccessList(projectIPAccessListModel *TfProjectIPAccessListModel) *[]admin.NetworkPermissionEntry { diff --git a/internal/service/projectipaccesslist/model_project_ip_access_list_test.go b/internal/service/projectipaccesslist/model_project_ip_access_list_test.go index 1567020a18..282939b0a6 100644 --- a/internal/service/projectipaccesslist/model_project_ip_access_list_test.go +++ b/internal/service/projectipaccesslist/model_project_ip_access_list_test.go @@ -9,7 +9,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/service/projectipaccesslist" "github.com/stretchr/testify/assert" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) var ( diff --git a/internal/service/projectipaccesslist/resource_project_ip_access_list.go b/internal/service/projectipaccesslist/resource_project_ip_access_list.go index 2027573cbe..07b91ffdfc 100644 --- a/internal/service/projectipaccesslist/resource_project_ip_access_list.go +++ b/internal/service/projectipaccesslist/resource_project_ip_access_list.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" diff --git a/internal/service/projectipaccesslist/resource_project_ip_access_list_migration_test.go b/internal/service/projectipaccesslist/resource_project_ip_access_list_migration_test.go index 6ea5b910aa..fbe39659b2 100644 --- a/internal/service/projectipaccesslist/resource_project_ip_access_list_migration_test.go +++ b/internal/service/projectipaccesslist/resource_project_ip_access_list_migration_test.go @@ -25,7 +25,7 @@ func TestMigProjectIPAccessList_settingIPAddress(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc(commonChecks(ipAddress, "", "", comment)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks(ipAddress, "", "", comment)...), }, mig.TestStepCheckEmptyPlan(config), }, @@ -47,7 +47,7 @@ func TestMigProjectIPAccessList_settingCIDRBlock(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc(commonChecks("", cidrBlock, "", comment)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks("", cidrBlock, "", comment)...), }, mig.TestStepCheckEmptyPlan(config), }, @@ -75,7 +75,7 @@ func TestMigProjectIPAccessList_settingAWSSecurityGroup(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc(commonChecks("", "", awsSGroup, comment)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks("", "", awsSGroup, comment)...), }, mig.TestStepCheckEmptyPlan(config), }, diff --git a/internal/service/projectipaccesslist/resource_project_ip_access_list_test.go b/internal/service/projectipaccesslist/resource_project_ip_access_list_test.go index 855281a0e4..b75d5f6f1f 100644 --- a/internal/service/projectipaccesslist/resource_project_ip_access_list_test.go +++ b/internal/service/projectipaccesslist/resource_project_ip_access_list_test.go @@ -35,11 +35,11 @@ func TestAccProjectIPAccesslist_settingIPAddress(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithIPAddress(projectID, ipAddress, comment), - Check: resource.ComposeTestCheckFunc(commonChecks(ipAddress, "", "", comment)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks(ipAddress, "", "", comment)...), }, { Config: configWithIPAddress(projectID, updatedIPAddress, updatedComment), - Check: resource.ComposeTestCheckFunc(commonChecks(updatedIPAddress, "", "", updatedComment)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks(updatedIPAddress, "", "", updatedComment)...), }, { ResourceName: resourceName, @@ -67,11 +67,11 @@ func TestAccProjectIPAccessList_settingCIDRBlock(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithCIDRBlock(projectID, cidrBlock, comment), - Check: resource.ComposeTestCheckFunc(commonChecks("", cidrBlock, "", comment)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks("", cidrBlock, "", comment)...), }, { Config: configWithCIDRBlock(projectID, updatedCIDRBlock, updatedComment), - Check: resource.ComposeTestCheckFunc(commonChecks("", updatedCIDRBlock, "", updatedComment)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks("", updatedCIDRBlock, "", updatedComment)...), }, }, }) @@ -98,11 +98,11 @@ func TestAccProjectIPAccessList_settingAWSSecurityGroup(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithAWSSecurityGroup(projectID, providerName, vpcID, awsAccountID, vpcCIDRBlock, awsRegion, awsSGroup, comment), - Check: resource.ComposeTestCheckFunc(commonChecks("", "", awsSGroup, comment)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks("", "", awsSGroup, comment)...), }, { Config: configWithAWSSecurityGroup(projectID, providerName, vpcID, awsAccountID, vpcCIDRBlock, awsRegion, updatedAWSSgroup, updatedComment), - Check: resource.ComposeTestCheckFunc(commonChecks("", "", updatedAWSSgroup, updatedComment)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks("", "", updatedAWSSgroup, updatedComment)...), }, }, }) @@ -144,11 +144,11 @@ func TestAccProjectIPAccessList_settingMultiple(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithMultiple(projectID, accessList, false), - Check: resource.ComposeTestCheckFunc(checks...), + Check: resource.ComposeAggregateTestCheckFunc(checks...), }, { Config: configWithMultiple(projectID, accessList, true), - Check: resource.ComposeTestCheckFunc(checks...), + Check: resource.ComposeAggregateTestCheckFunc(checks...), }, }, }) diff --git a/internal/service/pushbasedlogexport/model.go b/internal/service/pushbasedlogexport/model.go index 8dabfd31b5..c32f52e514 100644 --- a/internal/service/pushbasedlogexport/model.go +++ b/internal/service/pushbasedlogexport/model.go @@ -3,7 +3,7 @@ package pushbasedlogexport import ( "context" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts" "github.com/hashicorp/terraform-plugin-framework/diag" diff --git a/internal/service/pushbasedlogexport/model_test.go b/internal/service/pushbasedlogexport/model_test.go index b08f339ff5..10e1678d18 100644 --- a/internal/service/pushbasedlogexport/model_test.go +++ b/internal/service/pushbasedlogexport/model_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts" "github.com/hashicorp/terraform-plugin-framework/types" diff --git a/internal/service/pushbasedlogexport/resource.go b/internal/service/pushbasedlogexport/resource.go index 5a20ffa19f..aad810d34c 100644 --- a/internal/service/pushbasedlogexport/resource.go +++ b/internal/service/pushbasedlogexport/resource.go @@ -7,7 +7,7 @@ import ( "slices" "time" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" diff --git a/internal/service/pushbasedlogexport/resource_test.go b/internal/service/pushbasedlogexport/resource_test.go index 3e25bbe489..a74f237922 100644 --- a/internal/service/pushbasedlogexport/resource_test.go +++ b/internal/service/pushbasedlogexport/resource_test.go @@ -45,11 +45,11 @@ func basicTestCase(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configBasic(projectID, s3BucketName1, s3BucketName2, s3BucketPolicyName, awsIAMRoleName, awsIAMRolePolicyName, nonEmptyPrefixPath, true), - Check: resource.ComposeTestCheckFunc(commonChecks(s3BucketName1, nonEmptyPrefixPath)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks(s3BucketName1, nonEmptyPrefixPath)...), }, { Config: configBasicUpdated(projectID, s3BucketName1, s3BucketName2, s3BucketPolicyName, awsIAMRoleName, awsIAMRolePolicyName, nonEmptyPrefixPath, true), - Check: resource.ComposeTestCheckFunc(commonChecks(s3BucketName2, nonEmptyPrefixPath)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks(s3BucketName2, nonEmptyPrefixPath)...), }, { Config: configBasicUpdated(projectID, s3BucketName1, s3BucketName2, s3BucketPolicyName, awsIAMRoleName, awsIAMRolePolicyName, nonEmptyPrefixPath, true), @@ -87,7 +87,7 @@ func noPrefixPathTestCase(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configBasic(projectID, s3BucketName1, s3BucketName2, s3BucketPolicyName, awsIAMRoleName, awsIAMRolePolicyName, defaultPrefixPath, false), - Check: resource.ComposeTestCheckFunc(commonChecks(s3BucketName1, defaultPrefixPath)...), + Check: resource.ComposeAggregateTestCheckFunc(commonChecks(s3BucketName1, defaultPrefixPath)...), }, }, } diff --git a/internal/service/pushbasedlogexport/state_transition.go b/internal/service/pushbasedlogexport/state_transition.go index b04d8b43fd..3286736b13 100644 --- a/internal/service/pushbasedlogexport/state_transition.go +++ b/internal/service/pushbasedlogexport/state_transition.go @@ -5,7 +5,7 @@ import ( "errors" "fmt" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" diff --git a/internal/service/pushbasedlogexport/state_transition_test.go b/internal/service/pushbasedlogexport/state_transition_test.go index 492f826a61..137d774d6e 100644 --- a/internal/service/pushbasedlogexport/state_transition_test.go +++ b/internal/service/pushbasedlogexport/state_transition_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - "go.mongodb.org/atlas-sdk/v20231115014/admin" - "go.mongodb.org/atlas-sdk/v20231115014/mockadmin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" + "go.mongodb.org/atlas-sdk/v20240530002/mockadmin" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" diff --git a/internal/service/searchdeployment/model_search_deployment.go b/internal/service/searchdeployment/model_search_deployment.go index e6c60bdf43..c6f80c5f1f 100644 --- a/internal/service/searchdeployment/model_search_deployment.go +++ b/internal/service/searchdeployment/model_search_deployment.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts" "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/types" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func NewSearchDeploymentReq(ctx context.Context, searchDeploymentPlan *TFSearchDeploymentRSModel) admin.ApiSearchDeploymentRequest { diff --git a/internal/service/searchdeployment/model_search_deployment_test.go b/internal/service/searchdeployment/model_search_deployment_test.go index a9d10c3978..643c3dd458 100644 --- a/internal/service/searchdeployment/model_search_deployment_test.go +++ b/internal/service/searchdeployment/model_search_deployment_test.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" "github.com/mongodb/terraform-provider-mongodbatlas/internal/service/searchdeployment" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) type sdkToTFModelTestCase struct { diff --git a/internal/service/searchdeployment/resource_search_deployment.go b/internal/service/searchdeployment/resource_search_deployment.go index 69a28ad9bc..db4cf8091e 100644 --- a/internal/service/searchdeployment/resource_search_deployment.go +++ b/internal/service/searchdeployment/resource_search_deployment.go @@ -154,7 +154,7 @@ func (r *searchDeploymentRS) Delete(ctx context.Context, req resource.DeleteRequ connV2 := r.Client.AtlasV2 projectID := searchDeploymentState.ProjectID.ValueString() clusterName := searchDeploymentState.ClusterName.ValueString() - if _, err := connV2.AtlasSearchApi.DeleteAtlasSearchDeployment(ctx, projectID, clusterName).Execute(); err != nil { + if _, _, err := connV2.AtlasSearchApi.DeleteAtlasSearchDeployment(ctx, projectID, clusterName).Execute(); err != nil { resp.Diagnostics.AddError("error during search deployment delete", err.Error()) return } diff --git a/internal/service/searchdeployment/resource_search_deployment_migration_test.go b/internal/service/searchdeployment/resource_search_deployment_migration_test.go index f08c0ed778..a01ccbe89a 100644 --- a/internal/service/searchdeployment/resource_search_deployment_migration_test.go +++ b/internal/service/searchdeployment/resource_search_deployment_migration_test.go @@ -27,7 +27,7 @@ func TestMigSearchDeployment_basic(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc(searchNodeChecks(resourceName, clusterName, instanceSize, searchNodeCount)...), + Check: resource.ComposeAggregateTestCheckFunc(searchNodeChecks(resourceName, clusterName, instanceSize, searchNodeCount)...), }, mig.TestStepCheckEmptyPlan(config), }, diff --git a/internal/service/searchdeployment/resource_search_deployment_test.go b/internal/service/searchdeployment/resource_search_deployment_test.go index c6538a2b7e..8e1ad8da5a 100644 --- a/internal/service/searchdeployment/resource_search_deployment_test.go +++ b/internal/service/searchdeployment/resource_search_deployment_test.go @@ -41,7 +41,7 @@ func newSearchNodeTestStep(resourceName, orgID, projectName, clusterName, instan dataSourceChecks := searchNodeChecks(fmt.Sprintf("data.%s", resourceName), clusterName, instanceSize, searchNodeCount) return resource.TestStep{ Config: configBasic(orgID, projectName, clusterName, instanceSize, searchNodeCount), - Check: resource.ComposeTestCheckFunc(append(resourceChecks, dataSourceChecks...)...), + Check: resource.ComposeAggregateTestCheckFunc(append(resourceChecks, dataSourceChecks...)...), } } diff --git a/internal/service/searchdeployment/state_transition_search_deployment.go b/internal/service/searchdeployment/state_transition_search_deployment.go index 3754c0a77f..3ba981c451 100644 --- a/internal/service/searchdeployment/state_transition_search_deployment.go +++ b/internal/service/searchdeployment/state_transition_search_deployment.go @@ -10,10 +10,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/retrystrategy" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) -const SearchDeploymentDoesNotExistsError = "ATLAS_FTS_DEPLOYMENT_DOES_NOT_EXIST" +const SearchDeploymentDoesNotExistsError = "ATLAS_SEARCH_DEPLOYMENT_DOES_NOT_EXIST" func WaitSearchNodeStateTransition(ctx context.Context, projectID, clusterName string, client admin.AtlasSearchApi, timeConfig retrystrategy.TimeConfig) (*admin.ApiSearchDeploymentResponse, error) { @@ -56,7 +56,7 @@ func searchDeploymentRefreshFunc(ctx context.Context, projectID, clusterName str return nil, "", err } if err != nil { - if resp.StatusCode == 400 && strings.Contains(err.Error(), SearchDeploymentDoesNotExistsError) { + if resp.StatusCode == 404 && strings.Contains(err.Error(), SearchDeploymentDoesNotExistsError) { return "", retrystrategy.RetryStrategyDeletedState, nil } if resp.StatusCode == 503 { diff --git a/internal/service/searchdeployment/state_transition_search_deployment_test.go b/internal/service/searchdeployment/state_transition_search_deployment_test.go index 12eba44218..21511e0d95 100644 --- a/internal/service/searchdeployment/state_transition_search_deployment_test.go +++ b/internal/service/searchdeployment/state_transition_search_deployment_test.go @@ -12,15 +12,15 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/service/searchdeployment" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" - "go.mongodb.org/atlas-sdk/v20231115014/admin" - "go.mongodb.org/atlas-sdk/v20231115014/mockadmin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" + "go.mongodb.org/atlas-sdk/v20240530002/mockadmin" ) var ( updating = "UPDATING" idle = "IDLE" unknown = "" - sc400 = conversion.IntPtr(400) + sc404 = conversion.IntPtr(404) sc500 = conversion.IntPtr(500) sc503 = conversion.IntPtr(503) ) @@ -94,7 +94,7 @@ func TestSearchDeploymentStateTransitionForDelete(t *testing.T) { name: "Regular transition to DELETED", mockResponses: []response{ {state: &updating}, - {statusCode: sc400, err: errors.New(searchdeployment.SearchDeploymentDoesNotExistsError)}, + {statusCode: sc404, err: errors.New(searchdeployment.SearchDeploymentDoesNotExistsError)}, }, expectedError: false, }, diff --git a/internal/service/searchindex/data_source_search_index.go b/internal/service/searchindex/data_source_search_index.go index 529a0417dd..3283ff1c8c 100644 --- a/internal/service/searchindex/data_source_search_index.go +++ b/internal/service/searchindex/data_source_search_index.go @@ -123,11 +123,11 @@ func dataSourceMongoDBAtlasSearchIndexRead(ctx context.Context, d *schema.Resour return diag.Errorf("error setting `index_id` for search index (%s): %s", d.Id(), err) } - if err := d.Set("analyzer", searchIndex.Analyzer); err != nil { + if err := d.Set("analyzer", searchIndex.LatestDefinition.Analyzer); err != nil { return diag.Errorf("error setting `analyzer` for search index (%s): %s", d.Id(), err) } - if analyzers := searchIndex.GetAnalyzers(); len(analyzers) > 0 { + if analyzers := searchIndex.LatestDefinition.GetAnalyzers(); len(analyzers) > 0 { searchIndexMappingFields, err := marshalSearchIndex(analyzers) if err != nil { return diag.FromErr(err) @@ -150,21 +150,21 @@ func dataSourceMongoDBAtlasSearchIndexRead(ctx context.Context, d *schema.Resour return diag.Errorf("error setting `name` for search index (%s): %s", d.Id(), err) } - if err := d.Set("search_analyzer", searchIndex.SearchAnalyzer); err != nil { + if err := d.Set("search_analyzer", searchIndex.LatestDefinition.SearchAnalyzer); err != nil { return diag.Errorf("error setting `searchAnalyzer` for search index (%s): %s", d.Id(), err) } - if err := d.Set("synonyms", flattenSearchIndexSynonyms(searchIndex.GetSynonyms())); err != nil { + if err := d.Set("synonyms", flattenSearchIndexSynonyms(searchIndex.LatestDefinition.GetSynonyms())); err != nil { return diag.Errorf("error setting `synonyms` for search index (%s): %s", d.Id(), err) } - if searchIndex.Mappings != nil { - if err := d.Set("mappings_dynamic", searchIndex.Mappings.Dynamic); err != nil { + if searchIndex.LatestDefinition.Mappings != nil { + if err := d.Set("mappings_dynamic", searchIndex.LatestDefinition.Mappings.Dynamic); err != nil { return diag.Errorf("error setting `mappings_dynamic` for search index (%s): %s", d.Id(), err) } - if len(searchIndex.Mappings.Fields) > 0 { - searchIndexMappingFields, err := marshalSearchIndex(searchIndex.Mappings.Fields) + if conversion.HasElementsSliceOrMap(searchIndex.LatestDefinition.Mappings.Fields) { + searchIndexMappingFields, err := marshalSearchIndex(searchIndex.LatestDefinition.Mappings.Fields) if err != nil { return diag.FromErr(err) } @@ -174,7 +174,7 @@ func dataSourceMongoDBAtlasSearchIndexRead(ctx context.Context, d *schema.Resour } } - if fields := searchIndex.GetFields(); len(fields) > 0 { + if fields := searchIndex.LatestDefinition.GetFields(); len(fields) > 0 { fieldsMarshaled, err := marshalSearchIndex(fields) if err != nil { return diag.FromErr(err) diff --git a/internal/service/searchindex/data_source_search_indexes.go b/internal/service/searchindex/data_source_search_indexes.go index ed65969d97..63a272af64 100644 --- a/internal/service/searchindex/data_source_search_indexes.go +++ b/internal/service/searchindex/data_source_search_indexes.go @@ -6,8 +6,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func PluralDataSource() *schema.Resource { @@ -80,7 +81,7 @@ func dataSourceMongoDBAtlasSearchIndexesRead(ctx context.Context, d *schema.Reso return nil } -func flattenSearchIndexes(searchIndexes []admin.ClusterSearchIndex, projectID, clusterName string) ([]map[string]any, error) { +func flattenSearchIndexes(searchIndexes []admin.SearchIndexResponse, projectID, clusterName string) ([]map[string]any, error) { var searchIndexesMap []map[string]any if len(searchIndexes) == 0 { @@ -92,22 +93,22 @@ func flattenSearchIndexes(searchIndexes []admin.ClusterSearchIndex, projectID, c searchIndexesMap[i] = map[string]any{ "project_id": projectID, "cluster_name": clusterName, - "analyzer": searchIndexes[i].Analyzer, + "analyzer": searchIndexes[i].LatestDefinition.Analyzer, "collection_name": searchIndexes[i].CollectionName, "database": searchIndexes[i].Database, "index_id": searchIndexes[i].IndexID, "name": searchIndexes[i].Name, - "search_analyzer": searchIndexes[i].SearchAnalyzer, + "search_analyzer": searchIndexes[i].LatestDefinition.SearchAnalyzer, "status": searchIndexes[i].Status, - "synonyms": flattenSearchIndexSynonyms(searchIndexes[i].GetSynonyms()), + "synonyms": flattenSearchIndexSynonyms(searchIndexes[i].LatestDefinition.GetSynonyms()), "type": searchIndexes[i].Type, } - if searchIndexes[i].Mappings != nil { - searchIndexesMap[i]["mappings_dynamic"] = searchIndexes[i].Mappings.Dynamic + if searchIndexes[i].LatestDefinition.Mappings != nil { + searchIndexesMap[i]["mappings_dynamic"] = searchIndexes[i].LatestDefinition.Mappings.Dynamic - if len(searchIndexes[i].Mappings.Fields) > 0 { - searchIndexMappingFields, err := marshalSearchIndex(searchIndexes[i].Mappings.Fields) + if conversion.HasElementsSliceOrMap(searchIndexes[i].LatestDefinition.Mappings.Fields) { + searchIndexMappingFields, err := marshalSearchIndex(searchIndexes[i].LatestDefinition.Mappings.Fields) if err != nil { return nil, err } @@ -115,7 +116,7 @@ func flattenSearchIndexes(searchIndexes []admin.ClusterSearchIndex, projectID, c } } - if analyzers := searchIndexes[i].GetAnalyzers(); len(analyzers) > 0 { + if analyzers := searchIndexes[i].LatestDefinition.GetAnalyzers(); len(analyzers) > 0 { searchIndexAnalyzers, err := marshalSearchIndex(analyzers) if err != nil { return nil, err @@ -123,7 +124,7 @@ func flattenSearchIndexes(searchIndexes []admin.ClusterSearchIndex, projectID, c searchIndexesMap[i]["analyzers"] = searchIndexAnalyzers } - if fields := searchIndexes[i].GetFields(); len(fields) > 0 { + if fields := searchIndexes[i].LatestDefinition.GetFields(); len(fields) > 0 { fieldsMarshaled, err := marshalSearchIndex(fields) if err != nil { return nil, err diff --git a/internal/service/searchindex/resource_search_index.go b/internal/service/searchindex/resource_search_index.go index 36655a99c3..72f0d0b783 100644 --- a/internal/service/searchindex/resource_search_index.go +++ b/internal/service/searchindex/resource_search_index.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( @@ -187,34 +187,34 @@ func resourceUpdate(ctx context.Context, d *schema.ResourceData, meta any) diag. projectID := ids["project_id"] clusterName := ids["cluster_name"] indexID := ids["index_id"] + indexName := d.Get("name").(string) - searchIndex, _, err := connV2.AtlasSearchApi.GetAtlasSearchIndex(ctx, projectID, clusterName, indexID).Execute() + if d.HasChange("name") || d.HasChange("type") || d.HasChange("database") || d.HasChange("collection_name") { + return diag.Errorf("error updating search index (%s): attributes name, type, database and collection_name can't be updated", indexName) + } + + searchRead, _, err := connV2.AtlasSearchApi.GetAtlasSearchIndex(ctx, projectID, clusterName, indexID).Execute() if err != nil { return diag.Errorf("error getting search index information: %s", err) } - - if d.HasChange("type") { - searchIndex.Type = conversion.StringPtr(d.Get("type").(string)) + searchIndex := &admin.SearchIndexUpdateRequest{ + Definition: admin.SearchIndexUpdateRequestDefinition{ + Analyzer: searchRead.LatestDefinition.Analyzer, + Analyzers: searchRead.LatestDefinition.Analyzers, + Mappings: searchRead.LatestDefinition.Mappings, + SearchAnalyzer: searchRead.LatestDefinition.SearchAnalyzer, + StoredSource: searchRead.LatestDefinition.StoredSource, + Synonyms: searchRead.LatestDefinition.Synonyms, + Fields: searchRead.LatestDefinition.Fields, + }, } if d.HasChange("analyzer") { - searchIndex.Analyzer = conversion.StringPtr(d.Get("analyzer").(string)) - } - - if d.HasChange("collection_name") { - searchIndex.CollectionName = d.Get("collection_name").(string) - } - - if d.HasChange("database") { - searchIndex.Database = d.Get("database").(string) - } - - if d.HasChange("name") { - searchIndex.Name = d.Get("name").(string) + searchIndex.Definition.Analyzer = conversion.StringPtr(d.Get("analyzer").(string)) } if d.HasChange("search_analyzer") { - searchIndex.SearchAnalyzer = conversion.StringPtr(d.Get("search_analyzer").(string)) + searchIndex.Definition.SearchAnalyzer = conversion.StringPtr(d.Get("search_analyzer").(string)) } if d.HasChange("analyzers") { @@ -222,15 +222,15 @@ func resourceUpdate(ctx context.Context, d *schema.ResourceData, meta any) diag. if err != nil { return err } - searchIndex.Analyzers = &analyzers + searchIndex.Definition.Analyzers = &analyzers } if d.HasChange("mappings_dynamic") { dynamic := d.Get("mappings_dynamic").(bool) - if searchIndex.Mappings == nil { - searchIndex.Mappings = &admin.ApiAtlasFTSMappings{} + if searchIndex.Definition.Mappings == nil { + searchIndex.Definition.Mappings = &admin.SearchMappings{} } - searchIndex.Mappings.Dynamic = &dynamic + searchIndex.Definition.Mappings.Dynamic = &dynamic } if d.HasChange("mappings_fields") { @@ -238,10 +238,10 @@ func resourceUpdate(ctx context.Context, d *schema.ResourceData, meta any) diag. if err != nil { return err } - if searchIndex.Mappings == nil { - searchIndex.Mappings = &admin.ApiAtlasFTSMappings{} + if searchIndex.Definition.Mappings == nil { + searchIndex.Definition.Mappings = &admin.SearchMappings{} } - searchIndex.Mappings.Fields = mappingsFields + searchIndex.Definition.Mappings.Fields = mappingsFields } if d.HasChange("fields") { @@ -249,17 +249,16 @@ func resourceUpdate(ctx context.Context, d *schema.ResourceData, meta any) diag. if err != nil { return err } - searchIndex.Fields = &fields + searchIndex.Definition.Fields = conversion.ToAnySlicePointer(&fields) } if d.HasChange("synonyms") { synonyms := expandSearchIndexSynonyms(d) - searchIndex.Synonyms = &synonyms + searchIndex.Definition.Synonyms = &synonyms } - searchIndex.IndexID = conversion.StringPtr("") if _, _, err := connV2.AtlasSearchApi.UpdateAtlasSearchIndex(ctx, projectID, clusterName, indexID, searchIndex).Execute(); err != nil { - return diag.Errorf("error updating search index (%s): %s", searchIndex.Name, err) + return diag.Errorf("error updating search index (%s): %s", indexName, err) } if d.Get("wait_for_index_build_completion").(bool) { @@ -274,8 +273,7 @@ func resourceUpdate(ctx context.Context, d *schema.ResourceData, meta any) diag. } // Wait, catching any errors - _, err = stateConf.WaitForStateContext(ctx) - if err != nil { + if _, err := stateConf.WaitForStateContext(ctx); err != nil { d.SetId(conversion.EncodeStateID(map[string]string{ "project_id": projectID, "cluster_name": clusterName, @@ -313,11 +311,11 @@ func resourceRead(ctx context.Context, d *schema.ResourceData, meta any) diag.Di return diag.Errorf("error setting `type` for search index (%s): %s", d.Id(), err) } - if err := d.Set("analyzer", searchIndex.Analyzer); err != nil { + if err := d.Set("analyzer", searchIndex.LatestDefinition.Analyzer); err != nil { return diag.Errorf("error setting `analyzer` for search index (%s): %s", d.Id(), err) } - if analyzers := searchIndex.GetAnalyzers(); len(analyzers) > 0 { + if analyzers := searchIndex.LatestDefinition.GetAnalyzers(); len(analyzers) > 0 { searchIndexMappingFields, err := marshalSearchIndex(analyzers) if err != nil { return diag.FromErr(err) @@ -339,21 +337,21 @@ func resourceRead(ctx context.Context, d *schema.ResourceData, meta any) diag.Di return diag.Errorf("error setting `name` for search index (%s): %s", d.Id(), err) } - if err := d.Set("search_analyzer", searchIndex.SearchAnalyzer); err != nil { + if err := d.Set("search_analyzer", searchIndex.LatestDefinition.SearchAnalyzer); err != nil { return diag.Errorf("error setting `searchAnalyzer` for search index (%s): %s", d.Id(), err) } - if err := d.Set("synonyms", flattenSearchIndexSynonyms(searchIndex.GetSynonyms())); err != nil { + if err := d.Set("synonyms", flattenSearchIndexSynonyms(searchIndex.LatestDefinition.GetSynonyms())); err != nil { return diag.Errorf("error setting `synonyms` for search index (%s): %s", d.Id(), err) } - if searchIndex.Mappings != nil { - if err := d.Set("mappings_dynamic", searchIndex.Mappings.Dynamic); err != nil { + if searchIndex.LatestDefinition.Mappings != nil { + if err := d.Set("mappings_dynamic", searchIndex.LatestDefinition.Mappings.Dynamic); err != nil { return diag.Errorf("error setting `mappings_dynamic` for search index (%s): %s", d.Id(), err) } - if len(searchIndex.Mappings.Fields) > 0 { - searchIndexMappingFields, err := marshalSearchIndex(searchIndex.Mappings.Fields) + if conversion.HasElementsSliceOrMap(searchIndex.LatestDefinition.Mappings.Fields) { + searchIndexMappingFields, err := marshalSearchIndex(searchIndex.LatestDefinition.Mappings.Fields) if err != nil { return diag.FromErr(err) } @@ -363,7 +361,7 @@ func resourceRead(ctx context.Context, d *schema.ResourceData, meta any) diag.Di } } - if fields := searchIndex.GetFields(); len(fields) > 0 { + if fields := searchIndex.LatestDefinition.GetFields(); len(fields) > 0 { fieldsMarshaled, err := marshalSearchIndex(fields) if err != nil { return diag.FromErr(err) @@ -398,13 +396,15 @@ func resourceCreate(ctx context.Context, d *schema.ResourceData, meta any) diag. projectID := d.Get("project_id").(string) clusterName := d.Get("cluster_name").(string) indexType := d.Get("type").(string) - searchIndexRequest := &admin.ClusterSearchIndex{ + searchIndexRequest := &admin.SearchIndexCreateRequest{ Type: conversion.StringPtr(indexType), - Analyzer: conversion.StringPtr(d.Get("analyzer").(string)), CollectionName: d.Get("collection_name").(string), Database: d.Get("database").(string), Name: d.Get("name").(string), - SearchAnalyzer: conversion.StringPtr(d.Get("search_analyzer").(string)), + Definition: &admin.BaseSearchIndexCreateRequestDefinition{ + Analyzer: conversion.StringPtr(d.Get("analyzer").(string)), + SearchAnalyzer: conversion.StringPtr(d.Get("search_analyzer").(string)), + }, } if indexType == vectorSearch { @@ -412,24 +412,24 @@ func resourceCreate(ctx context.Context, d *schema.ResourceData, meta any) diag. if err != nil { return err } - searchIndexRequest.Fields = &fields + searchIndexRequest.Definition.Fields = conversion.ToAnySlicePointer(&fields) } else { analyzers, err := unmarshalSearchIndexAnalyzersFields(d.Get("analyzers").(string)) if err != nil { return err } - searchIndexRequest.Analyzers = &analyzers + searchIndexRequest.Definition.Analyzers = &analyzers mappingsFields, err := unmarshalSearchIndexMappingFields(d.Get("mappings_fields").(string)) if err != nil { return err } dynamic := d.Get("mappings_dynamic").(bool) - searchIndexRequest.Mappings = &admin.ApiAtlasFTSMappings{ + searchIndexRequest.Definition.Mappings = &admin.SearchMappings{ Dynamic: &dynamic, Fields: mappingsFields, } synonyms := expandSearchIndexSynonyms(d) - searchIndexRequest.Synonyms = &synonyms + searchIndexRequest.Definition.Synonyms = &synonyms } dbSearchIndexRes, _, err := connV2.AtlasSearchApi.CreateAtlasSearchIndex(ctx, projectID, clusterName, searchIndexRequest).Execute() @@ -561,8 +561,8 @@ func unmarshalSearchIndexFields(str string) ([]map[string]any, diag.Diagnostics) return fields, nil } -func unmarshalSearchIndexAnalyzersFields(str string) ([]admin.ApiAtlasFTSAnalyzers, diag.Diagnostics) { - fields := []admin.ApiAtlasFTSAnalyzers{} +func unmarshalSearchIndexAnalyzersFields(str string) ([]admin.AtlasSearchAnalyzer, diag.Diagnostics) { + fields := []admin.AtlasSearchAnalyzer{} if str == "" { return fields, nil } diff --git a/internal/service/searchindex/resource_search_index_test.go b/internal/service/searchindex/resource_search_index_test.go index 3de5f30d99..d0edb9cc84 100644 --- a/internal/service/searchindex/resource_search_index_test.go +++ b/internal/service/searchindex/resource_search_index_test.go @@ -20,18 +20,15 @@ func TestAccSearchIndex_withSearchType(t *testing.T) { projectID, clusterName = acc.ClusterNameExecution(t) indexName = acc.RandomName() databaseName = acc.RandomName() - indexType = "search" - mappingsDynamic = "true" ) - checks := commonChecks(indexName, indexType, mappingsDynamic, databaseName, clusterName) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acc.PreCheckBasic(t) }, ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroySearchIndex, Steps: []resource.TestStep{ { - Config: configBasic(projectID, indexName, databaseName, clusterName, true), - Check: resource.ComposeTestCheckFunc(checks...), + Config: configBasic(projectID, clusterName, indexName, "search", databaseName), + Check: checkBasic(projectID, clusterName, indexName, "search", databaseName), }, }, }) @@ -42,11 +39,7 @@ func TestAccSearchIndex_withMapping(t *testing.T) { projectID, clusterName = acc.ClusterNameExecution(t) indexName = acc.RandomName() databaseName = acc.RandomName() - indexType = "" - mappingsDynamic = "false" ) - checks := commonChecks(indexName, indexType, mappingsDynamic, databaseName, clusterName) - checks = addAttrSetChecks(checks, "mappings_fields", "analyzers") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acc.PreCheckBasic(t) }, ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, @@ -54,7 +47,7 @@ func TestAccSearchIndex_withMapping(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithMapping(projectID, indexName, databaseName, clusterName), - Check: resource.ComposeTestCheckFunc(checks...), + Check: checkWithMapping(projectID, indexName, databaseName, clusterName), }, }, }) @@ -65,18 +58,7 @@ func TestAccSearchIndex_withSynonyms(t *testing.T) { projectID, clusterName = acc.ClusterNameExecution(t) indexName = acc.RandomName() databaseName = acc.RandomName() - indexType = "" - mappingsDynamic = "true" - mapChecks = map[string]string{ - "synonyms.#": "1", - "synonyms.0.analyzer": "lucene.simple", - "synonyms.0.name": "synonym_test", - "synonyms.0.source_collection": collectionName, - } ) - checks := commonChecks(indexName, indexType, mappingsDynamic, databaseName, clusterName) - checks = addAttrChecks(checks, mapChecks) - resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acc.PreCheckBasic(t) }, ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, @@ -84,7 +66,7 @@ func TestAccSearchIndex_withSynonyms(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithSynonyms(projectID, indexName, databaseName, clusterName, with), - Check: resource.ComposeTestCheckFunc(checks...), + Check: checkWithSynonyms(projectID, indexName, databaseName, clusterName, with), }, }, }) @@ -95,17 +77,7 @@ func TestAccSearchIndex_updatedToEmptySynonyms(t *testing.T) { projectID, clusterName = acc.ClusterNameExecution(t) indexName = acc.RandomName() databaseName = acc.RandomName() - indexType = "" - mappingsDynamic = "true" ) - checks := commonChecks(indexName, indexType, mappingsDynamic, databaseName, clusterName) - checks1 := addAttrChecks(checks, map[string]string{ - "synonyms.#": "1", - "synonyms.0.analyzer": "lucene.simple", - "synonyms.0.name": "synonym_test", - "synonyms.0.source_collection": collectionName, - }) - checks2 := addAttrChecks(checks, map[string]string{"synonyms.#": "0"}) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acc.PreCheckBasic(t) }, ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, @@ -113,11 +85,11 @@ func TestAccSearchIndex_updatedToEmptySynonyms(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithSynonyms(projectID, indexName, databaseName, clusterName, with), - Check: resource.ComposeTestCheckFunc(checks1...), + Check: checkWithSynonyms(projectID, indexName, databaseName, clusterName, with), }, { Config: configWithSynonyms(projectID, indexName, databaseName, clusterName, without), - Check: resource.ComposeTestCheckFunc(checks2...), + Check: checkWithSynonyms(projectID, indexName, databaseName, clusterName, without), }, }, }) @@ -136,17 +108,11 @@ func TestAccSearchIndex_updatedToEmptyAnalyzers(t *testing.T) { Steps: []resource.TestStep{ { Config: configAdditional(projectID, indexName, databaseName, clusterName, analyzersTF), - Check: resource.ComposeTestCheckFunc( - checkExists(resourceName), - resource.TestCheckResourceAttrWith(resourceName, "analyzers", acc.JSONEquals(analyzersJSON)), - ), + Check: checkAdditionalAnalyzers(projectID, indexName, databaseName, clusterName, true), }, { Config: configAdditional(projectID, indexName, databaseName, clusterName, ""), - Check: resource.ComposeTestCheckFunc( - checkExists(resourceName), - resource.TestCheckResourceAttr(resourceName, "analyzers", ""), - ), + Check: checkAdditionalAnalyzers(projectID, indexName, databaseName, clusterName, false), }, }, }) @@ -165,17 +131,11 @@ func TestAccSearchIndex_updatedToEmptyMappingsFields(t *testing.T) { Steps: []resource.TestStep{ { Config: configAdditional(projectID, indexName, databaseName, clusterName, mappingsFieldsTF), - Check: resource.ComposeTestCheckFunc( - checkExists(resourceName), - resource.TestCheckResourceAttrWith(resourceName, "mappings_fields", acc.JSONEquals(mappingsFieldsJSON)), - ), + Check: checkAdditionalMappingsFields(projectID, indexName, databaseName, clusterName, true), }, { Config: configAdditional(projectID, indexName, databaseName, clusterName, ""), - Check: resource.ComposeTestCheckFunc( - checkExists(resourceName), - resource.TestCheckResourceAttr(resourceName, "mappings_fields", ""), - ), + Check: checkAdditionalMappingsFields(projectID, indexName, databaseName, clusterName, false), }, }, }) @@ -191,22 +151,18 @@ func basicTestCase(tb testing.TB) *resource.TestCase { projectID, clusterName = acc.ClusterNameExecution(tb) indexName = acc.RandomName() databaseName = acc.RandomName() - indexType = "" - mappingsDynamic = "true" ) - checks := commonChecks(indexName, indexType, mappingsDynamic, databaseName, clusterName) - return &resource.TestCase{ PreCheck: func() { acc.PreCheckBasic(tb) }, ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroySearchIndex, Steps: []resource.TestStep{ { - Config: configBasic(projectID, indexName, databaseName, clusterName, false), - Check: resource.ComposeTestCheckFunc(checks...), + Config: configBasic(projectID, clusterName, indexName, "", databaseName), + Check: checkBasic(projectID, clusterName, indexName, "", databaseName), }, { - Config: configBasic(projectID, indexName, databaseName, clusterName, false), + Config: configBasic(projectID, clusterName, indexName, "", databaseName), ResourceName: resourceName, ImportStateIdFunc: importStateIDFunc(resourceName), ImportState: true, @@ -221,21 +177,8 @@ func basicVectorTestCase(tb testing.TB) *resource.TestCase { var ( projectID, clusterName = acc.ClusterNameExecution(tb) indexName = acc.RandomName() - indexType = "vectorSearch" databaseName = acc.RandomName() - attributes = map[string]string{ - "name": indexName, - "cluster_name": clusterName, - "database": databaseName, - "collection_name": collectionName, - "type": indexType, - } ) - checks := addAttrChecks(nil, attributes) - checks = acc.AddAttrSetChecks(resourceName, checks, "project_id") - checks = acc.AddAttrSetChecks(datasourceName, checks, "project_id", "index_id") - checks = append(checks, resource.TestCheckResourceAttrWith(datasourceName, "fields", acc.JSONEquals(fieldsJSON))) - return &resource.TestCase{ PreCheck: func() { acc.PreCheckBasic(tb) }, ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, @@ -243,34 +186,33 @@ func basicVectorTestCase(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configVector(projectID, indexName, databaseName, clusterName), - Check: resource.ComposeTestCheckFunc(checks...), + Check: checkVector(projectID, indexName, databaseName, clusterName), }, }, } } -func commonChecks(indexName, indexType, mappingsDynamic, databaseName, clusterName string) []resource.TestCheckFunc { +func checkAggr(projectID, clusterName, indexName, indexType, databaseName, mappingsDynamic string, extra ...resource.TestCheckFunc) resource.TestCheckFunc { attributes := map[string]string{ - "name": indexName, - "cluster_name": clusterName, - "database": databaseName, - "collection_name": collectionName, - "type": indexType, - "mappings_dynamic": mappingsDynamic, + "project_id": projectID, + "cluster_name": clusterName, + "name": indexName, + "type": indexType, + "database": databaseName, + "collection_name": collectionName, } - checks := addAttrChecks(nil, attributes) - checks = acc.AddAttrSetChecks(resourceName, checks, "project_id") - return acc.AddAttrSetChecks(datasourceName, checks, "project_id", "index_id") -} - -func addAttrChecks(checks []resource.TestCheckFunc, mapChecks map[string]string) []resource.TestCheckFunc { - checks = acc.AddAttrChecks(resourceName, checks, mapChecks) - return acc.AddAttrChecks(datasourceName, checks, mapChecks) -} - -func addAttrSetChecks(checks []resource.TestCheckFunc, attrNames ...string) []resource.TestCheckFunc { - checks = acc.AddAttrSetChecks(resourceName, checks, attrNames...) - return acc.AddAttrSetChecks(datasourceName, checks, attrNames...) + if indexType != "vectorSearch" { + attributes["mappings_dynamic"] = mappingsDynamic + } + checks := []resource.TestCheckFunc{ + checkExists(resourceName), + } + checks = acc.AddAttrChecks(resourceName, checks, attributes) + checks = acc.AddAttrChecks(datasourceName, checks, attributes) + checks = acc.AddAttrSetChecks(resourceName, checks, "index_id") + checks = acc.AddAttrSetChecks(datasourceName, checks, "index_id") + checks = append(checks, extra...) + return resource.ComposeAggregateTestCheckFunc(checks...) } func checkExists(resourceName string) resource.TestCheckFunc { @@ -291,10 +233,10 @@ func checkExists(resourceName string) resource.TestCheckFunc { } } -func configBasic(projectID, indexName, databaseName, clusterName string, explicitType bool) string { - var indexType string - if explicitType { - indexType = `type="search"` +func configBasic(projectID, clusterName, indexName, indexType, databaseName string) string { + var indexTypeStr string + if indexType != "" { + indexTypeStr = fmt.Sprintf("type=%q", indexType) } return fmt.Sprintf(` resource "mongodbatlas_search_index" "test" { @@ -309,11 +251,16 @@ func configBasic(projectID, indexName, databaseName, clusterName string, explici } data "mongodbatlas_search_index" "data_index" { - cluster_name = %[1]q - project_id = %[2]q + cluster_name = mongodbatlas_search_index.test.cluster_name + project_id = mongodbatlas_search_index.test.project_id index_id = mongodbatlas_search_index.test.index_id } - `, clusterName, projectID, indexName, databaseName, collectionName, searchAnalyzer, indexType) + `, clusterName, projectID, indexName, databaseName, collectionName, searchAnalyzer, indexTypeStr) +} + +func checkBasic(projectID, clusterName, indexName, indexType, databaseName string) resource.TestCheckFunc { + mappingsDynamic := "true" + return checkAggr(projectID, clusterName, indexName, indexType, databaseName, mappingsDynamic) } func configWithMapping(projectID, indexName, databaseName, clusterName string) string { @@ -331,13 +278,22 @@ func configWithMapping(projectID, indexName, databaseName, clusterName string) s } data "mongodbatlas_search_index" "data_index" { - cluster_name = %[1]q - project_id = %[2]q + cluster_name = mongodbatlas_search_index.test.cluster_name + project_id = mongodbatlas_search_index.test.project_id index_id = mongodbatlas_search_index.test.index_id } `, clusterName, projectID, indexName, databaseName, collectionName, searchAnalyzer, analyzersTF, mappingsFieldsTF) } +func checkWithMapping(projectID, indexName, databaseName, clusterName string) resource.TestCheckFunc { + indexType := "" + mappingsDynamic := "false" + attrNames := []string{"mappings_fields", "analyzers"} + checks := acc.AddAttrSetChecks(resourceName, nil, attrNames...) + checks = acc.AddAttrSetChecks(datasourceName, checks, attrNames...) + return checkAggr(projectID, clusterName, indexName, indexType, databaseName, mappingsDynamic, checks...) +} + func configWithSynonyms(projectID, indexName, databaseName, clusterName string, has bool) string { var synonymsStr string if has { @@ -363,13 +319,30 @@ func configWithSynonyms(projectID, indexName, databaseName, clusterName string, } data "mongodbatlas_search_index" "data_index" { - cluster_name = %[1]q - project_id = %[2]q + cluster_name = mongodbatlas_search_index.test.cluster_name + project_id = mongodbatlas_search_index.test.project_id index_id = mongodbatlas_search_index.test.index_id } `, clusterName, projectID, indexName, databaseName, collectionName, searchAnalyzer, synonymsStr) } +func checkWithSynonyms(projectID, indexName, databaseName, clusterName string, has bool) resource.TestCheckFunc { + indexType := "" + mappingsDynamic := "true" + attrs := map[string]string{"synonyms.#": "0"} + if has { + attrs = map[string]string{ + "synonyms.#": "1", + "synonyms.0.analyzer": "lucene.simple", + "synonyms.0.name": "synonym_test", + "synonyms.0.source_collection": collectionName, + } + } + checks := acc.AddAttrChecks(resourceName, nil, attrs) + checks = acc.AddAttrChecks(datasourceName, checks, attrs) + return checkAggr(projectID, clusterName, indexName, indexType, databaseName, mappingsDynamic, checks...) +} + func configAdditional(projectID, indexName, databaseName, clusterName, additional string) string { return fmt.Sprintf(` resource "mongodbatlas_search_index" "test" { @@ -382,9 +355,35 @@ func configAdditional(projectID, indexName, databaseName, clusterName, additiona mappings_dynamic = true %[7]s } + + data "mongodbatlas_search_index" "data_index" { + cluster_name = mongodbatlas_search_index.test.cluster_name + project_id = mongodbatlas_search_index.test.project_id + index_id = mongodbatlas_search_index.test.index_id + } `, clusterName, projectID, indexName, databaseName, collectionName, searchAnalyzer, additional) } +func checkAdditionalAnalyzers(projectID, indexName, databaseName, clusterName string, has bool) resource.TestCheckFunc { + indexType := "" + mappingsDynamic := "true" + check := resource.TestCheckResourceAttr(resourceName, "analyzers", "") + if has { + check = resource.TestCheckResourceAttrWith(resourceName, "analyzers", acc.JSONEquals(analyzersJSON)) + } + return checkAggr(projectID, clusterName, indexName, indexType, databaseName, mappingsDynamic, check) +} + +func checkAdditionalMappingsFields(projectID, indexName, databaseName, clusterName string, has bool) resource.TestCheckFunc { + indexType := "" + mappingsDynamic := "true" + check := resource.TestCheckResourceAttr(resourceName, "mappings_fields", "") + if has { + check = resource.TestCheckResourceAttrWith(resourceName, "mappings_fields", acc.JSONEquals(mappingsFieldsJSON)) + } + return checkAggr(projectID, clusterName, indexName, indexType, databaseName, mappingsDynamic, check) +} + func configVector(projectID, indexName, databaseName, clusterName string) string { return fmt.Sprintf(` resource "mongodbatlas_search_index" "test" { @@ -402,13 +401,21 @@ func configVector(projectID, indexName, databaseName, clusterName string) string } data "mongodbatlas_search_index" "data_index" { - cluster_name = %[1]q - project_id = %[2]q + cluster_name = mongodbatlas_search_index.test.cluster_name + project_id = mongodbatlas_search_index.test.project_id index_id = mongodbatlas_search_index.test.index_id } `, clusterName, projectID, indexName, databaseName, collectionName, fieldsJSON) } +func checkVector(projectID, indexName, databaseName, clusterName string) resource.TestCheckFunc { + indexType := "vectorSearch" + mappingsDynamic := "true" + return checkAggr(projectID, clusterName, indexName, indexType, databaseName, mappingsDynamic, + resource.TestCheckResourceAttrWith(resourceName, "fields", acc.JSONEquals(fieldsJSON)), + resource.TestCheckResourceAttrWith(datasourceName, "fields", acc.JSONEquals(fieldsJSON))) +} + func importStateIDFunc(resourceName string) resource.ImportStateIdFunc { return func(s *terraform.State) (string, error) { rs, ok := s.RootModule().Resources[resourceName] diff --git a/internal/service/serverlessinstance/data_source_serverless_instances.go b/internal/service/serverlessinstance/data_source_serverless_instances.go index 23f8eb5935..a55498593a 100644 --- a/internal/service/serverlessinstance/data_source_serverless_instances.go +++ b/internal/service/serverlessinstance/data_source_serverless_instances.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func PluralDataSource() *schema.Resource { diff --git a/internal/service/serverlessinstance/resource_serverless_instance.go b/internal/service/serverlessinstance/resource_serverless_instance.go index 4c24a1cf3e..2f7a525db2 100644 --- a/internal/service/serverlessinstance/resource_serverless_instance.go +++ b/internal/service/serverlessinstance/resource_serverless_instance.go @@ -15,7 +15,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" "github.com/mongodb/terraform-provider-mongodbatlas/internal/service/advancedcluster" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/serverlessinstance/resource_serverless_instance_test.go b/internal/service/serverlessinstance/resource_serverless_instance_test.go index ee9d0c62f0..c7602623d9 100644 --- a/internal/service/serverlessinstance/resource_serverless_instance_test.go +++ b/internal/service/serverlessinstance/resource_serverless_instance_test.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( @@ -34,7 +34,7 @@ func TestAccServerlessInstance_withTags(t *testing.T) { Steps: []resource.TestStep{ { Config: acc.ConfigServerlessInstance(projectID, instanceName, false, nil, nil), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "name", instanceName), resource.TestCheckResourceAttr(resourceName, "tags.#", "0"), @@ -54,7 +54,7 @@ func TestAccServerlessInstance_withTags(t *testing.T) { }, }, ), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "name", instanceName), resource.TestCheckResourceAttr(resourceName, "tags.#", "2"), @@ -76,7 +76,7 @@ func TestAccServerlessInstance_withTags(t *testing.T) { }, }, ), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "name", instanceName), resource.TestCheckResourceAttr(resourceName, "tags.#", "1"), @@ -103,7 +103,7 @@ func TestAccServerlessInstance_autoIndexing(t *testing.T) { Steps: []resource.TestStep{ { Config: acc.ConfigServerlessInstance(projectID, instanceName, false, conversion.Pointer(false), nil), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "auto_indexing", "false"), resource.TestCheckResourceAttr(dataSourceName, "auto_indexing", "false"), @@ -112,7 +112,7 @@ func TestAccServerlessInstance_autoIndexing(t *testing.T) { }, { Config: acc.ConfigServerlessInstance(projectID, instanceName, false, conversion.Pointer(true), nil), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "auto_indexing", "true"), resource.TestCheckResourceAttr(dataSourceName, "auto_indexing", "true"), @@ -137,7 +137,7 @@ func basicTestCase(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: acc.ConfigServerlessInstance(projectID, instanceName, true, nil, nil), - Check: resource.ComposeTestCheckFunc(basicChecks(projectID, instanceName)...), + Check: resource.ComposeAggregateTestCheckFunc(basicChecks(projectID, instanceName)...), }, { ResourceName: resourceName, diff --git a/internal/service/sharedtier/data_source_cloud_shared_tier_restore_jobs.go b/internal/service/sharedtier/data_source_cloud_shared_tier_restore_jobs.go index 8215f7d0d3..ac5219b683 100644 --- a/internal/service/sharedtier/data_source_cloud_shared_tier_restore_jobs.go +++ b/internal/service/sharedtier/data_source_cloud_shared_tier_restore_jobs.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" diff --git a/internal/service/sharedtier/data_source_shared_tier_snapshots.go b/internal/service/sharedtier/data_source_shared_tier_snapshots.go index 881ec90a53..ff83218e5e 100644 --- a/internal/service/sharedtier/data_source_shared_tier_snapshots.go +++ b/internal/service/sharedtier/data_source_shared_tier_snapshots.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" diff --git a/internal/service/streamconnection/data_source_stream_connections.go b/internal/service/streamconnection/data_source_stream_connections.go index 9beeefdff8..5b4835dd4b 100644 --- a/internal/service/streamconnection/data_source_stream_connections.go +++ b/internal/service/streamconnection/data_source_stream_connections.go @@ -10,7 +10,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/dsschema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) var _ datasource.DataSource = &streamConnectionsDS{} diff --git a/internal/service/streamconnection/data_source_stream_connections_test.go b/internal/service/streamconnection/data_source_stream_connections_test.go index f9a16c85a4..ca480ae389 100644 --- a/internal/service/streamconnection/data_source_stream_connections_test.go +++ b/internal/service/streamconnection/data_source_stream_connections_test.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func TestAccStreamDSStreamConnections_basic(t *testing.T) { @@ -84,5 +84,5 @@ func streamConnectionsAttributeChecks(resourceName string, pageNum, itemsPerPage if itemsPerPage != nil { resourceChecks = append(resourceChecks, resource.TestCheckResourceAttr(resourceName, "items_per_page", fmt.Sprint(*itemsPerPage))) } - return resource.ComposeTestCheckFunc(resourceChecks...) + return resource.ComposeAggregateTestCheckFunc(resourceChecks...) } diff --git a/internal/service/streamconnection/model_stream_connection.go b/internal/service/streamconnection/model_stream_connection.go index 65225d826f..0c2a0ece7d 100644 --- a/internal/service/streamconnection/model_stream_connection.go +++ b/internal/service/streamconnection/model_stream_connection.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types/basetypes" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func NewStreamConnectionReq(ctx context.Context, plan *TFStreamConnectionModel) (*admin.StreamsConnection, diag.Diagnostics) { diff --git a/internal/service/streamconnection/model_stream_connection_test.go b/internal/service/streamconnection/model_stream_connection_test.go index 9407f940f7..16ef34747d 100644 --- a/internal/service/streamconnection/model_stream_connection_test.go +++ b/internal/service/streamconnection/model_stream_connection_test.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/mongodb/terraform-provider-mongodbatlas/internal/service/streamconnection" "github.com/stretchr/testify/assert" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/streamconnection/resource_stream_connection_test.go b/internal/service/streamconnection/resource_stream_connection_test.go index bee389a194..f65dce618b 100644 --- a/internal/service/streamconnection/resource_stream_connection_test.go +++ b/internal/service/streamconnection/resource_stream_connection_test.go @@ -182,7 +182,7 @@ func sampleStreamConnectionAttributeChecks( resource.TestCheckResourceAttr(resourceName, "connection_name", sampleName), resource.TestCheckResourceAttr(resourceName, "type", "Sample"), } - return resource.ComposeTestCheckFunc(resourceChecks...) + return resource.ComposeAggregateTestCheckFunc(resourceChecks...) } func kafkaStreamConnectionAttributeChecks( @@ -209,7 +209,7 @@ func kafkaStreamConnectionAttributeChecks( resource.TestCheckResourceAttrSet(resourceName, "security.broker_public_certificate"), ) } - return resource.ComposeTestCheckFunc(resourceChecks...) + return resource.ComposeAggregateTestCheckFunc(resourceChecks...) } func clusterStreamConnectionConfig(projectID, instanceName, clusterName string) string { @@ -248,7 +248,7 @@ func clusterStreamConnectionAttributeChecks(resourceName, clusterName string) re resource.TestCheckResourceAttr(resourceName, "db_role_to_execute.role", "atlasAdmin"), resource.TestCheckResourceAttr(resourceName, "db_role_to_execute.type", "BUILT_IN"), } - return resource.ComposeTestCheckFunc(resourceChecks...) + return resource.ComposeAggregateTestCheckFunc(resourceChecks...) } func checkStreamConnectionImportStateIDFunc(resourceName string) resource.ImportStateIdFunc { diff --git a/internal/service/streaminstance/data_source_stream_instance_test.go b/internal/service/streaminstance/data_source_stream_instance_test.go index 4124d3e1d0..1a0f77b94e 100644 --- a/internal/service/streaminstance/data_source_stream_instance_test.go +++ b/internal/service/streaminstance/data_source_stream_instance_test.go @@ -22,7 +22,7 @@ func TestAccStreamDSStreamInstance_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: streamInstanceDataSourceConfig(projectID, instanceName, region, cloudProvider), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( streamInstanceAttributeChecks(dataSourceName, instanceName, region, cloudProvider), resource.TestCheckResourceAttr(dataSourceName, "stream_config.tier", "SP30"), ), diff --git a/internal/service/streaminstance/data_source_stream_instances.go b/internal/service/streaminstance/data_source_stream_instances.go index 8275861ac1..b2cff18b7b 100644 --- a/internal/service/streaminstance/data_source_stream_instances.go +++ b/internal/service/streaminstance/data_source_stream_instances.go @@ -10,7 +10,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/dsschema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) var _ datasource.DataSource = &streamInstancesDS{} diff --git a/internal/service/streaminstance/data_source_stream_instances_test.go b/internal/service/streaminstance/data_source_stream_instances_test.go index 6c7177373e..9ea31f3118 100644 --- a/internal/service/streaminstance/data_source_stream_instances_test.go +++ b/internal/service/streaminstance/data_source_stream_instances_test.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func TestAccStreamDSStreamInstances_basic(t *testing.T) { @@ -30,7 +30,7 @@ func TestAccStreamDSStreamInstances_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: streamInstancesDataSourceConfig(projectID, instanceName, region, cloudProvider), - Check: resource.ComposeTestCheckFunc(checks...), + Check: resource.ComposeAggregateTestCheckFunc(checks...), }, }, }) @@ -54,7 +54,7 @@ func TestAccStreamDSStreamInstances_withPageConfig(t *testing.T) { Steps: []resource.TestStep{ { Config: streamInstancesWithPageAttrDataSourceConfig(projectID, instanceName, region, cloudProvider, pageNumber), - Check: resource.ComposeTestCheckFunc(checks...), + Check: resource.ComposeAggregateTestCheckFunc(checks...), }, }, }) diff --git a/internal/service/streaminstance/model_stream_instance.go b/internal/service/streaminstance/model_stream_instance.go index 1bc4ab8822..a50a3253ec 100644 --- a/internal/service/streaminstance/model_stream_instance.go +++ b/internal/service/streaminstance/model_stream_instance.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types/basetypes" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func NewStreamInstanceCreateReq(ctx context.Context, plan *TFStreamInstanceModel) (*admin.StreamsTenant, diag.Diagnostics) { diff --git a/internal/service/streaminstance/model_stream_instance_test.go b/internal/service/streaminstance/model_stream_instance_test.go index f932ef2aae..126baeb093 100644 --- a/internal/service/streaminstance/model_stream_instance_test.go +++ b/internal/service/streaminstance/model_stream_instance_test.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/mongodb/terraform-provider-mongodbatlas/internal/service/streaminstance" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/streaminstance/resource_stream_instance_test.go b/internal/service/streaminstance/resource_stream_instance_test.go index 8fe48d8132..caedf3662b 100644 --- a/internal/service/streaminstance/resource_stream_instance_test.go +++ b/internal/service/streaminstance/resource_stream_instance_test.go @@ -23,7 +23,7 @@ func TestAccStreamRSStreamInstance_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: acc.StreamInstanceConfig(projectID, instanceName, region, cloudProvider), // as of now there are no values that can be updated because only one region is supported - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( streamInstanceAttributeChecks(resourceName, instanceName, region, cloudProvider), resource.TestCheckResourceAttr(resourceName, "stream_config.tier", "SP30"), ), @@ -51,7 +51,7 @@ func TestAccStreamRSStreamInstance_withStreamConfig(t *testing.T) { Steps: []resource.TestStep{ { Config: acc.StreamInstanceWithStreamConfigConfig(projectID, instanceName, region, cloudProvider, "SP10"), // as of now there are no values that can be updated because only one region is supported - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( streamInstanceAttributeChecks(resourceName, instanceName, region, cloudProvider), resource.TestCheckResourceAttr(resourceName, "stream_config.tier", "SP10"), ), @@ -76,7 +76,7 @@ func streamInstanceAttributeChecks(resourceName, instanceName, region, cloudProv resource.TestCheckResourceAttr(resourceName, "data_process_region.cloud_provider", cloudProvider), resource.TestCheckResourceAttr(resourceName, "hostnames.#", "1"), } - return resource.ComposeTestCheckFunc(resourceChecks...) + return resource.ComposeAggregateTestCheckFunc(resourceChecks...) } func checkStreamInstanceImportStateIDFunc(resourceName string) resource.ImportStateIdFunc { diff --git a/internal/service/team/data_source_team.go b/internal/service/team/data_source_team.go index 52f52a8041..99017170f2 100644 --- a/internal/service/team/data_source_team.go +++ b/internal/service/team/data_source_team.go @@ -11,7 +11,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func DataSource() *schema.Resource { diff --git a/internal/service/team/data_source_team_test.go b/internal/service/team/data_source_team_test.go index a8e4528bcd..0eac53e4a5 100644 --- a/internal/service/team/data_source_team_test.go +++ b/internal/service/team/data_source_team_test.go @@ -24,7 +24,7 @@ func TestAccConfigDSTeam_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: dataSourceConfigBasic(orgID, name, username), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(dataSourceName, "org_id"), resource.TestCheckResourceAttrSet(dataSourceName, "team_id"), resource.TestCheckResourceAttr(dataSourceName, "name", name), @@ -50,7 +50,7 @@ func TestAccConfigDSTeamByName_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: dataSourceConfigBasicByName(orgID, name, username), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(dataSourceName, "org_id"), resource.TestCheckResourceAttrSet(dataSourceName, "team_id"), resource.TestCheckResourceAttr(dataSourceName, "name", name), diff --git a/internal/service/team/resource_team.go b/internal/service/team/resource_team.go index f170e5ed29..a9c423e629 100644 --- a/internal/service/team/resource_team.go +++ b/internal/service/team/resource_team.go @@ -15,7 +15,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/constant" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/team/resource_team_migration_test.go b/internal/service/team/resource_team_migration_test.go index 5df34be50f..b1bb03d412 100644 --- a/internal/service/team/resource_team_migration_test.go +++ b/internal/service/team/resource_team_migration_test.go @@ -25,7 +25,7 @@ func TestMigConfigTeams_basic(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "org_id"), resource.TestCheckResourceAttr(resourceName, "name", name), diff --git a/internal/service/team/resource_team_test.go b/internal/service/team/resource_team_test.go index 4a9acb58a4..5353292a8b 100644 --- a/internal/service/team/resource_team_test.go +++ b/internal/service/team/resource_team_test.go @@ -30,7 +30,7 @@ func TestAccConfigRSTeam_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(orgID, name, usernames), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "org_id"), resource.TestCheckResourceAttr(resourceName, "name", name), @@ -39,7 +39,7 @@ func TestAccConfigRSTeam_basic(t *testing.T) { }, { Config: configBasic(orgID, updatedName, usernames), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "org_id"), resource.TestCheckResourceAttr(resourceName, "name", updatedName), @@ -48,7 +48,7 @@ func TestAccConfigRSTeam_basic(t *testing.T) { }, { Config: configBasic(orgID, updatedName, usernames), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "org_id"), resource.TestCheckResourceAttr(resourceName, "name", updatedName), @@ -81,7 +81,7 @@ func TestAccConfigRSTeam_legacyName(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasicLegacyNames(orgID, name, usernames), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "org_id"), resource.TestCheckResourceAttr(resourceName, "name", name), diff --git a/internal/service/thirdpartyintegration/data_source_third_party_integrations.go b/internal/service/thirdpartyintegration/data_source_third_party_integrations.go index 668cd6b269..daf79ed180 100644 --- a/internal/service/thirdpartyintegration/data_source_third_party_integrations.go +++ b/internal/service/thirdpartyintegration/data_source_third_party_integrations.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func PluralDataSource() *schema.Resource { diff --git a/internal/service/thirdpartyintegration/resource_third_party_integration_test.go b/internal/service/thirdpartyintegration/resource_third_party_integration_test.go index 729c00cadb..a4f9f78105 100644 --- a/internal/service/thirdpartyintegration/resource_third_party_integration_test.go +++ b/internal/service/thirdpartyintegration/resource_third_party_integration_test.go @@ -64,7 +64,7 @@ func basicPagerDutyTest(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configBasicPagerDuty(projectID, serviceKey), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "type", intType), resource.TestCheckResourceAttr(resourceName, "service_key", serviceKey), @@ -77,7 +77,7 @@ func basicPagerDutyTest(tb testing.TB) *resource.TestCase { }, { Config: configBasicPagerDuty(projectID, updatedServiceKey), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "type", intType), resource.TestCheckResourceAttr(resourceName, "service_key", updatedServiceKey), @@ -103,7 +103,7 @@ func opsGenieTest(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configOpsGenie(projectID, apiKey), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "type", intType), resource.TestCheckResourceAttr(resourceName, "api_key", apiKey), @@ -114,7 +114,7 @@ func opsGenieTest(tb testing.TB) *resource.TestCase { }, { Config: configOpsGenie(projectID, updatedAPIKey), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "type", intType), resource.TestCheckResourceAttr(resourceName, "api_key", updatedAPIKey), @@ -141,7 +141,7 @@ func victorOpsTest(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configVictorOps(projectID, apiKey), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "type", intType), resource.TestCheckResourceAttr(resourceName, "api_key", apiKey), @@ -152,7 +152,7 @@ func victorOpsTest(tb testing.TB) *resource.TestCase { }, { Config: configVictorOps(projectID, updatedAPIKey), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "type", intType), resource.TestCheckResourceAttr(resourceName, "api_key", updatedAPIKey), @@ -179,7 +179,7 @@ func datadogTest(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configDatadog(projectID, apiKey, "US"), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "type", intType), resource.TestCheckResourceAttr(resourceName, "api_key", apiKey), @@ -190,7 +190,7 @@ func datadogTest(tb testing.TB) *resource.TestCase { }, { Config: configDatadog(projectID, updatedAPIKey, "US"), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "type", intType), resource.TestCheckResourceAttr(resourceName, "api_key", updatedAPIKey), @@ -220,7 +220,7 @@ func prometheusTest(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configPrometheus(projectID, username, password, serviceDiscovery, scheme), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "type", intType), resource.TestCheckResourceAttr(resourceName, "user_name", username), @@ -234,7 +234,7 @@ func prometheusTest(tb testing.TB) *resource.TestCase { }, { Config: configPrometheus(projectID, updatedUsername, password, serviceDiscovery, scheme), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "type", intType), resource.TestCheckResourceAttr(resourceName, "user_name", updatedUsername), @@ -266,7 +266,7 @@ func microsoftTeamsTest(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configMicrosoftTeams(projectID, url), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "type", intType), resource.TestCheckResourceAttr(resourceName, "microsoft_teams_webhook_url", url), @@ -275,7 +275,7 @@ func microsoftTeamsTest(tb testing.TB) *resource.TestCase { }, { Config: configMicrosoftTeams(projectID, updatedURL), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "type", intType), resource.TestCheckResourceAttr(resourceName, "microsoft_teams_webhook_url", updatedURL), @@ -301,7 +301,7 @@ func webhookTest(tb testing.TB) *resource.TestCase { Steps: []resource.TestStep{ { Config: configWebhook(projectID, url), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "type", intType), resource.TestCheckResourceAttr(resourceName, "url", url), @@ -310,7 +310,7 @@ func webhookTest(tb testing.TB) *resource.TestCase { }, { Config: configWebhook(projectID, updatedURL), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttr(resourceName, "type", intType), resource.TestCheckResourceAttr(resourceName, "url", updatedURL), diff --git a/internal/service/x509authenticationdatabaseuser/resource_x509_authentication_database_user.go b/internal/service/x509authenticationdatabaseuser/resource_x509_authentication_database_user.go index 786a179ec0..7b734cb61c 100644 --- a/internal/service/x509authenticationdatabaseuser/resource_x509_authentication_database_user.go +++ b/internal/service/x509authenticationdatabaseuser/resource_x509_authentication_database_user.go @@ -11,7 +11,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" "github.com/spf13/cast" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( diff --git a/internal/service/x509authenticationdatabaseuser/resource_x509_authentication_database_user_migration_test.go b/internal/service/x509authenticationdatabaseuser/resource_x509_authentication_database_user_migration_test.go index eb327e5ca8..1364a57c8d 100644 --- a/internal/service/x509authenticationdatabaseuser/resource_x509_authentication_database_user_migration_test.go +++ b/internal/service/x509authenticationdatabaseuser/resource_x509_authentication_database_user_migration_test.go @@ -24,7 +24,7 @@ func TestMigGenericX509AuthDBUser_basic(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "username", username), @@ -51,7 +51,7 @@ func TestMigGenericX509AuthDBUser_withCustomerX509(t *testing.T) { { ExternalProviders: mig.ExternalProviders(), Config: config, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "customer_x509_cas"), diff --git a/internal/service/x509authenticationdatabaseuser/resource_x509_authentication_database_user_test.go b/internal/service/x509authenticationdatabaseuser/resource_x509_authentication_database_user_test.go index 3abf786728..18bf930f0c 100644 --- a/internal/service/x509authenticationdatabaseuser/resource_x509_authentication_database_user_test.go +++ b/internal/service/x509authenticationdatabaseuser/resource_x509_authentication_database_user_test.go @@ -33,7 +33,7 @@ func TestAccGenericX509AuthDBUser_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: configBasic(projectID, username), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttr(resourceName, "username", username), @@ -64,7 +64,7 @@ func TestAccGenericX509AuthDBUser_withCustomerX509(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithCustomerX509(orgID, projectName, cas), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "customer_x509_cas"), @@ -94,7 +94,7 @@ func TestAccGenericX509AuthDBUser_withDatabaseUser(t *testing.T) { Steps: []resource.TestStep{ { Config: configWithDatabaseUser(projectID, username, months), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( checkExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "username"), diff --git a/internal/testutil/acc/atlas.go b/internal/testutil/acc/atlas.go index 326b646b47..e0f2cac75d 100644 --- a/internal/testutil/acc/atlas.go +++ b/internal/testutil/acc/atlas.go @@ -10,7 +10,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/constant" "github.com/mongodb/terraform-provider-mongodbatlas/internal/service/advancedcluster" "github.com/stretchr/testify/require" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func createProject(tb testing.TB, name string) string { @@ -38,7 +38,7 @@ func createCluster(tb testing.TB, projectID, name string) string { _, _, err := ConnV2().ClustersApi.CreateCluster(context.Background(), projectID, &req).Execute() require.NoError(tb, err, "Cluster creation failed: %s, err: %s", name, err) - stateConf := advancedcluster.CreateStateChangeConfig(context.Background(), ConnV2Preview(), projectID, name, 1*time.Hour) + stateConf := advancedcluster.CreateStateChangeConfig(context.Background(), ConnV2(), projectID, name, 1*time.Hour) _, err = stateConf.WaitForStateContext(context.Background()) require.NoError(tb, err, "Cluster creation failed: %s, err: %s", name, err) @@ -50,26 +50,26 @@ func deleteCluster(projectID, name string) { if err != nil { fmt.Printf("Cluster deletion failed: %s %s, error: %s", projectID, name, err) } - stateConf := advancedcluster.DeleteStateChangeConfig(context.Background(), ConnV2Preview(), projectID, name, 1*time.Hour) + stateConf := advancedcluster.DeleteStateChangeConfig(context.Background(), ConnV2(), projectID, name, 1*time.Hour) _, err = stateConf.WaitForStateContext(context.Background()) if err != nil { fmt.Printf("Cluster deletion failed: %s %s, error: %s", projectID, name, err) } } -func clusterReq(name, projectID string) admin.AdvancedClusterDescription { - return admin.AdvancedClusterDescription{ +func clusterReq(name, projectID string) admin.ClusterDescription20240710 { + return admin.ClusterDescription20240710{ Name: admin.PtrString(name), GroupId: admin.PtrString(projectID), ClusterType: admin.PtrString("REPLICASET"), - ReplicationSpecs: &[]admin.ReplicationSpec{ + ReplicationSpecs: &[]admin.ReplicationSpec20240710{ { - RegionConfigs: &[]admin.CloudRegionConfig{ + RegionConfigs: &[]admin.CloudRegionConfig20240710{ { ProviderName: admin.PtrString(constant.AWS), RegionName: admin.PtrString(constant.UsWest2), Priority: admin.PtrInt(7), - ElectableSpecs: &admin.HardwareSpec{ + ElectableSpecs: &admin.HardwareSpec20240710{ InstanceSize: admin.PtrString(constant.M10), NodeCount: admin.PtrInt(3), }, diff --git a/internal/testutil/acc/database_user.go b/internal/testutil/acc/database_user.go index 7e7b3bbb39..7710bb1333 100644 --- a/internal/testutil/acc/database_user.go +++ b/internal/testutil/acc/database_user.go @@ -3,7 +3,7 @@ package acc import ( "fmt" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func ConfigDatabaseUserBasic(projectID, username, roleName, keyLabel, valueLabel string) string { diff --git a/internal/testutil/acc/factory.go b/internal/testutil/acc/factory.go index 0def2fb03b..80b3fb63ea 100644 --- a/internal/testutil/acc/factory.go +++ b/internal/testutil/acc/factory.go @@ -9,8 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/mongodb/terraform-provider-mongodbatlas/internal/config" "github.com/mongodb/terraform-provider-mongodbatlas/internal/provider" - "go.mongodb.org/atlas-sdk/v20231115014/admin" - adminPreview "go.mongodb.org/atlas-sdk/v20240530001/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) const ( @@ -40,11 +39,6 @@ func ConnV2() *admin.APIClient { return MongoDBClient.AtlasV2 } -// TODO can be removed and replaced for ConnV2 when new SDK is adopted -func ConnV2Preview() *adminPreview.APIClient { - return MongoDBClient.AtlasV2Preview -} - func ConnV2UsingProxy(proxyPort *int) *admin.APIClient { cfg := config.Config{ PublicKey: os.Getenv("MONGODB_ATLAS_PUBLIC_KEY"), diff --git a/internal/testutil/acc/project.go b/internal/testutil/acc/project.go index b28699f069..46e9bd01b7 100644 --- a/internal/testutil/acc/project.go +++ b/internal/testutil/acc/project.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func CheckDestroyProject(s *terraform.State) error { diff --git a/internal/testutil/acc/serverless.go b/internal/testutil/acc/serverless.go index 6a6970a967..d9c6501970 100644 --- a/internal/testutil/acc/serverless.go +++ b/internal/testutil/acc/serverless.go @@ -3,7 +3,7 @@ package acc import ( "fmt" - "go.mongodb.org/atlas-sdk/v20231115014/admin" + "go.mongodb.org/atlas-sdk/v20240530002/admin" ) func ConfigServerlessInstance(projectID, name string, ignoreConnectionStrings bool, autoIndexing *bool, tags []admin.ResourceTag) string { diff --git a/website/docs/d/alert_configuration.html.markdown b/website/docs/d/alert_configuration.html.markdown index 4011d5805a..5672d173a2 100644 --- a/website/docs/d/alert_configuration.html.markdown +++ b/website/docs/d/alert_configuration.html.markdown @@ -65,7 +65,7 @@ resource "mongodbatlas_alert_configuration" "test" { delay_min = 0 sms_enabled = false email_enabled = true - roles = ["GROUP_CHARTS_ADMIN", "GROUP_CLUSTER_MANAGER"] + roles = ["GROUP_CLUSTER_MANAGER"] } matcher { diff --git a/website/docs/index.html.markdown b/website/docs/index.html.markdown index 6732407efa..fcf4c541a7 100644 --- a/website/docs/index.html.markdown +++ b/website/docs/index.html.markdown @@ -185,6 +185,7 @@ For more information on configuring and managing programmatic API Keys see the [ | HashiCorp Terraform Release | HashiCorp Terraform Release Date | HashiCorp Terraform Full Support End Date | MongoDB Atlas Support End Date | |:-------:|:------------:|:------------:|:------------:| +| 1.9.x | 2024-06-26 | 2026-06-30 | 2026-06-30 | | 1.8.x | 2024-04-10 | 2026-04-30 | 2026-04-30 | | 1.7.x | 2024-01-17 | 2026-01-31 | 2026-01-31 | | 1.6.x | 2023-10-04 | 2025-10-31 | 2025-10-31 | @@ -226,7 +227,7 @@ We ship binaries but do not prioritize fixes for the following operating system ## Examples from MongoDB and the Community -We have [example configurations](https://github.com/mongodb/terraform-provider-mongodbatlas/tree/v1.17.2/examples) +We have [example configurations](https://github.com/mongodb/terraform-provider-mongodbatlas/tree/v1.17.3/examples) in our GitHub repo that will help both beginner and more advanced users. Have a good example you've created and want to share? diff --git a/website/docs/r/alert_configuration.html.markdown b/website/docs/r/alert_configuration.html.markdown index a59246878c..7dc7373cf8 100644 --- a/website/docs/r/alert_configuration.html.markdown +++ b/website/docs/r/alert_configuration.html.markdown @@ -26,7 +26,7 @@ resource "mongodbatlas_alert_configuration" "test" { delay_min = 0 sms_enabled = false email_enabled = true - roles = ["GROUP_CHARTS_ADMIN", "GROUP_CLUSTER_MANAGER"] + roles = ["GROUP_CLUSTER_MANAGER"] } matcher { @@ -60,13 +60,13 @@ resource "mongodbatlas_alert_configuration" "test" { delay_min = 0 sms_enabled = false email_enabled = true - roles = ["GROUP_CHARTS_ADMIN", "GROUP_CLUSTER_MANAGER"] + roles = ["GROUP_CLUSTER_MANAGER"] } matcher { - field_name = "HOSTNAME_AND_PORT" + field_name = "CLUSTER_NAME" operator = "EQUALS" - value = "SECONDARY" + value = "my-cluster" } threshold_config { @@ -257,12 +257,11 @@ List of notifications to send when an alert condition is detected. | Project roles | Organization roles | |:---------- |:----------- | - | `GROUP_CHARTS_ADMIN` | `ORG_OWNER` | - | `GROUP_CLUSTER_MANAGER` | `ORG_MEMBER` | - | `GROUP_DATA_ACCESS_ADMIN` | `ORG_GROUP_CREATOR` | - | `GROUP_DATA_ACCESS_READ_ONLY` | `ORG_BILLING_ADMIN` | - | `GROUP_DATA_ACCESS_READ_WRITE` | `ORG_READ_ONLY` | - | `GROUP_OWNER` | | + | `GROUP_CLUSTER_MANAGER` | `ORG_OWNER` | + | `GROUP_DATA_ACCESS_ADMIN` | `ORG_MEMBER` | + | `GROUP_DATA_ACCESS_READ_ONLY` | `ORG_GROUP_CREATOR` | + | `GROUP_DATA_ACCESS_READ_WRITE` | `ORG_BILLING_ADMIN` | + | `GROUP_OWNER` | `ORG_READ_ONLY` | | `GROUP_READ_ONLY` | | ## Attributes Reference @@ -280,7 +279,7 @@ In addition to all arguments above, the following attributes are exported: Alert Configuration can be imported using the `project_id-alert_configuration_id`, e.g. ``` -$ terraform import mongodbatlas_alert_configuration.test 5d0f1f74cf09a29120e123cd-5d0f1f74cf09a29120e1fscg +terraform import mongodbatlas_alert_configuration.test 5d0f1f74cf09a29120e123cd-5d0f1f74cf09a29120e1fscg ``` **NOTE**: Third-party notifications will not contain their respective credentials as these are sensitive attributes. If you wish to perform updates on these notifications without providing the original credentials, the corresponding `notifier_id` attribute must be provided instead. diff --git a/website/docs/r/global_cluster_config.html.markdown b/website/docs/r/global_cluster_config.html.markdown index 46fd14fe6c..18fe29f942 100644 --- a/website/docs/r/global_cluster_config.html.markdown +++ b/website/docs/r/global_cluster_config.html.markdown @@ -13,6 +13,8 @@ description: |- -> **NOTE:** Groups and projects are synonymous terms. You may find group_id in the official documentation. +-> **NOTE:** This resource can only be used with Atlas-managed clusters. See doc for `global_cluster_self_managed_sharding` attribute in [`mongodbatlas_advanced_cluster` resource](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/advanced_cluster) for more info. + ~> **IMPORTANT:** A Global Cluster Configuration, once created, can only be deleted. You can recreate the Global Cluster with the same data only in the Atlas UI. This is because the configuration and its related collection with shard key and indexes are managed separately and they would end up in an inconsistent state. [Read more about Global Cluster Configuration](https://www.mongodb.com/docs/atlas/global-clusters/) ## Examples Usage @@ -72,51 +74,6 @@ description: |- } ``` -### Example Global cluster config - -```terraform -resource "mongodbatlas_cluster" "cluster-test" { - project_id = "" - name = "cluster-test" - - cluster_type = "REPLICASET" - replication_specs { - num_shards = 1 - regions_config { - region_name = "US_EAST_1" - electable_nodes = 3 - priority = 7 - read_only_nodes = 0 - } - } - - backup_enabled = true - auto_scaling_disk_gb_enabled = true - mongo_db_major_version = "7.0" - - //Provider Settings "block" - provider_name = "AWS" - provider_instance_size_name = "M40" -} - -resource "mongodbatlas_global_cluster_config" "config" { - project_id = mongodbatlas_cluster.test.project_id - cluster_name = mongodbatlas_cluster.test.name - - managed_namespaces { - db = "mydata" - collection = "publishers" - custom_shard_key = "city" - } - - custom_zone_mappings { - location = "CA" - zone = "Zone 1" - } -} -``` - - ## Argument Reference * `project_id` - (Required) The unique ID for the project to create the database user.