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

Release staging v1.6.0 #921

Merged
merged 2 commits into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/mwielbut/pointy v1.1.0
github.com/spf13/cast v1.5.0
github.com/terraform-providers/terraform-provider-aws v1.60.1-0.20210625132053-af2d5c0ad54f
go.mongodb.org/atlas v0.18.1-0.20221026132354-ca26a1fdb0a6
go.mongodb.org/atlas v0.18.1-0.20221109142841-f9f8ebe7b9b9
go.mongodb.org/realm v0.1.0
)

Expand Down
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,16 @@ go.mongodb.org/atlas v0.16.1-0.20220922005646-8a86dd63e243 h1:KkZ900dLCu2U3D+qoY
go.mongodb.org/atlas v0.16.1-0.20220922005646-8a86dd63e243/go.mod h1:GUuW7/ZrHzCO0o47aiqhokN0N6i0GM3yraRyHIBTykU=
go.mongodb.org/atlas v0.18.1-0.20221026132354-ca26a1fdb0a6 h1:lGmbUUTcdfXt0O1QN2z65B3mAYrUXUerqj3RZWg7Aao=
go.mongodb.org/atlas v0.18.1-0.20221026132354-ca26a1fdb0a6/go.mod h1:PFk1IGhiGjFXHGVspOK7i1U2nnPjK8wAjYwQf6FoVf4=
go.mongodb.org/atlas v0.18.1-0.20221108205600-df069600ea0e h1:2tJAuArFEru/aH3eZhfq8ZU7qv1DzgWp0FTYOYO9X0E=
go.mongodb.org/atlas v0.18.1-0.20221108205600-df069600ea0e/go.mod h1:PFk1IGhiGjFXHGVspOK7i1U2nnPjK8wAjYwQf6FoVf4=
go.mongodb.org/atlas v0.18.1-0.20221109004135-a08842cb4521 h1:gWLG7xNkgiFEw3PQo/0Jnp2MkDwDbYu6svMEET8IBFs=
go.mongodb.org/atlas v0.18.1-0.20221109004135-a08842cb4521/go.mod h1:PFk1IGhiGjFXHGVspOK7i1U2nnPjK8wAjYwQf6FoVf4=
go.mongodb.org/atlas v0.18.1-0.20221109012729-5270d3048e93 h1:i8sFIUYNTakDMxvtak2NEGVnqEWyfB5DYt1aW33IJ2M=
go.mongodb.org/atlas v0.18.1-0.20221109012729-5270d3048e93/go.mod h1:PFk1IGhiGjFXHGVspOK7i1U2nnPjK8wAjYwQf6FoVf4=
go.mongodb.org/atlas v0.18.1-0.20221109025158-49b06badf4a1 h1:sebMdTAFJSPMXidhUg/9D48xFzsHvvNrF3A2plPymmA=
go.mongodb.org/atlas v0.18.1-0.20221109025158-49b06badf4a1/go.mod h1:PFk1IGhiGjFXHGVspOK7i1U2nnPjK8wAjYwQf6FoVf4=
go.mongodb.org/atlas v0.18.1-0.20221109142841-f9f8ebe7b9b9 h1:9m35o4kyRYjwbsIb/lPrjxJ6afPpn9zwOF5i3SIY5Lg=
go.mongodb.org/atlas v0.18.1-0.20221109142841-f9f8ebe7b9b9/go.mod h1:PFk1IGhiGjFXHGVspOK7i1U2nnPjK8wAjYwQf6FoVf4=
go.mongodb.org/realm v0.1.0 h1:zJiXyLaZrznQ+Pz947ziSrDKUep39DO4SfA0Fzx8M4M=
go.mongodb.org/realm v0.1.0/go.mod h1:4Vj6iy+Puo1TDERcoh4XZ+pjtwbOzPpzqy3Cwe8ZmDM=
go.mozilla.org/mozlog v0.0.0-20170222151521-4bb13139d403/go.mod h1:jHoPAGnDrCy6kaI2tAze5Prf0Nr0w/oNkROt2lw3n3o=
Expand Down
8 changes: 7 additions & 1 deletion mongodbatlas/data_source_mongodbatlas_advanced_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ func dataSourceMongoDBAtlasAdvancedCluster() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"termination_protection_enabled": {
Type: schema.TypeBool,
Computed: true,
},
"version_release_system": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -276,7 +280,9 @@ func dataSourceMongoDBAtlasAdvancedClusterRead(ctx context.Context, d *schema.Re
if err := d.Set("state_name", cluster.StateName); err != nil {
return diag.FromErr(fmt.Errorf(errorClusterAdvancedSetting, "state_name", clusterName, err))
}

if err := d.Set("termination_protection_enabled", cluster.TerminationProtectionEnabled); err != nil {
return diag.FromErr(fmt.Errorf(errorClusterAdvancedSetting, "termination_protection_enabled", clusterName, err))
}
if err := d.Set("version_release_system", cluster.VersionReleaseSystem); err != nil {
return diag.FromErr(fmt.Errorf(errorClusterAdvancedSetting, "version_release_system", clusterName, err))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func TestAccDataSourceMongoDBAtlasAdvancedCluster_basic(t *testing.T) {
resource.TestCheckResourceAttrSet(resourceName, "replication_specs.0.region_configs.#"),
resource.TestCheckResourceAttrSet(resourceName, "project_id"),
resource.TestCheckResourceAttr(dataSourceName, "name", name),
resource.TestCheckResourceAttr(dataSourceName, "termination_protection_enabled", "false"),
),
},
},
Expand Down
41 changes: 23 additions & 18 deletions mongodbatlas/data_source_mongodbatlas_advanced_clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ func dataSourceMongoDBAtlasAdvancedClusters() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"termination_protection_enabled": {
Type: schema.TypeBool,
Computed: true,
},
"version_release_system": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -240,24 +244,25 @@ func flattenAdvancedClusters(ctx context.Context, conn *matlas.Client, clusters
}

