@@ -31,6 +31,7 @@ func TestAccClusterRSServerlessInstance_basic(t *testing.T) {
31
31
resource .TestCheckResourceAttr (resourceName , "project_id" , projectID ),
32
32
resource .TestCheckResourceAttr (resourceName , "name" , instanceName ),
33
33
resource .TestCheckResourceAttr (resourceName , "termination_protection_enabled" , "false" ),
34
+ testAccCheckConnectionStringPrivateEndpointIsPresentWithNoElement (resourceName ),
34
35
),
35
36
},
36
37
},
@@ -114,11 +115,25 @@ func testAccCheckMongoDBAtlasServerlessInstanceImportStateIDFunc(resourceName st
114
115
}
115
116
116
117
ids := decodeStateID (rs .Primary .ID )
117
-
118
118
return fmt .Sprintf ("%s-%s" , ids ["project_id" ], ids ["name" ]), nil
119
119
}
120
120
}
121
121
122
+ func testAccCheckConnectionStringPrivateEndpointIsPresentWithNoElement (resourceName string ) resource.TestCheckFunc {
123
+ return func (s * terraform.State ) error {
124
+ rs , ok := s .RootModule ().Resources [resourceName ]
125
+ if ! ok {
126
+ return fmt .Errorf ("not found: %s" , resourceName )
127
+ }
128
+
129
+ if connectionStringPrivateEndpoint := rs .Primary .Attributes ["connection_strings_private_endpoint_srv.#" ]; connectionStringPrivateEndpoint == "0" {
130
+ return fmt .Errorf ("expected connection_strings_private_endpoint_srv to be present" )
131
+ }
132
+
133
+ return nil
134
+ }
135
+ }
136
+
122
137
func testAccMongoDBAtlasServerlessInstanceConfig (projectID , name string , ignoreConnectionStrings bool ) string {
123
138
lifecycle := ""
124
139
0 commit comments