Skip to content

Commit dc11559

Browse files
authored
chore: Upgrades privatelink_endpoint_service_data_federation_online_archive resource to auto-generated SDK (#1910)
* rename of methods * migrate resource to new SDK * migrate data source * migration test * lint * skip tests * skip test * fix * remove skip test * enable in CI * pr comments * lint
1 parent 9d297a2 commit dc11559

11 files changed

+132
-77
lines changed

.github/workflows/acceptance-tests-runner.yml

+4
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ on:
8282
mongodb_atlas_federated_org_id:
8383
type: string
8484
required: true
85+
mongodb_atlas_private_endpoint_id:
86+
type: string
87+
required: true
8588
secrets: # all secrets are passed explicitly in this workflow
8689
mongodb_atlas_public_key:
8790
required: true
@@ -477,6 +480,7 @@ jobs:
477480
AWS_SECURITY_GROUP_2: ${{ vars.AWS_SECURITY_GROUP_2 }}
478481
AWS_VPC_CIDR_BLOCK: ${{ vars.AWS_VPC_CIDR_BLOCK }}
479482
AWS_VPC_ID: ${{ vars.AWS_VPC_ID }}
483+
MONGODB_ATLAS_PRIVATE_ENDPOINT_ID: ${{ inputs.mongodb_atlas_private_endpoint_id }}
480484
TEST_REGEX: "^TestAccNetwork"
481485
run: make testacc
482486
config:

.github/workflows/acceptance-tests.yml

+1
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,4 @@ jobs:
8080
mongodb_atlas_federated_issuer_uri: ${{ vars.MONGODB_ATLAS_FEDERATED_ISSUER_URI }}
8181
mongodb_atlas_federated_project_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_FEDERATED_PROJECT_ID_QA || vars.MONGODB_ATLAS_FEDERATED_PROJECT_ID }}
8282
mongodb_atlas_federated_org_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_FEDERATED_ORG_ID_QA || vars.MONGODB_ATLAS_FEDERATED_ORG_ID }}
83+
mongodb_atlas_private_endpoint_id: ${{ vars.MONGODB_ATLAS_PRIVATE_ENDPOINT_ID }}

.github/workflows/migration-tests.yml

+1
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ jobs:
384384
AWS_VPC_CIDR_BLOCK: ${{ vars.AWS_VPC_CIDR_BLOCK }}
385385
AWS_VPC_ID: ${{ vars.AWS_VPC_ID }}
386386
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
387+
MONGODB_ATLAS_PRIVATE_ENDPOINT_ID: ${{ vars.MONGODB_ATLAS_PRIVATE_ENDPOINT_ID }}
387388
TEST_REGEX: "^TestAccMigrationNetwork"
388389
run: make testacc
389390
encryption:

internal/service/privatelinkendpointservicedatafederationonlinearchive/data_source_privatelink_endpoint_service_data_federation_online_archive.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
func DataSource() *schema.Resource {
1313
return &schema.Resource{
14-
ReadContext: dataSourceMongoDBAtlasPrivatelinkEndpointServiceDataFederationOnlineArchiveRead,
14+
ReadContext: dataSourceRead,
1515
Schema: map[string]*schema.Schema{
1616
"project_id": {
1717
Type: schema.TypeString,
@@ -37,25 +37,25 @@ func DataSource() *schema.Resource {
3737
}
3838
}
3939

40-
func dataSourceMongoDBAtlasPrivatelinkEndpointServiceDataFederationOnlineArchiveRead(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
41-
conn := meta.(*config.MongoDBClient).Atlas
40+
func dataSourceRead(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
41+
connV2 := meta.(*config.MongoDBClient).AtlasV2
4242
projectID := d.Get("project_id").(string)
4343
endopointID := d.Get("endpoint_id").(string)
4444

45-
privateEndpoint, _, err := conn.DataLakes.GetPrivateLinkEndpoint(context.Background(), projectID, endopointID)
45+
privateEndpoint, _, err := connV2.DataFederationApi.GetDataFederationPrivateEndpoint(ctx, projectID, endopointID).Execute()
4646
if err != nil {
4747
return diag.Errorf(errorPrivateEndpointServiceDataFederationOnlineArchiveRead, endopointID, projectID, err)
4848
}
4949

50-
if err := d.Set("comment", privateEndpoint.Comment); err != nil {
50+
if err := d.Set("comment", privateEndpoint.GetComment()); err != nil {
5151
return diag.Errorf(errorPrivateEndpointServiceDataFederationOnlineArchiveRead, endopointID, projectID, err)
5252
}
5353

54-
if err := d.Set("provider_name", privateEndpoint.Provider); err != nil {
54+
if err := d.Set("provider_name", privateEndpoint.GetProvider()); err != nil {
5555
return diag.Errorf(errorPrivateEndpointServiceDataFederationOnlineArchiveRead, endopointID, projectID, err)
5656
}
5757

58-
if err := d.Set("type", privateEndpoint.Type); err != nil {
58+
if err := d.Set("type", privateEndpoint.GetType()); err != nil {
5959
return diag.Errorf(errorPrivateEndpointServiceDataFederationOnlineArchiveRead, endopointID, projectID, err)
6060
}
6161

internal/service/privatelinkendpointservicedatafederationonlinearchive/data_source_privatelink_endpoint_service_data_federation_online_archive_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ func TestAccNetworkPrivatelinkEndpointServiceDataFederationOnlineArchiveDS_basic
1616
resource.Test(t, resource.TestCase{
1717
PreCheck: func() { acc.PreCheck(t); acc.PreCheckPrivateEndpointServiceDataFederationOnlineArchiveRun(t) },
1818
ProtoV6ProviderFactories: acc.TestAccProviderV6Factories,
19-
CheckDestroy: testAccCheckMongoDBAtlasPrivateEndpointServiceDataFederationOnlineArchiveDestroy,
19+
CheckDestroy: checkDestroy,
2020
Steps: []resource.TestStep{
2121
{
22-
Config: testAccDataSourceMongoDBAtlasPrivateEndpointServiceDataFederationOnlineArchiveConfig(projectID, endpointID),
22+
Config: dataSourcesConfigBasic(projectID, endpointID),
2323
Check: resource.ComposeTestCheckFunc(
24-
testAccCheckMongoDBAtlasPrivateEndpointServiceDataFederationOnlineArchiveExists(resourceNamePrivatelinkEdnpointServiceDataFederationOnlineArchive),
24+
checkExists(resourceName),
2525
resource.TestCheckResourceAttr(dataSourcePrivatelinkEndpointServiceDataFederetionDataArchive, "project_id", projectID),
2626
resource.TestCheckResourceAttr(dataSourcePrivatelinkEndpointServiceDataFederetionDataArchive, "endpoint_id", endpointID),
2727
resource.TestCheckResourceAttrSet(dataSourcePrivatelinkEndpointServiceDataFederetionDataArchive, "comment"),
@@ -33,7 +33,7 @@ func TestAccNetworkPrivatelinkEndpointServiceDataFederationOnlineArchiveDS_basic
3333
})
3434
}
3535

36-
func testAccDataSourceMongoDBAtlasPrivateEndpointServiceDataFederationOnlineArchiveConfig(projectID, endpointID string) string {
36+
func dataSourcesConfigBasic(projectID, endpointID string) string {
3737
return fmt.Sprintf(`
3838
resource "mongodbatlas_privatelink_endpoint_service_data_federation_online_archive" "test" {
3939
project_id = %[1]q

internal/service/privatelinkendpointservicedatafederationonlinearchive/data_source_privatelink_endpoint_service_data_federation_online_archives.go

+11-11
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import (
99
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1010
"github.com/mongodb/terraform-provider-mongodbatlas/internal/config"
1111
"github.com/mongodb/terraform-provider-mongodbatlas/internal/service/datalakepipeline"
12-
matlas "go.mongodb.org/atlas/mongodbatlas"
12+
"go.mongodb.org/atlas-sdk/v20231115005/admin"
1313
)
1414

1515
const errorPrivateEndpointServiceDataFederationOnlineArchiveList = "error reading Private Endpoings for projectId %s: %s"
1616

1717
func PluralDataSource() *schema.Resource {
1818
return &schema.Resource{
19-
ReadContext: dataSourceMongoDBAtlasPrivatelinkEndpointServiceDataFederationOnlineArchivesRead,
19+
ReadContext: dataSourcePluralRead,
2020
Schema: map[string]*schema.Schema{
2121
"project_id": {
2222
Type: schema.TypeString,
@@ -50,16 +50,16 @@ func PluralDataSource() *schema.Resource {
5050
}
5151
}
5252

53-
func dataSourceMongoDBAtlasPrivatelinkEndpointServiceDataFederationOnlineArchivesRead(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
54-
conn := meta.(*config.MongoDBClient).Atlas
53+
func dataSourcePluralRead(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
54+
connV2 := meta.(*config.MongoDBClient).AtlasV2
5555
projectID := d.Get("project_id").(string)
5656

57-
privateEndpoints, _, err := conn.DataLakes.ListPrivateLinkEndpoint(context.Background(), projectID)
57+
privateEndpoints, _, err := connV2.DataFederationApi.ListDataFederationPrivateEndpoints(ctx, projectID).Execute()
5858
if err != nil {
5959
return diag.Errorf(errorPrivateEndpointServiceDataFederationOnlineArchiveList, projectID, err)
6060
}
6161

62-
if err := d.Set("results", flattenPrivateLinkEndpointDataLakeResponse(privateEndpoints.Results)); err != nil {
62+
if err := d.Set("results", flattenPrivateLinkEndpointDataLakeResponse(privateEndpoints.GetResults())); err != nil {
6363
return diag.FromErr(fmt.Errorf(datalakepipeline.ErrorDataLakeSetting, "results", projectID, err))
6464
}
6565

@@ -68,7 +68,7 @@ func dataSourceMongoDBAtlasPrivatelinkEndpointServiceDataFederationOnlineArchive
6868
return nil
6969
}
7070

71-
func flattenPrivateLinkEndpointDataLakeResponse(atlasPrivateLinkEndpointDataLakes []*matlas.PrivateLinkEndpointDataLake) []map[string]any {
71+
func flattenPrivateLinkEndpointDataLakeResponse(atlasPrivateLinkEndpointDataLakes []admin.PrivateNetworkEndpointIdEntry) []map[string]any {
7272
if len(atlasPrivateLinkEndpointDataLakes) == 0 {
7373
return []map[string]any{}
7474
}
@@ -77,10 +77,10 @@ func flattenPrivateLinkEndpointDataLakeResponse(atlasPrivateLinkEndpointDataLake
7777

7878
for i, atlasPrivateLinkEndpointDataLake := range atlasPrivateLinkEndpointDataLakes {
7979
results[i] = map[string]any{
80-
"endpoint_id": atlasPrivateLinkEndpointDataLake.EndpointID,
81-
"provider_name": atlasPrivateLinkEndpointDataLake.Provider,
82-
"comment": atlasPrivateLinkEndpointDataLake.Comment,
83-
"type": atlasPrivateLinkEndpointDataLake.Type,
80+
"endpoint_id": atlasPrivateLinkEndpointDataLake.GetEndpointId(),
81+
"provider_name": atlasPrivateLinkEndpointDataLake.GetProvider(),
82+
"comment": atlasPrivateLinkEndpointDataLake.GetComment(),
83+
"type": atlasPrivateLinkEndpointDataLake.GetType(),
8484
}
8585
}
8686

internal/service/privatelinkendpointservicedatafederationonlinearchive/data_source_privatelink_endpoint_service_data_federation_online_archives_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ func TestAccNetworkPrivatelinkEndpointServiceDataFederationOnlineArchivesDSPlura
1616
resource.Test(t, resource.TestCase{
1717
PreCheck: func() { acc.PreCheck(t); acc.PreCheckPrivateEndpointServiceDataFederationOnlineArchiveRun(t) },
1818
ProtoV6ProviderFactories: acc.TestAccProviderV6Factories,
19-
CheckDestroy: testAccCheckMongoDBAtlasPrivateEndpointServiceDataFederationOnlineArchiveDestroy,
19+
CheckDestroy: checkDestroy,
2020
Steps: []resource.TestStep{
2121
{
22-
Config: testAccDataSourceMongoDBAtlasPrivateEndpointServiceDataFederationOnlineArchivesConfig(projectID, endpointID),
22+
Config: dataSourceConfigBasic(projectID, endpointID),
2323
Check: resource.ComposeTestCheckFunc(
24-
testAccCheckMongoDBAtlasPrivateEndpointServiceDataFederationOnlineArchiveExists(resourceNamePrivatelinkEdnpointServiceDataFederationOnlineArchive),
24+
checkExists(resourceName),
2525
resource.TestCheckResourceAttr(dataSourcePrivatelinkEndpointServiceDataFederetionDataArchives, "project_id", projectID),
2626
resource.TestCheckResourceAttrSet(dataSourcePrivatelinkEndpointServiceDataFederetionDataArchives, "results.#"),
2727
),
@@ -30,7 +30,7 @@ func TestAccNetworkPrivatelinkEndpointServiceDataFederationOnlineArchivesDSPlura
3030
})
3131
}
3232

33-
func testAccDataSourceMongoDBAtlasPrivateEndpointServiceDataFederationOnlineArchivesConfig(projectID, endpointID string) string {
33+
func dataSourceConfigBasic(projectID, endpointID string) string {
3434
return fmt.Sprintf(`
3535
resource "mongodbatlas_privatelink_endpoint_service_data_federation_online_archive" "test" {
3636
project_id = %[1]q

internal/service/privatelinkendpointservicedatafederationonlinearchive/resource_privatelink_endpoint_service_data_federation_online_archive.go

+34-32
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"strings"
99
"time"
1010

11-
matlas "go.mongodb.org/atlas/mongodbatlas"
11+
"go.mongodb.org/atlas-sdk/v20231115005/admin"
1212

1313
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1414
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
@@ -26,11 +26,11 @@ const (
2626

2727
func Resource() *schema.Resource {
2828
return &schema.Resource{
29-
CreateContext: resourceMongoDBAtlasPrivatelinkEndpointServiceDataFederationOnlineArchiveCreate,
30-
ReadContext: resourceMongoDBAtlasPrivatelinkEndpointServiceDataFederationOnlineArchiveRead,
31-
DeleteContext: resourceMongoDBAtlasPrivatelinkEndpointServiceDataFederationOnlineArchiveDelete,
29+
CreateContext: resourceCreate,
30+
ReadContext: resourceRead,
31+
DeleteContext: resourceDelete,
3232
Importer: &schema.ResourceImporter{
33-
StateContext: resourceMongoDBAtlasPrivatelinkEndpointServiceDataFederationOnlineArchiveImportState,
33+
StateContext: resourceImport,
3434
},
3535
Schema: map[string]*schema.Schema{
3636
"project_id": {
@@ -65,12 +65,12 @@ func Resource() *schema.Resource {
6565
}
6666
}
6767

68-
func resourceMongoDBAtlasPrivatelinkEndpointServiceDataFederationOnlineArchiveCreate(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
69-
conn := meta.(*config.MongoDBClient).Atlas
68+
func resourceCreate(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
69+
connV2 := meta.(*config.MongoDBClient).AtlasV2
7070
projectID := d.Get("project_id").(string)
7171
endpointID := d.Get("endpoint_id").(string)
7272

73-
_, _, err := conn.DataLakes.CreatePrivateLinkEndpoint(ctx, projectID, newPrivateLinkEndpointDataLake(d))
73+
_, _, err := connV2.DataFederationApi.CreateDataFederationPrivateEndpoint(ctx, projectID, newPrivateNetworkEndpointIDEntry(d)).Execute()
7474
if err != nil {
7575
return diag.FromErr(fmt.Errorf(errorPrivateEndpointServiceDataFederationOnlineArchiveCreate, projectID, err))
7676
}
@@ -80,47 +80,46 @@ func resourceMongoDBAtlasPrivatelinkEndpointServiceDataFederationOnlineArchiveCr
8080
"endpoint_id": endpointID,
8181
}))
8282

83-
return resourceMongoDBAtlasPrivatelinkEndpointServiceDataFederationOnlineArchiveRead(ctx, d, meta)
83+
return resourceRead(ctx, d, meta)
8484
}
8585

86-
func resourceMongoDBAtlasPrivatelinkEndpointServiceDataFederationOnlineArchiveRead(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
87-
conn := meta.(*config.MongoDBClient).Atlas
86+
func resourceRead(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
87+
connV2 := meta.(*config.MongoDBClient).AtlasV2
8888
ids := conversion.DecodeStateID(d.Id())
8989
projectID := ids["project_id"]
9090
endopointID := ids["endpoint_id"]
9191

92-
privateEndpoint, resp, err := conn.DataLakes.GetPrivateLinkEndpoint(context.Background(), projectID, endopointID)
92+
privateEndpoint, resp, err := connV2.DataFederationApi.GetDataFederationPrivateEndpoint(ctx, projectID, endopointID).Execute()
9393
if err != nil {
9494
if resp != nil && resp.StatusCode == http.StatusNotFound {
9595
d.SetId("")
9696
return nil
9797
}
98-
9998
return diag.Errorf(errorPrivateEndpointServiceDataFederationOnlineArchiveRead, endopointID, projectID, err)
10099
}
101100

102-
if err := d.Set("comment", privateEndpoint.Comment); err != nil {
101+
if err := d.Set("comment", privateEndpoint.GetComment()); err != nil {
103102
return diag.Errorf(errorPrivateEndpointServiceDataFederationOnlineArchiveRead, endopointID, projectID, err)
104103
}
105104

106-
if err := d.Set("provider_name", privateEndpoint.Provider); err != nil {
105+
if err := d.Set("provider_name", privateEndpoint.GetProvider()); err != nil {
107106
return diag.Errorf(errorPrivateEndpointServiceDataFederationOnlineArchiveRead, endopointID, projectID, err)
108107
}
109108

110-
if err := d.Set("type", privateEndpoint.Type); err != nil {
109+
if err := d.Set("type", privateEndpoint.GetType()); err != nil {
111110
return diag.Errorf(errorPrivateEndpointServiceDataFederationOnlineArchiveRead, endopointID, projectID, err)
112111
}
113112

114113
return nil
115114
}
116115

117-
func resourceMongoDBAtlasPrivatelinkEndpointServiceDataFederationOnlineArchiveDelete(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
118-
conn := meta.(*config.MongoDBClient).Atlas
116+
func resourceDelete(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
117+
connV2 := meta.(*config.MongoDBClient).AtlasV2
119118
ids := conversion.DecodeStateID(d.Id())
120119
projectID := ids["project_id"]
121120
endpointID := ids["endpoint_id"]
122121

123-
_, err := conn.DataLakes.DeletePrivateLinkEndpoint(ctx, projectID, endpointID)
122+
_, _, err := connV2.DataFederationApi.DeleteDataFederationPrivateEndpoint(ctx, projectID, endpointID).Execute()
124123
if err != nil {
125124
return diag.FromErr(fmt.Errorf(errorPrivateEndpointServiceDataFederationOnlineArchiveDelete, endpointID, projectID, err))
126125
}
@@ -130,31 +129,31 @@ func resourceMongoDBAtlasPrivatelinkEndpointServiceDataFederationOnlineArchiveDe
130129
return nil
131130
}
132131

133-
func resourceMongoDBAtlasPrivatelinkEndpointServiceDataFederationOnlineArchiveImportState(ctx context.Context, d *schema.ResourceData, meta any) ([]*schema.ResourceData, error) {
134-
conn := meta.(*config.MongoDBClient).Atlas
132+
func resourceImport(ctx context.Context, d *schema.ResourceData, meta any) ([]*schema.ResourceData, error) {
133+
connV2 := meta.(*config.MongoDBClient).AtlasV2
135134
projectID, endpointID, err := splitAtlasPrivatelinkEndpointServiceDataFederationOnlineArchive(d.Id())
136135
if err != nil {
137136
return nil, err
138137
}
139138

140-
privateEndpoint, _, err := conn.DataLakes.GetPrivateLinkEndpoint(ctx, projectID, endpointID)
139+
privateEndpoint, _, err := connV2.DataFederationApi.GetDataFederationPrivateEndpoint(ctx, projectID, endpointID).Execute()
141140
if err != nil {
142141
return nil, fmt.Errorf(errorPrivateEndpointServiceDataFederationOnlineArchiveImport, endpointID, projectID, err)
143142
}
144143

145-
if err := d.Set("comment", privateEndpoint.Comment); err != nil {
144+
if err := d.Set("comment", privateEndpoint.GetComment()); err != nil {
146145
return nil, fmt.Errorf(errorPrivateEndpointServiceDataFederationOnlineArchiveImport, endpointID, projectID, err)
147146
}
148147

149-
if err := d.Set("provider_name", privateEndpoint.Provider); err != nil {
148+
if err := d.Set("provider_name", privateEndpoint.GetProvider()); err != nil {
150149
return nil, fmt.Errorf(errorPrivateEndpointServiceDataFederationOnlineArchiveImport, endpointID, projectID, err)
151150
}
152151

153-
if err := d.Set("type", privateEndpoint.Type); err != nil {
152+
if err := d.Set("type", privateEndpoint.GetType()); err != nil {
154153
return nil, fmt.Errorf(errorPrivateEndpointServiceDataFederationOnlineArchiveImport, endpointID, projectID, err)
155154
}
156155

157-
if err := d.Set("endpoint_id", privateEndpoint.EndpointID); err != nil {
156+
if err := d.Set("endpoint_id", privateEndpoint.GetEndpointId()); err != nil {
158157
return nil, fmt.Errorf(errorPrivateEndpointServiceDataFederationOnlineArchiveImport, endpointID, projectID, err)
159158
}
160159

@@ -184,18 +183,21 @@ func splitAtlasPrivatelinkEndpointServiceDataFederationOnlineArchive(id string)
184183
return
185184
}
186185

187-
func newPrivateLinkEndpointDataLake(d *schema.ResourceData) *matlas.PrivateLinkEndpointDataLake {
188-
out := matlas.PrivateLinkEndpointDataLake{
189-
EndpointID: d.Get("endpoint_id").(string),
190-
Type: endpointType,
186+
func newPrivateNetworkEndpointIDEntry(d *schema.ResourceData) *admin.PrivateNetworkEndpointIdEntry {
187+
endpointType := endpointType
188+
out := admin.PrivateNetworkEndpointIdEntry{
189+
EndpointId: d.Get("endpoint_id").(string),
190+
Type: &endpointType,
191191
}
192192

193193
if v, ok := d.GetOk("comment"); ok {
194-
out.Comment = v.(string)
194+
comment := v.(string)
195+
out.Comment = &comment
195196
}
196197

197198
if v, ok := d.GetOk("provider_name"); ok && v != "" {
198-
out.Provider = strings.ToUpper(v.(string))
199+
providerName := strings.ToUpper(v.(string))
200+
out.Provider = &providerName
199201
}
200202

201203
return &out
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package privatelinkendpointservicedatafederationonlinearchive_test
2+
3+
import (
4+
"testing"
5+
6+
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
7+
"github.com/hashicorp/terraform-plugin-testing/plancheck"
8+
"github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc"
9+
"github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/mig"
10+
)
11+
12+
func TestAccMigrationNetworkPrivatelinkEndpointServiceDataFederationOnlineArchive_basic(t *testing.T) {
13+
resource.Test(t, resource.TestCase{
14+
PreCheck: func() { mig.PreCheckPrivateEndpointServiceDataFederationOnlineArchiveRun(t) },
15+
CheckDestroy: checkDestroy,
16+
Steps: []resource.TestStep{
17+
{
18+
ExternalProviders: mig.ExternalProviders(),
19+
Config: resourceConfigBasic(projectID, endpointID),
20+
Check: resource.ComposeTestCheckFunc(
21+
checkExists(resourceName),
22+
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
23+
resource.TestCheckResourceAttr(resourceName, "endpoint_id", endpointID),
24+
resource.TestCheckResourceAttrSet(resourceName, "comment"),
25+
resource.TestCheckResourceAttrSet(resourceName, "type"),
26+
resource.TestCheckResourceAttrSet(resourceName, "provider_name"),
27+
),
28+
},
29+
{
30+
ProtoV6ProviderFactories: acc.TestAccProviderV6Factories,
31+
Config: resourceConfigBasic(projectID, endpointID),
32+
ConfigPlanChecks: resource.ConfigPlanChecks{
33+
PreApply: []plancheck.PlanCheck{
34+
acc.DebugPlan(),
35+
plancheck.ExpectEmptyPlan(),
36+
},
37+
},
38+
},
39+
},
40+
})
41+
}

0 commit comments

Comments
 (0)