result := map[string]interface{}{
"advanced_configuration": flattenProcessArgs(processArgs),
"backup_enabled": clusters[i].BackupEnabled,
"bi_connector": flattenBiConnectorConfig(clusters[i].BiConnector),
"cluster_type": clusters[i].ClusterType,
"create_date": clusters[i].CreateDate,
"connection_strings": flattenConnectionStrings(clusters[i].ConnectionStrings),
"disk_size_gb": clusters[i].DiskSizeGB,
"encryption_at_rest_provider": clusters[i].EncryptionAtRestProvider,
"labels": flattenLabels(clusters[i].Labels),
"mongo_db_major_version": clusters[i].MongoDBMajorVersion,
"mongo_db_version": clusters[i].MongoDBVersion,
"name": clusters[i].Name,
"paused": clusters[i].Paused,
"pit_enabled": clusters[i].PitEnabled,
"replication_specs": replicationSpecs,
"root_cert_type": clusters[i].RootCertType,
"state_name": clusters[i].StateName,
"version_release_system": clusters[i].VersionReleaseSystem,
"advanced_configuration": flattenProcessArgs(processArgs),
"backup_enabled": clusters[i].BackupEnabled,
"bi_connector": flattenBiConnectorConfig(clusters[i].BiConnector),
"cluster_type": clusters[i].ClusterType,
"create_date": clusters[i].CreateDate,
"connection_strings": flattenConnectionStrings(clusters[i].ConnectionStrings),
"disk_size_gb": clusters[i].DiskSizeGB,
"encryption_at_rest_provider": clusters[i].EncryptionAtRestProvider,
"labels": flattenLabels(clusters[i].Labels),
"mongo_db_major_version": clusters[i].MongoDBMajorVersion,
"mongo_db_version": clusters[i].MongoDBVersion,
"name": clusters[i].Name,
"paused": clusters[i].Paused,
"pit_enabled": clusters[i].PitEnabled,
"replication_specs": replicationSpecs,
"root_cert_type": clusters[i].RootCertType,
"state_name": clusters[i].StateName,
"termination_protection_enabled": clusters[i].TerminationProtectionEnabled,
"version_release_system": clusters[i].VersionReleaseSystem,
}
results = append(results, result)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func TestAccDataSourceMongoDBAtlasAdvancedClusters_basic(t *testing.T) {
resource.TestCheckResourceAttrSet(dataSourceName, "results.#"),
resource.TestCheckResourceAttrSet(dataSourceName, "results.0.replication_specs.#"),
resource.TestCheckResourceAttrSet(dataSourceName, "results.0.name"),
resource.TestCheckResourceAttrSet(dataSourceName, "results.0.termination_protection_enabled"),
),
},
},
Expand Down
8 changes: 8 additions & 0 deletions mongodbatlas/data_source_mongodbatlas_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,10 @@ func dataSourceMongoDBAtlasCluster() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"termination_protection_enabled": {
Type: schema.TypeBool,
Computed: true,
},
"version_release_system": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -442,6 +446,10 @@ func dataSourceMongoDBAtlasClusterRead(ctx context.Context, d *schema.ResourceDa
return diag.FromErr(fmt.Errorf(errorClusterSetting, "labels", clusterName, err))
}

if err := d.Set("termination_protection_enabled", cluster.TerminationProtectionEnabled); err != nil {
return diag.FromErr(fmt.Errorf(errorClusterSetting, "termination_protection_enabled", clusterName, err))
}

