-
Notifications
You must be signed in to change notification settings - Fork 166
/
data_source_privatelink_endpoint_service_data_federation_online_archive_test.go
61 lines (54 loc) · 2.74 KB
/
data_source_privatelink_endpoint_service_data_federation_online_archive_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package privatelinkendpointservicedatafederationonlinearchive_test
import (
"fmt"
"os"
"testing"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc"
)
var (
dataSourcePrivatelinkEndpointServiceDataFederetionDataArchive = "data.mongodbatlas_privatelink_endpoint_service_data_federation_online_archive.test"
)
func TestAccNetworkPrivatelinkEndpointServiceDataFederationOnlineArchiveDS_basic(t *testing.T) {
var (
projectID = acc.ProjectIDExecution(t)
endpointID = os.Getenv("MONGODB_ATLAS_PRIVATE_ENDPOINT_ID")
customerEndpointDNSName = os.Getenv("MONGODB_ATLAS_PRIVATE_ENDPOINT_DNS_NAME")
)
resource.Test(t, resource.TestCase{
PreCheck: func() { acc.PreCheckPrivateEndpoint(t) },
ProtoV6ProviderFactories: acc.TestAccProviderV6Factories,
CheckDestroy: checkDestroy,
Steps: []resource.TestStep{
{
Config: dataSourcesConfigBasic(projectID, endpointID, customerEndpointDNSName),
Check: resource.ComposeTestCheckFunc(
checkExists(resourceName),
resource.TestCheckResourceAttr(dataSourcePrivatelinkEndpointServiceDataFederetionDataArchive, "project_id", projectID),
resource.TestCheckResourceAttr(dataSourcePrivatelinkEndpointServiceDataFederetionDataArchive, "endpoint_id", endpointID),
resource.TestCheckResourceAttr(dataSourcePrivatelinkEndpointServiceDataFederetionDataArchive, "comment", comment),
resource.TestCheckResourceAttr(dataSourcePrivatelinkEndpointServiceDataFederetionDataArchive, "region", atlasRegion),
resource.TestCheckResourceAttr(dataSourcePrivatelinkEndpointServiceDataFederetionDataArchive, "customer_endpoint_dns_name", customerEndpointDNSName),
resource.TestCheckResourceAttrSet(dataSourcePrivatelinkEndpointServiceDataFederetionDataArchive, "type"),
resource.TestCheckResourceAttrSet(dataSourcePrivatelinkEndpointServiceDataFederetionDataArchive, "provider_name"),
),
},
},
})
}
func dataSourcesConfigBasic(projectID, endpointID, customerEndpointDNSName string) string {
return fmt.Sprintf(`
resource "mongodbatlas_privatelink_endpoint_service_data_federation_online_archive" "test" {
project_id = %[1]q
endpoint_id = %[2]q
provider_name = "AWS"
comment = "Terraform Acceptance Test"
region = %[3]q
customer_endpoint_dns_name = %[4]q
}
data "mongodbatlas_privatelink_endpoint_service_data_federation_online_archive" "test" {
project_id = mongodbatlas_privatelink_endpoint_service_data_federation_online_archive.test.project_id
endpoint_id = mongodbatlas_privatelink_endpoint_service_data_federation_online_archive.test.endpoint_id
}
`, projectID, endpointID, atlasRegion, customerEndpointDNSName)
}