Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Merges Azure KMS Encryption at Rest Private Endpoint feature to master #2569

Merged
merged 22 commits into from
Sep 9, 2024
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
03c49fd
update sdk dev (#2490)
maastha Aug 12, 2024
8892a15
chore: Creates TF models & interfaces for new `mongodbatlas_encryptio…
maastha Aug 13, 2024
19059e4
chore: Creates TF models & interfaces for new `mongodbatlas_encryptio…
maastha Aug 13, 2024
d28c740
Merge branch 'master' into CLOUDP-246459-ear-kms-dev
maastha Aug 14, 2024
4dc933a
feat: Updates `mongodbatlas_encryption_at_rest` resource to use new `…
maastha Aug 19, 2024
8226718
chore: Creates TF models & interfaces for `mongodbatlas_encryption_at…
maastha Aug 19, 2024
33e18d2
feat: Implements `mongodbatlas_encryption_at_rest_private_endpoint` r…
AgustinBettati Aug 27, 2024
aaabcff
feat: Implements `mongodbatlas_encryption_at_rest_private_endpoint` s…
AgustinBettati Aug 27, 2024
c22c80e
doc: Updates existing documentation for `mongodbatlas_encryption_at_r…
maastha Aug 28, 2024
c839d75
doc: Include example for new `mongodbatlas_encryption_at_rest_private…
AgustinBettati Aug 30, 2024
9305dd0
feat: Implements new `mongodbatlas_encryption_at_rest_private_endpoin…
AgustinBettati Sep 2, 2024
9275394
feat: Implements new `mongodbatlas_encryption_at_rest` singular data …
maastha Sep 2, 2024
8d3324a
fix: Adds error message handling to `mongodbatlas_encryption_at_rest_…
maastha Sep 3, 2024
3d92da0
doc: Adds documentation for new `encryption_at_rest_private_endpoint`…
AgustinBettati Sep 3, 2024
4a20878
chore: Adopt latest changes from master into ear private endpoint dev…
AgustinBettati Sep 4, 2024
e99d7d5
doc: Adds documentation & examples for `mongodbatlas_encryption_at_re…
maastha Sep 4, 2024
2eb7cdb
chore: Enables `mongodbatlas_encryption_at_rest` (Azure) tests to run…
maastha Sep 5, 2024
ba95eed
chore: Adds `mongodbatlas_encryption_at_rest_private_endpoint` accept…
maastha Sep 6, 2024
eab27cf
doc: Add user journey considerations in current resource and example …
AgustinBettati Sep 6, 2024
8bbb12a
Merge branch 'master' into CLOUDP-246459-ear-kms-dev
maastha Sep 9, 2024
75d5807
update project_ip_addresses action
maastha Sep 9, 2024
e1b801f
address doc comment
maastha Sep 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: Creates TF models & interfaces for new `mongodbatlas_encryptio…
…n_at_rest_private_endpoint` data source (#2500)
maastha authored Aug 13, 2024
commit 19059e479423980a466b206e0aa1abdee0ac404c
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ require (
github.com/zclconf/go-cty v1.15.0
go.mongodb.org/atlas v0.36.0
go.mongodb.org/atlas-sdk/v20240530005 v20240530005.0.0
go.mongodb.org/atlas-sdk/v20240805001 v20240805001.0.1-0.20240809201355-5fc86d455f4c
go.mongodb.org/atlas-sdk/v20240805001 v20240805001.0.1-0.20240813143344-1cfe40386cbc
go.mongodb.org/realm v0.1.0
)

4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -782,8 +782,8 @@ 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/v20240530005 v20240530005.0.0 h1:d/gbYJ+obR0EM/3DZf7+ZMi2QWISegm3mid7Or708cc=
go.mongodb.org/atlas-sdk/v20240530005 v20240530005.0.0/go.mod h1:O47ZrMMfcWb31wznNIq2PQkkdoFoK0ea2GlmRqGJC2s=
go.mongodb.org/atlas-sdk/v20240805001 v20240805001.0.1-0.20240809201355-5fc86d455f4c h1:8mh2UocF0IYCc0tr4oWGrIEcuc7PqLg6GgHMFgN4fWU=
go.mongodb.org/atlas-sdk/v20240805001 v20240805001.0.1-0.20240809201355-5fc86d455f4c/go.mod h1:0aHEphVfsYbpg3CiEUcXeAU7OVoOFig1tltXdLjYiSQ=
go.mongodb.org/atlas-sdk/v20240805001 v20240805001.0.1-0.20240813143344-1cfe40386cbc h1:ZZOXzXjt9PMOx1tKz76aenAikF6n5f8qvitaarDWJ9Q=
go.mongodb.org/atlas-sdk/v20240805001 v20240805001.0.1-0.20240813143344-1cfe40386cbc/go.mod h1:0aHEphVfsYbpg3CiEUcXeAU7OVoOFig1tltXdLjYiSQ=
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=
4 changes: 3 additions & 1 deletion internal/provider/provider.go
Original file line number Diff line number Diff line change
@@ -435,7 +435,9 @@ func (p *MongodbtlasProvider) DataSources(context.Context) []func() datasource.D
streamconnection.PluralDataSource,
controlplaneipaddresses.DataSource,
}
previewDataSources := []func() datasource.DataSource{} // Data sources not yet in GA
previewDataSources := []func() datasource.DataSource{ // Data sources not yet in GA
encryptionatrestprivateendpoint.DataSource,
}
if providerEnablePreview {
dataSources = append(dataSources, previewDataSources...)
}
48 changes: 48 additions & 0 deletions internal/service/encryptionatrestprivateendpoint/data_source.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//nolint:gocritic
package encryptionatrestprivateendpoint

import (
"context"

"github.com/hashicorp/terraform-plugin-framework/datasource"

"github.com/mongodb/terraform-provider-mongodbatlas/internal/config"
)

var _ datasource.DataSource = &encryptionAtRestPrivateEndpointDS{}
var _ datasource.DataSourceWithConfigure = &encryptionAtRestPrivateEndpointDS{}

func DataSource() datasource.DataSource {
return &encryptionAtRestPrivateEndpointDS{
DSCommon: config.DSCommon{
DataSourceName: encryptionAtRestPrivateEndpointName,
},
}
}

type encryptionAtRestPrivateEndpointDS struct {
config.DSCommon
}

func (d *encryptionAtRestPrivateEndpointDS) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
resp.Schema = DataSourceSchema(ctx)
}

func (d *encryptionAtRestPrivateEndpointDS) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
var earPrivateEndpointConfig TFEarPrivateEndpointModel
resp.Diagnostics.Append(req.Config.Get(ctx, &earPrivateEndpointConfig)...)
if resp.Diagnostics.HasError() {
return
}

// TODO: make get request to resource

// connV2 := d.Client.AtlasV2
// if err != nil {
// resp.Diagnostics.AddError("error fetching resource", err.Error())
// return
//}

// TODO: process response into new terraform state
// resp.Diagnostics.Append(resp.State.Set(ctx, NewTFEarPrivateEndpoint(apiResp))...)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package encryptionatrestprivateendpoint

import (
"context"

"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
)

func DataSourceSchema(ctx context.Context) schema.Schema {
return schema.Schema{
Attributes: map[string]schema.Attribute{
"cloud_provider": schema.StringAttribute{
Required: true,
Description: "Human-readable label that identifies the cloud provider of the private endpoint.",
MarkdownDescription: "Human-readable label that identifies the cloud provider of the private endpoint.",
},
"endpoint_id": schema.StringAttribute{
Required: true,
Description: "Unique 24-hexadecimal digit string that identifies the private endpoint.",
MarkdownDescription: "Unique 24-hexadecimal digit string that identifies the private endpoint.",
},
"error_message": schema.StringAttribute{
Computed: true,
Description: "Error message for failures associated with the Encryption At Rest private endpoint.",
MarkdownDescription: "Error message for failures associated with the Encryption At Rest private endpoint.",
},
"project_id": schema.StringAttribute{
Required: true,
Description: "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access.\n\n**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.",
MarkdownDescription: "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access.\n\n**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.",
},
"id": schema.StringAttribute{
Computed: true,
Description: "Unique 24-hexadecimal digit string that identifies the Private Endpoint Service.",
MarkdownDescription: "Unique 24-hexadecimal digit string that identifies the Private Endpoint Service.",
},
"private_endpoint_connection_name": schema.StringAttribute{
Computed: true,
Description: "Connection name of the Azure Private Endpoint.",
MarkdownDescription: "Connection name of the Azure Private Endpoint.",
},
"region_name": schema.StringAttribute{
Computed: true,
Description: "Cloud provider region in which the Encryption At Rest private endpoint is located.",
MarkdownDescription: "Cloud provider region in which the Encryption At Rest private endpoint is located.",
},
"status": schema.StringAttribute{
Computed: true,
Description: "State of the Encryption At Rest private endpoint.",
MarkdownDescription: "State of the Encryption At Rest private endpoint.",
},
},
}
}
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ provider:
name: mongodbatlas

resources:
encryptionatrestprivateendpoint:
encryption_at_rest_private_endpoint:
read:
path: /api/atlas/v2/groups/{groupId}/encryptionAtRest/{cloudProvider}/privateEndpoints/{endpointId}
method: GET
@@ -13,3 +13,12 @@ resources:
path: /api/atlas/v2/groups/{groupId}/encryptionAtRest/{cloudProvider}/privateEndpoints/{endpointId}
method: DELETE

data_sources:
encryption_at_rest_private_endpoint:
read:
path: /api/atlas/v2/groups/{groupId}/encryptionAtRest/{cloudProvider}/privateEndpoints/{endpointId}
method: GET
# encryption_at_rest_private_endpoints:
# read:
# path: /api/atlas/v2/groups/{groupId}/encryptionAtRest/{cloudProvider}/privateEndpoints
# method: GET