if err := d.Set("version_release_system", cluster.VersionReleaseSystem); err != nil {
return diag.FromErr(fmt.Errorf(errorClusterSetting, "version_release_system", clusterName, err))
}
Expand Down
1 change: 1 addition & 0 deletions mongodbatlas/data_source_mongodbatlas_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func TestAccDataSourceMongoDBAtlasCluster_basic(t *testing.T) {
resource.TestCheckResourceAttr(dataSourceName, "provider_auto_scaling_compute_min_instance_size", minSizeInstance),
resource.TestCheckResourceAttr(dataSourceName, "provider_auto_scaling_compute_max_instance_size", maxSizeInstance),
resource.TestCheckResourceAttr(dataSourceName, "version_release_system", "LTS"),
resource.TestCheckResourceAttr(dataSourceName, "termination_protection_enabled", "false"),
),
},
},
Expand Down
5 changes: 5 additions & 0 deletions mongodbatlas/data_source_mongodbatlas_clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@ func dataSourceMongoDBAtlasClusters() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"termination_protection_enabled": {
Type: schema.TypeBool,
Computed: true,
},
},
},
},
Expand Down Expand Up @@ -403,6 +407,7 @@ func flattenClusters(ctx context.Context, d *schema.ResourceData, conn *matlas.C
"replication_specs": flattenReplicationSpecs(clusters[i].ReplicationSpecs),
"labels": flattenLabels(clusters[i].Labels),
"snapshot_backup_policy": snapshotBackupPolicy,
"termination_protection_enabled": clusters[i].TerminationProtectionEnabled,
"version_release_system": clusters[i].VersionReleaseSystem,
"container_id": containerID,
}
Expand Down
1 change: 1 addition & 0 deletions mongodbatlas/data_source_mongodbatlas_clusters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func TestAccDataSourceMongoDBAtlasClusters_basic(t *testing.T) {
resource.TestCheckResourceAttrSet(dataSourceName, "results.0.replication_specs.#"),
resource.TestCheckResourceAttrSet(dataSourceName, "results.0.name"),
resource.TestCheckResourceAttr(dataSourceName, "results.0.version_release_system", "LTS"),
resource.TestCheckResourceAttr(dataSourceName, "results.0.termination_protection_enabled", "false"),
),
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
package mongodbatlas

import (
"context"
"fmt"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataSourceMongoDBAtlasPrivateLinkEndpointServerless() *schema.Resource {
return &schema.Resource{
ReadContext: dataSourceMongoDBAtlasPrivateEndpointServiceServerlessLinkRead,
Schema: map[string]*schema.Schema{
"project_id": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"instance_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"endpoint_id": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"comment": {
Type: schema.TypeString,
Computed: true,
},
"endpoint_service_name": {
Type: schema.TypeString,
Computed: true,
},
"cloud_provider_endpoint_id": {
Type: schema.TypeString,
Computed: true,
},
"private_link_service_resource_id": {
Type: schema.TypeString,
Computed: true,
},
"private_endpoint_ip_address": {
Type: schema.TypeString,
Computed: true,
},
"error_message": {
Type: schema.TypeString,
Computed: true,
},
"status": {
Type: schema.TypeString,
Computed: true,
},
},
}
}

func dataSourceMongoDBAtlasPrivateEndpointServiceServerlessLinkRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
// Get client connection.
conn := meta.(*MongoDBClient).Atlas

projectID := d.Get("project_id").(string)
instanceName := d.Get("instance_name").(string)
endpointID := d.Get("endpoint_id").(string)

serviceEndpoint, _, err := conn.ServerlessPrivateEndpoints.Get(ctx, projectID, instanceName, endpointID)
if err != nil {
return diag.FromErr(fmt.Errorf(errorServiceEndpointRead, endpointID, err))
}

if err := d.Set("error_message", serviceEndpoint.ErrorMessage); err != nil {
return diag.FromErr(fmt.Errorf(errorEndpointSetting, "error_message", endpointID, err))
}

if err := d.Set("status", serviceEndpoint.Status); err != nil {
return diag.FromErr(fmt.Errorf(errorEndpointSetting, "status", endpointID, err))
}

if err := d.Set("comment", serviceEndpoint.Comment); err != nil {
return diag.FromErr(fmt.Errorf(errorEndpointSetting, "comment", endpointID, err))
}

if err := d.Set("error_message", serviceEndpoint.ErrorMessage); err != nil {
return diag.FromErr(fmt.Errorf(errorEndpointSetting, "error_message", endpointID, err))
}

if err := d.Set("endpoint_service_name", serviceEndpoint.EndpointServiceName); err != nil {
return diag.FromErr(fmt.Errorf(errorEndpointSetting, "endpoint_service_name", endpointID, err))
}

if err := d.Set("cloud_provider_endpoint_id", serviceEndpoint.CloudProviderEndpointID); err != nil {
return diag.FromErr(fmt.Errorf(errorEndpointSetting, "cloud_provider_endpoint_id", endpointID, err))
}

if err := d.Set("private_link_service_resource_id", serviceEndpoint.PrivateLinkServiceResourceID); err != nil {
return diag.FromErr(fmt.Errorf(errorEndpointSetting, "private_link_service_resource_id", endpointID, err))
}

if err := d.Set("private_endpoint_ip_address", serviceEndpoint.PrivateEndpointIPAddress); err != nil {
return diag.FromErr(fmt.Errorf(errorEndpointSetting, "private_endpoint_ip_address", endpointID, err))
}

d.SetId(encodeStateID(map[string]string{
"project_id": projectID,
"instance_name": instanceName,
"endpoint_id": endpointID,
}))

return nil
}
Loading