From c7298996ddadced2f6954df836f2144f120912a5 Mon Sep 17 00:00:00 2001 From: martinstibbe <33664051+martinstibbe@users.noreply.github.com> Date: Thu, 20 Oct 2022 10:58:54 -0500 Subject: [PATCH 01/13] INTMDB-405: [Terraform] Add cluster label to advanced clusters (#857) * Update CHANGELOG.md (#849) * INTMDB-405: Add default label if none supplied * Add test for default label exising * Flatten nested IF statement --- mongodbatlas/resource_mongodbatlas_advanced_cluster.go | 8 +++----- .../resource_mongodbatlas_advanced_cluster_test.go | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/mongodbatlas/resource_mongodbatlas_advanced_cluster.go b/mongodbatlas/resource_mongodbatlas_advanced_cluster.go index b1d90e1d19..3f0f2df10c 100644 --- a/mongodbatlas/resource_mongodbatlas_advanced_cluster.go +++ b/mongodbatlas/resource_mongodbatlas_advanced_cluster.go @@ -315,12 +315,10 @@ func resourceMongoDBAtlasAdvancedClusterCreate(ctx context.Context, d *schema.Re request.EncryptionAtRestProvider = v.(string) } - if _, ok := d.GetOk("labels"); ok { - if containsLabelOrKey(expandLabelSliceFromSetSchema(d), defaultLabel) { - return diag.FromErr(fmt.Errorf("you should not set `Infrastructure Tool` label, it is used for internal purposes")) - } - request.Labels = append(expandLabelSliceFromSetSchema(d), defaultLabel) + if _, ok := d.GetOk("labels"); ok && containsLabelOrKey(expandLabelSliceFromSetSchema(d), defaultLabel) { + return diag.FromErr(fmt.Errorf("you should not set `Infrastructure Tool` label, it is used for internal purposes")) } + request.Labels = append(expandLabelSliceFromSetSchema(d), defaultLabel) if v, ok := d.GetOk("mongo_db_major_version"); ok { request.MongoDBMajorVersion = formatMongoDBMajorVersion(v.(string)) diff --git a/mongodbatlas/resource_mongodbatlas_advanced_cluster_test.go b/mongodbatlas/resource_mongodbatlas_advanced_cluster_test.go index aa8005aa46..244f3dffc6 100644 --- a/mongodbatlas/resource_mongodbatlas_advanced_cluster_test.go +++ b/mongodbatlas/resource_mongodbatlas_advanced_cluster_test.go @@ -48,6 +48,7 @@ func TestAccResourceMongoDBAtlasAdvancedCluster_basicTenant(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "name", rNameUpdated), resource.TestCheckResourceAttrSet(resourceName, "replication_specs.#"), resource.TestCheckResourceAttrSet(resourceName, "replication_specs.0.region_configs.#"), + resource.TestCheckResourceAttr(resourceName, "labels.#", "0"), ), }, { From f1db66c247a67dd54295dfc05cfeb1f7ebf940a7 Mon Sep 17 00:00:00 2001 From: Dosty Everts Date: Tue, 25 Oct 2022 15:17:10 -0500 Subject: [PATCH 02/13] Relying on atlas api for unit validation on alert configuration (#862) --- ...source_mongodbatlas_alert_configuration.go | 17 --------- .../docs/d/alert_configuration.html.markdown | 37 +------------------ .../docs/r/alert_configuration.html.markdown | 36 +----------------- 3 files changed, 4 insertions(+), 86 deletions(-) diff --git a/mongodbatlas/resource_mongodbatlas_alert_configuration.go b/mongodbatlas/resource_mongodbatlas_alert_configuration.go index e830ff0e9d..78576f7af4 100644 --- a/mongodbatlas/resource_mongodbatlas_alert_configuration.go +++ b/mongodbatlas/resource_mongodbatlas_alert_configuration.go @@ -126,23 +126,6 @@ func resourceMongoDBAtlasAlertConfiguration() *schema.Resource { "units": { Type: schema.TypeString, Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - "RAW", - "BITS", - "BYTES", - "KILOBITS", - "KILOBYTES", - "MEGABITS", - "MEGABYTES", - "GIGABITS", - "GIGABYTES", - "TERABYTES", - "PETABYTES", - "MILLISECONDS", - "SECONDS", - "MINUTES", - "HOURS", - "DAYS"}, false), }, "mode": { Type: schema.TypeString, diff --git a/website/docs/d/alert_configuration.html.markdown b/website/docs/d/alert_configuration.html.markdown index 1040da2556..72a895cbc5 100644 --- a/website/docs/d/alert_configuration.html.markdown +++ b/website/docs/d/alert_configuration.html.markdown @@ -155,24 +155,7 @@ The threshold that causes an alert to be triggered. Required if `event_type_name * `threshold` - Threshold value outside of which an alert will be triggered. * `units` - The units for the threshold value. Depends on the type of metric. - Accepted values are: - - `RAW` - - `BITS` - - `BYTES` - - `KILOBITS` - - `KILOBYTES` - - `MEGABITS` - - `MEGABYTES` - - `GIGABITS` - - `GIGABYTES` - - `TERABYTES` - - `PETABYTES` - - `MILLISECONDS` - - `SECONDS` - - `MINUTES` - - `HOURS` - - `DAYS` - + Refer to the [MongoDB API Alert Configuration documentation](https://www.mongodb.com/docs/atlas/reference/api/alert-configurations-get-config/#request-body-parameters) for a list of accepted values. * `mode` - This must be set to AVERAGE. Atlas computes the current metric value as an average. ### Threshold Config (`threshold_config`) @@ -183,23 +166,7 @@ The threshold that causes an alert to be triggered. Required if `event_type_name * `threshold` - Threshold value outside of which an alert will be triggered. * `units` - The units for the threshold value. Depends on the type of metric. - Accepted values are: - - `RAW` - - `BITS` - - `BYTES` - - `KILOBITS` - - `KILOBYTES` - - `MEGABITS` - - `MEGABYTES` - - `GIGABITS` - - `GIGABYTES` - - `TERABYTES` - - `PETABYTES` - - `MILLISECONDS` - - `SECONDS` - - `MINUTES` - - `HOURS` - - `DAYS` + Refer to the [MongoDB API Alert Configuration documentation](https://www.mongodb.com/docs/atlas/reference/api/alert-configurations-get-config/#request-body-parameters) for a list of accepted values. ### Notifications Notifications to send when an alert condition is detected. diff --git a/website/docs/r/alert_configuration.html.markdown b/website/docs/r/alert_configuration.html.markdown index feed4a978d..82659073c0 100644 --- a/website/docs/r/alert_configuration.html.markdown +++ b/website/docs/r/alert_configuration.html.markdown @@ -178,23 +178,7 @@ The threshold that causes an alert to be triggered. Required if `event_type_name * `threshold` - Threshold value outside of which an alert will be triggered. * `units` - The units for the threshold value. Depends on the type of metric. - Accepted values are: - - `RAW` - - `BITS` - - `BYTES` - - `KILOBITS` - - `KILOBYTES` - - `MEGABITS` - - `MEGABYTES` - - `GIGABITS` - - `GIGABYTES` - - `TERABYTES` - - `PETABYTES` - - `MILLISECONDS` - - `SECONDS` - - `MINUTES` - - `HOURS` - - `DAYS` + Refer to the [MongoDB API Alert Configuration documentation](https://www.mongodb.com/docs/atlas/reference/api/alert-configurations-get-config/#request-body-parameters) for a list of accepted values. * `mode` - This must be set to AVERAGE. Atlas computes the current metric value as an average. @@ -206,23 +190,7 @@ The threshold that causes an alert to be triggered. Required if `event_type_name * `threshold` - Threshold value outside of which an alert will be triggered. * `units` - The units for the threshold value. Depends on the type of metric. - Accepted values are: - - `RAW` - - `BITS` - - `BYTES` - - `KILOBITS` - - `KILOBYTES` - - `MEGABITS` - - `MEGABYTES` - - `GIGABITS` - - `GIGABYTES` - - `TERABYTES` - - `PETABYTES` - - `MILLISECONDS` - - `SECONDS` - - `MINUTES` - - `HOURS` - - `DAYS` + Refer to the [MongoDB API Alert Configuration documentation](https://www.mongodb.com/docs/atlas/reference/api/alert-configurations-get-config/#request-body-parameters) for a list of accepted values. ### Notifications List of notifications to send when an alert condition is detected. From 56885d9b389a0677287aadd045f0b9bf8024bdf2 Mon Sep 17 00:00:00 2001 From: Dosty Everts Date: Tue, 25 Oct 2022 15:19:23 -0500 Subject: [PATCH 03/13] INTMDB-334: privatelink endpoint service configurable timeout (#859) * Made timeout for privatelink endpoint service configurable * Updated context to be with timeout, added documentation on how the timeout works * Updated documentation to have proper default timeout of 2h --- ...ce_mongodbatlas_privatelink_endpoint_service.go | 14 +++++++++----- .../r/privatelink_endpoint_service.html.markdown | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/mongodbatlas/resource_mongodbatlas_privatelink_endpoint_service.go b/mongodbatlas/resource_mongodbatlas_privatelink_endpoint_service.go index f21d110bf9..f92321121b 100644 --- a/mongodbatlas/resource_mongodbatlas_privatelink_endpoint_service.go +++ b/mongodbatlas/resource_mongodbatlas_privatelink_endpoint_service.go @@ -27,9 +27,9 @@ const ( func resourceMongoDBAtlasPrivateEndpointServiceLink() *schema.Resource { return &schema.Resource{ - CreateWithoutTimeout: resourceMongoDBAtlasPrivateEndpointServiceLinkCreate, - ReadWithoutTimeout: resourceMongoDBAtlasPrivateEndpointServiceLinkRead, - DeleteWithoutTimeout: resourceMongoDBAtlasPrivateEndpointServiceLinkDelete, + CreateContext: resourceMongoDBAtlasPrivateEndpointServiceLinkCreate, + ReadWithoutTimeout: resourceMongoDBAtlasPrivateEndpointServiceLinkRead, + DeleteContext: resourceMongoDBAtlasPrivateEndpointServiceLinkDelete, Importer: &schema.ResourceImporter{ StateContext: resourceMongoDBAtlasPrivateEndpointServiceLinkImportState, }, @@ -130,6 +130,10 @@ func resourceMongoDBAtlasPrivateEndpointServiceLink() *schema.Resource { Computed: true, }, }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(2 * time.Hour), + Delete: schema.DefaultTimeout(2 * time.Hour), + }, } } @@ -172,7 +176,7 @@ func resourceMongoDBAtlasPrivateEndpointServiceLinkCreate(ctx context.Context, d Pending: []string{"NONE", "INITIATING", "PENDING_ACCEPTANCE", "PENDING", "DELETING", "VERIFIED"}, Target: []string{"AVAILABLE", "REJECTED", "DELETED", "FAILED"}, Refresh: resourceServiceEndpointRefreshFunc(ctx, conn, projectID, providerName, privateLinkID, endpointServiceID), - Timeout: 1 * time.Hour, + Timeout: d.Timeout(schema.TimeoutCreate), MinTimeout: 5 * time.Second, Delay: 5 * time.Minute, } @@ -281,7 +285,7 @@ func resourceMongoDBAtlasPrivateEndpointServiceLinkDelete(ctx context.Context, d Pending: []string{"NONE", "PENDING_ACCEPTANCE", "PENDING", "DELETING", "INITIATING"}, Target: []string{"REJECTED", "DELETED", "FAILED"}, Refresh: resourceServiceEndpointRefreshFunc(ctx, conn, projectID, providerName, privateLinkID, endpointServiceID), - Timeout: 1 * time.Hour, + Timeout: d.Timeout(schema.TimeoutCreate), MinTimeout: 5 * time.Second, Delay: 3 * time.Second, } diff --git a/website/docs/r/privatelink_endpoint_service.html.markdown b/website/docs/r/privatelink_endpoint_service.html.markdown index 1863cd0ab1..caefafba21 100644 --- a/website/docs/r/privatelink_endpoint_service.html.markdown +++ b/website/docs/r/privatelink_endpoint_service.html.markdown @@ -154,6 +154,7 @@ resource "mongodbatlas_privatelink_endpoint_service" "test" { * `private_endpoint_ip_address` - (Optional) Private IP address of the private endpoint network interface you created in your Azure VNet. Only for `AZURE`. * `gcp_project_id` - (Optional) Unique identifier of the GCP project in which you created your endpoints. Only for `GCP`. * `endpoints` - (Optional) Collection of individual private endpoints that comprise your endpoint group. Only for `GCP`. See below. +* `timeouts`- (Optional) The duration of time to wait for Private Endpoint Service to be created or deleted. The timeout value is definded by a signed sequence of decimal numbers with an time unit suffix such as: `1h45m`, `300s`, `10m`, .... The valid time units are: `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`. The default timeout for Private Endpoint create & delete is `2h`. Learn more about timeouts [here](https://www.terraform.io/plugin/sdkv2/resources/retries-and-customizable-timeouts). ### `endpoints` * `ip_address` - (Optional) Private IP address of the endpoint you created in GCP. From 21fc5f07c21556be9823ab05f62d1471542b334c Mon Sep 17 00:00:00 2001 From: martinstibbe <33664051+martinstibbe@users.noreply.github.com> Date: Wed, 26 Oct 2022 18:28:33 -0500 Subject: [PATCH 04/13] INTMDB-373: Add new notification parameters to the mongodbatlas_alert_config resource (#877) * Add support for MS Teams SDK webhook * make fmt * Update documentation add Webhook * Update docs * Update to v0.18 --- go.mod | 4 +- go.sum | 6 + ...source_mongodbatlas_alert_configuration.go | 15 +++ ...source_mongodbatlas_alert_configuration.go | 111 +++++++++++------- .../docs/d/alert_configuration.html.markdown | 4 + .../docs/r/alert_configuration.html.markdown | 4 + 6 files changed, 97 insertions(+), 47 deletions(-) diff --git a/go.mod b/go.mod index c721ea3c05..67b3cda744 100644 --- a/go.mod +++ b/go.mod @@ -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.16.1-0.20220823081124-819fb5448bfe + go.mongodb.org/atlas v0.18.1-0.20221026132354-ca26a1fdb0a6 go.mongodb.org/realm v0.1.0 ) @@ -97,7 +97,7 @@ require ( github.com/modern-go/reflect2 v1.0.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/oklog/run v1.0.0 // indirect - github.com/openlyinc/pointy v1.1.2 // indirect + github.com/openlyinc/pointy v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pquerna/otp v1.3.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect diff --git a/go.sum b/go.sum index 15bbe1f43b..097dcb27cd 100644 --- a/go.sum +++ b/go.sum @@ -743,6 +743,8 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48= github.com/openlyinc/pointy v1.1.2 h1:LywVV2BWC5Sp5v7FoP4bUD+2Yn5k0VNeRbU5vq9jUMY= github.com/openlyinc/pointy v1.1.2/go.mod h1:w2Sytx+0FVuMKn37xpXIAyBNhFNBIJGR/v2m7ik1WtM= +github.com/openlyinc/pointy v1.2.0 h1:vbb/WoPbshyTH8j3/XYu3enlZfv+NHxAD15qTm1zbk0= +github.com/openlyinc/pointy v1.2.0/go.mod h1:JodZOTJoBNaAQHeU0F/SwA4PL0lg4pKF7fYFpX291P0= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= @@ -927,6 +929,10 @@ go.etcd.io/etcd v0.0.0-20200513171258-e048e166ab9c/go.mod h1:xCI7ZzBfRuGgBXyXO6y go.mongodb.org/atlas v0.12.0/go.mod h1:wVCnHcm/7/IfTjEB6K8K35PLG70yGz8BdkRwX0oK9/M= go.mongodb.org/atlas v0.16.1-0.20220823081124-819fb5448bfe h1:jmRFnzQejpiVo7xsPSCUYOqIzltc9Z95UuLr5fy5+qM= go.mongodb.org/atlas v0.16.1-0.20220823081124-819fb5448bfe/go.mod h1:GUuW7/ZrHzCO0o47aiqhokN0N6i0GM3yraRyHIBTykU= +go.mongodb.org/atlas v0.16.1-0.20220922005646-8a86dd63e243 h1:KkZ900dLCu2U3D+qoY1y7m/zQRzqDE1+QWQbx7rh154= +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/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= diff --git a/mongodbatlas/data_source_mongodbatlas_alert_configuration.go b/mongodbatlas/data_source_mongodbatlas_alert_configuration.go index 0281ecea07..6fab98e111 100644 --- a/mongodbatlas/data_source_mongodbatlas_alert_configuration.go +++ b/mongodbatlas/data_source_mongodbatlas_alert_configuration.go @@ -227,6 +227,21 @@ func dataSourceMongoDBAtlasAlertConfiguration() *schema.Resource { Type: schema.TypeString, }, }, + "microsoft_teams_webhook_url": { + Type: schema.TypeString, + Sensitive: true, + Optional: true, + }, + "webhook_secret": { + Type: schema.TypeString, + Sensitive: true, + Optional: true, + }, + "webhook_url": { + Type: schema.TypeString, + Sensitive: true, + Optional: true, + }, }, }, }, diff --git a/mongodbatlas/resource_mongodbatlas_alert_configuration.go b/mongodbatlas/resource_mongodbatlas_alert_configuration.go index 78576f7af4..d09ab43d50 100644 --- a/mongodbatlas/resource_mongodbatlas_alert_configuration.go +++ b/mongodbatlas/resource_mongodbatlas_alert_configuration.go @@ -262,7 +262,7 @@ func resourceMongoDBAtlasAlertConfiguration() *schema.Resource { Optional: true, ValidateFunc: validation.StringInSlice([]string{"EMAIL", "SMS", pagerDuty, "SLACK", "FLOWDOCK", "DATADOG", opsGenie, victorOps, - "WEBHOOK", "USER", "TEAM", "GROUP", "ORG"}, false), + "WEBHOOK", "USER", "TEAM", "GROUP", "ORG", "MICROSOFT_TEAMS"}, false), }, "username": { Type: schema.TypeString, @@ -285,6 +285,21 @@ func resourceMongoDBAtlasAlertConfiguration() *schema.Resource { Type: schema.TypeString, }, }, + "microsoft_teams_webhook_url": { + Type: schema.TypeString, + Sensitive: true, + Optional: true, + }, + "webhook_secret": { + Type: schema.TypeString, + Sensitive: true, + Optional: true, + }, + "webhook_url": { + Type: schema.TypeString, + Sensitive: true, + Optional: true, + }, }, }, }, @@ -685,28 +700,31 @@ func expandAlertConfigurationNotification(d *schema.ResourceData) ([]matlas.Noti } } notifications[i] = matlas.Notification{ - APIToken: cast.ToString(v["api_token"]), - ChannelName: cast.ToString(v["channel_name"]), - DatadogAPIKey: cast.ToString(v["datadog_api_key"]), - DatadogRegion: cast.ToString(v["datadog_region"]), - DelayMin: pointy.Int(v["delay_min"].(int)), - EmailAddress: cast.ToString(v["email_address"]), - EmailEnabled: pointy.Bool(v["email_enabled"].(bool)), - FlowdockAPIToken: cast.ToString(v["flowdock_api_token"]), - FlowName: cast.ToString(v["flow_name"]), - IntervalMin: cast.ToInt(v["interval_min"]), - MobileNumber: cast.ToString(v["mobile_number"]), - OpsGenieAPIKey: cast.ToString(v["ops_genie_api_key"]), - OpsGenieRegion: cast.ToString(v["ops_genie_region"]), - OrgName: cast.ToString(v["org_name"]), - ServiceKey: cast.ToString(v["service_key"]), - SMSEnabled: pointy.Bool(v["sms_enabled"].(bool)), - TeamID: cast.ToString(v["team_id"]), - TypeName: cast.ToString(v["type_name"]), - Username: cast.ToString(v["username"]), - VictorOpsAPIKey: cast.ToString(v["victor_ops_api_key"]), - VictorOpsRoutingKey: cast.ToString(v["victor_ops_routing_key"]), - Roles: cast.ToStringSlice(v["roles"]), + APIToken: cast.ToString(v["api_token"]), + ChannelName: cast.ToString(v["channel_name"]), + DatadogAPIKey: cast.ToString(v["datadog_api_key"]), + DatadogRegion: cast.ToString(v["datadog_region"]), + DelayMin: pointy.Int(v["delay_min"].(int)), + EmailAddress: cast.ToString(v["email_address"]), + EmailEnabled: pointy.Bool(v["email_enabled"].(bool)), + FlowdockAPIToken: cast.ToString(v["flowdock_api_token"]), + FlowName: cast.ToString(v["flow_name"]), + IntervalMin: cast.ToInt(v["interval_min"]), + MobileNumber: cast.ToString(v["mobile_number"]), + OpsGenieAPIKey: cast.ToString(v["ops_genie_api_key"]), + OpsGenieRegion: cast.ToString(v["ops_genie_region"]), + OrgName: cast.ToString(v["org_name"]), + ServiceKey: cast.ToString(v["service_key"]), + SMSEnabled: pointy.Bool(v["sms_enabled"].(bool)), + TeamID: cast.ToString(v["team_id"]), + TypeName: cast.ToString(v["type_name"]), + Username: cast.ToString(v["username"]), + VictorOpsAPIKey: cast.ToString(v["victor_ops_api_key"]), + VictorOpsRoutingKey: cast.ToString(v["victor_ops_routing_key"]), + Roles: cast.ToStringSlice(v["roles"]), + MicrosoftTeamsWebhookURL: cast.ToString(v["microsoft_teams_webhook_url"]), + WebhookSecret: cast.ToString(v["webhook_secret"]), + WebhookURL: cast.ToString(v["webhook_url"]), } } @@ -718,28 +736,31 @@ func flattenAlertConfigurationNotifications(notifications []matlas.Notification) for i := range notifications { nts[i] = map[string]interface{}{ - "api_token": notifications[i].APIToken, - "channel_name": notifications[i].ChannelName, - "datadog_api_key": notifications[i].DatadogAPIKey, - "datadog_region": notifications[i].DatadogRegion, - "delay_min": notifications[i].DelayMin, - "email_address": notifications[i].EmailAddress, - "email_enabled": notifications[i].EmailEnabled, - "flowdock_api_token": notifications[i].FlowdockAPIToken, - "flow_name": notifications[i].FlowName, - "interval_min": notifications[i].IntervalMin, - "mobile_number": notifications[i].MobileNumber, - "ops_genie_api_key": notifications[i].OpsGenieAPIKey, - "ops_genie_region": notifications[i].OpsGenieRegion, - "org_name": notifications[i].OrgName, - "service_key": notifications[i].ServiceKey, - "sms_enabled": notifications[i].SMSEnabled, - "team_id": notifications[i].TeamID, - "team_name": notifications[i].TeamName, - "type_name": notifications[i].TypeName, - "username": notifications[i].Username, - "victor_ops_api_key": notifications[i].VictorOpsAPIKey, - "victor_ops_routing_key": notifications[i].VictorOpsRoutingKey, + "api_token": notifications[i].APIToken, + "channel_name": notifications[i].ChannelName, + "datadog_api_key": notifications[i].DatadogAPIKey, + "datadog_region": notifications[i].DatadogRegion, + "delay_min": notifications[i].DelayMin, + "email_address": notifications[i].EmailAddress, + "email_enabled": notifications[i].EmailEnabled, + "flowdock_api_token": notifications[i].FlowdockAPIToken, + "flow_name": notifications[i].FlowName, + "interval_min": notifications[i].IntervalMin, + "mobile_number": notifications[i].MobileNumber, + "ops_genie_api_key": notifications[i].OpsGenieAPIKey, + "ops_genie_region": notifications[i].OpsGenieRegion, + "org_name": notifications[i].OrgName, + "service_key": notifications[i].ServiceKey, + "sms_enabled": notifications[i].SMSEnabled, + "team_id": notifications[i].TeamID, + "team_name": notifications[i].TeamName, + "type_name": notifications[i].TypeName, + "username": notifications[i].Username, + "victor_ops_api_key": notifications[i].VictorOpsAPIKey, + "victor_ops_routing_key": notifications[i].VictorOpsRoutingKey, + "microsoft_teams_webhook_url": notifications[i].MicrosoftTeamsWebhookURL, + "webhook_secret": notifications[i].WebhookSecret, + "webhook_url": notifications[i].WebhookURL, } // We need to validate it due to the datasource haven't the roles attribute diff --git a/website/docs/d/alert_configuration.html.markdown b/website/docs/d/alert_configuration.html.markdown index 72a895cbc5..786c5fbf1e 100644 --- a/website/docs/d/alert_configuration.html.markdown +++ b/website/docs/d/alert_configuration.html.markdown @@ -204,10 +204,14 @@ Notifications to send when an alert condition is detected. - `USER` - `VICTOR_OPS` - `WEBHOOK` + - `MICROSOFT_TEAMS` * `username` - Name of the Atlas user to which to send notifications. Only a user in the project that owns the alert configuration is allowed here. Required for the `USER` notifications type. * `victor_ops_api_key` - VictorOps API key. Required for the `VICTOR_OPS` notifications type. If the key later becomes invalid, Atlas sends an email to the project owner and eventually removes the key. * `victor_ops_routing_key` - VictorOps routing key. Optional for the `VICTOR_OPS` notifications type. If the key later becomes invalid, Atlas sends an email to the project owner and eventually removes the key. +* `webhook_secret` - Authentication secret for the `WEBHOOK` notifications type. +* `webhook_url` - Target URL for the `WEBHOOK` notifications type. +* `microsoft_teams_webhook_url` - Microsoft Teams channel incoming webhook URL. Required for the `MICROSOFT_TEAMS` notifications type. * `roles` - Atlas role in current Project or Organization. Atlas returns this value if you set `type_name` to `ORG` or `GROUP`. diff --git a/website/docs/r/alert_configuration.html.markdown b/website/docs/r/alert_configuration.html.markdown index 82659073c0..bb2c9e225e 100644 --- a/website/docs/r/alert_configuration.html.markdown +++ b/website/docs/r/alert_configuration.html.markdown @@ -228,10 +228,14 @@ List of notifications to send when an alert condition is detected. - `USER` - `VICTOR_OPS` - `WEBHOOK` + - `MICROSOFT_TEAMS` * `username` - Name of the Atlas user to which to send notifications. Only a user in the project that owns the alert configuration is allowed here. Required for the `USER` notifications type. * `victor_ops_api_key` - VictorOps API key. Required for the `VICTOR_OPS` notifications type. If the key later becomes invalid, Atlas sends an email to the project owner and eventually removes the key. * `victor_ops_routing_key` - VictorOps routing key. Optional for the `VICTOR_OPS` notifications type. If the key later becomes invalid, Atlas sends an email to the project owner and eventually removes the key. +* `webhook_secret` - Optional authentication secret for the `WEBHOOK` notifications type. +* `webhook_url` - Target URL for the `WEBHOOK` notifications type. +* `microsoft_teams_webhook_url` - Microsoft Teams Webhook Uniform Resource Locator (URL) that MongoDB Cloud needs to send this notification via Microsoft Teams. Required if `type_name` is `MICROSOFT_TEAMS`. If the URL later becomes invalid, MongoDB Cloud sends an email to the project owners. If the key remains invalid, MongoDB Cloud removes it. * `roles` - Optional. One or more roles that receive the configured alert. If you include this field, Atlas sends alerts only to users assigned the roles you specify in the array. If you omit this field, Atlas sends alerts to users assigned any role. This parameter is only valid if `type_name` is set to `ORG`, `GROUP`, or `USER`. Accepted values are: From d65aebc625e8e807ea8229a5e815c17317a248fb Mon Sep 17 00:00:00 2001 From: Zuhair Ahmed Date: Wed, 26 Oct 2022 23:09:43 -0400 Subject: [PATCH 05/13] encryption_at_rest M10+ limit doc update (#886) --- website/docs/r/encryption_at_rest.html.markdown | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/website/docs/r/encryption_at_rest.html.markdown b/website/docs/r/encryption_at_rest.html.markdown index 160d5c8f54..969a770dba 100644 --- a/website/docs/r/encryption_at_rest.html.markdown +++ b/website/docs/r/encryption_at_rest.html.markdown @@ -22,6 +22,8 @@ See [Encryption at Rest](https://docs.atlas.mongodb.com/security-kms-encryption/ ~> **IMPORTANT** Atlas encrypts all cluster storage and snapshot volumes, securing all cluster data on disk: a concept known as encryption at rest, by default. +~> **IMPORTANT** Atlas limits this feature to dedicated cluster tiers of M10 and greater. For more information see: https://www.mongodb.com/docs/atlas/reference/api-resources-spec/#tag/Encryption-at-Rest-using-Customer-Key-Management + -> **NOTE:** Groups and projects are synonymous terms. You may find `groupId` in the official documentation. @@ -142,4 +144,4 @@ Refer to the example in the [official github repository](https://github.com/mong * `key_version_resource_id` - The Key Version Resource ID from your GCP account. -For more information see: [MongoDB Atlas API Reference for Encryption at Rest using Customer Key Management.](https://docs.atlas.mongodb.com/reference/api/encryption-at-rest/) \ No newline at end of file +For more information see: [MongoDB Atlas API Reference for Encryption at Rest using Customer Key Management.](https://docs.atlas.mongodb.com/reference/api/encryption-at-rest/) From bf64bb6dbf6c410b4db5f0051d77cbe6ea2a2295 Mon Sep 17 00:00:00 2001 From: martinstibbe <33664051+martinstibbe@users.noreply.github.com> Date: Fri, 28 Oct 2022 08:43:52 -0500 Subject: [PATCH 06/13] INTMDB-224: [Terraform] Support AtlasGov with Terraform (#865) * Add Gov variables workflow and test case * Change test pre check to handle gov env variables * Adjust env variable test validation * Add provider parameter for Gov cloud and region_usage_restrictions to datasources * Update project government test update docs --- .../workflows/automated-test-acceptances.yml | 44 +++++++++++++++++++ GNUmakefile | 5 +++ .../data_source_mongodbatlas_project.go | 8 +++- .../data_source_mongodbatlas_projects.go | 5 +++ mongodbatlas/provider.go | 16 ++++++- mongodbatlas/provider_test.go | 9 ++++ mongodbatlas/resource_mongodbatlas_project.go | 6 +++ .../resource_mongodbatlas_project_test.go | 37 ++++++++++++++++ website/docs/d/project.html.markdown | 2 + website/docs/d/projects.html.markdown | 1 + website/docs/index.html.markdown | 13 ++++++ website/docs/r/project.html.markdown | 1 + 12 files changed, 145 insertions(+), 2 deletions(-) diff --git a/.github/workflows/automated-test-acceptances.yml b/.github/workflows/automated-test-acceptances.yml index fcb9ea1d75..dfd1f14e57 100644 --- a/.github/workflows/automated-test-acceptances.yml +++ b/.github/workflows/automated-test-acceptances.yml @@ -83,3 +83,47 @@ jobs: PAGER_DUTY_SERVICE_KEY: ${{ secrets.PAGER_DUTY_SERVICE_KEY }} MONGODB_ATLAS_API_KEYS_IDS: ${{ secrets.MONGODB_ATLAS_API_KEYS_IDS }} run: make testacc + + acceptance-tests-gov: + if: ${{ github.event.label.name == 'run-testacc-gov' }} + needs: [ authorize ] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.18 + - name: Acceptance Tests Gov + env: + SKIP_TEST_EXTERNAL_CREDENTIALS: ${{ secrets.SKIP_TEST_EXTERNAL_CREDENTIALS }} + SKIP_TEST_IMPORT: ${{ secrets.SKIP_TEST_IMPORT }} + SKIP_TEST: ${{ secrets.SKIP_TEST }} + MONGODB_ATLAS_PUBLIC_KEY: ${{ secrets.MONGODB_ATLAS_PUBLIC_KEY_GOV }} + MONGODB_ATLAS_PRIVATE_KEY: ${{ secrets.MONGODB_ATLAS_PRIVATE_KEY_GOV }} + MONGODB_ATLAS_PROJECT_ID: ${{ secrets.MONGODB_ATLAS_PROJECT_ID_GOV }} + MONGODB_ATLAS_ORG_ID: ${{ secrets.MONGODB_ATLAS_ORG_ID_GOV }} + MONGODB_ATLAS_DB_USERNAME: ${{ secrets.MONGODB_ATLAS_DB_USERNAME }} + MONGODB_ATLAS_TEAMS_IDS: ${{ secrets.MONGODB_ATLAS_TEAMS_IDS }} + MONGODB_ATLAS_LDAP_HOSTNAME: ${{ secrets.MONGODB_ATLAS_LDAP_HOSTNAME }} + MONGODB_ATLAS_LDAP_USERNAME: ${{ secrets.MONGODB_ATLAS_LDAP_USERNAME }} + MONGODB_ATLAS_LDAP_PASSWORD: ${{ secrets.MONGODB_ATLAS_LDAP_PASSWORD }} + MONGODB_ATLAS_LDAP_CA_CERTIFICATE: ${{ secrets.MONGODB_ATLAS_LDAP_CA_CERTIFICATE }} + MONGODB_ATLAS_LDAP_PORT: ${{ secrets.MONGODB_ATLAS_LDAP_PORT }} + AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} + AWS_VPC_ID: ${{ secrets.AWS_VPC_ID }} + AWS_VPC_CIDR_BLOCK: ${{ secrets.AWS_VPC_CIDR_BLOCK }} + AWS_REGION: ${{ secrets.AWS_REGION_GOV }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_CUSTOMER_MASTER_KEY_ID: ${{ secrets.AWS_CUSTOMER_MASTER_KEY_ID }} + CA_CERT: ${{ secrets.CA_CERT }} + MONGODB_ATLAS_ENABLE_BETA: ${{ secrets.MONGODB_ATLAS_ENABLE_BETA }} + ACCTEST_TIMEOUT: ${{ secrets.ACCTEST_TIMEOUT }} + PAGER_DUTY_SERVICE_KEY: ${{ secrets.PAGER_DUTY_SERVICE_KEY }} + MONGODB_ATLAS_API_KEYS_IDS: ${{ secrets.MONGODB_ATLAS_API_KEYS_IDS }} + MONGODB_ATLAS_BASE_URL: ${{ secrets.MONGODB_ATLAS_BASE_URL }} + MONGODB_ATLAS_PROJECT_OWNER_ID_GOV: ${{ secrets.MONGODB_ATLAS_PROJECT_OWNER_ID_GOV }} + run: make testaccgov + diff --git a/GNUmakefile b/GNUmakefile index 3dd7ed914a..8ab5ce1bb4 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -39,6 +39,11 @@ testacc: fmtcheck @$(eval VERSION=acc) TF_ACC=1 go test $(TEST) -v -parallel 20 $(TESTARGS) -timeout $(ACCTEST_TIMEOUT) -cover -ldflags="$(LINKER_FLAGS)" +.PHONY: testaccgov +testaccgov: fmtcheck + @$(eval VERSION=acc) + TF_ACC=1 go test $(TEST) -run 'TestAccResourceMongoDBAtlasGovProject_CreateWithProjectOwner' -v -parallel 1 "$(TESTARGS) -timeout $(ACCTEST_TIMEOUT) -cover -ldflags=$(LINKER_FLAGS) " + .PHONY: fmt fmt: @echo "==> Fixing source code with gofmt..." diff --git a/mongodbatlas/data_source_mongodbatlas_project.go b/mongodbatlas/data_source_mongodbatlas_project.go index 0ba6a7d060..de8414e0b2 100644 --- a/mongodbatlas/data_source_mongodbatlas_project.go +++ b/mongodbatlas/data_source_mongodbatlas_project.go @@ -101,6 +101,10 @@ func dataSourceMongoDBAtlasProject() *schema.Resource { Type: schema.TypeBool, Computed: true, }, + "region_usage_restrictions": { + Type: schema.TypeString, + Computed: true, + }, }, } } @@ -210,7 +214,9 @@ func dataSourceMongoDBAtlasProjectRead(ctx context.Context, d *schema.ResourceDa if err := d.Set("is_schema_advisor_enabled", projectSettings.IsSchemaAdvisorEnabled); err != nil { return diag.Errorf(errorProjectSetting, `is_schema_advisor_enabled`, project.ID, err) } - + if err := d.Set("region_usage_restrictions", project.RegionUsageRestrictions); err != nil { + return diag.Errorf(errorProjectSetting, `region_usage_restrictions`, project.ID, err) + } d.SetId(project.ID) return nil diff --git a/mongodbatlas/data_source_mongodbatlas_projects.go b/mongodbatlas/data_source_mongodbatlas_projects.go index e9eed3515d..fb17d16b2c 100644 --- a/mongodbatlas/data_source_mongodbatlas_projects.go +++ b/mongodbatlas/data_source_mongodbatlas_projects.go @@ -106,6 +106,10 @@ func dataSourceMongoDBAtlasProjects() *schema.Resource { Type: schema.TypeBool, Computed: true, }, + "region_usage_restrictions": { + Type: schema.TypeString, + Computed: true, + }, }, }, }, @@ -178,6 +182,7 @@ func flattenProjects(ctx context.Context, conn *matlas.Client, projects []*matla "is_performance_advisor_enabled": projectSettings.IsPerformanceAdvisorEnabled, "is_realtime_performance_panel_enabled": projectSettings.IsRealtimePerformancePanelEnabled, "is_schema_advisor_enabled": projectSettings.IsSchemaAdvisorEnabled, + "region_usage_restrictions": project.RegionUsageRestrictions, } } } diff --git a/mongodbatlas/provider.go b/mongodbatlas/provider.go index 2fddb58bec..6a4b0d0f51 100644 --- a/mongodbatlas/provider.go +++ b/mongodbatlas/provider.go @@ -14,12 +14,14 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/mwielbut/pointy" "github.com/spf13/cast" matlas "go.mongodb.org/atlas/mongodbatlas" ) var ( ProviderEnableBeta, _ = strconv.ParseBool(os.Getenv("MONGODB_ATLAS_ENABLE_BETA")) + baseURL = "" ) // Provider returns the provider to be use by the code. @@ -60,6 +62,11 @@ func Provider() *schema.Provider { DefaultFunc: schema.EnvDefaultFunc("MONGODB_REALM_BASE_URL", ""), Description: "MongoDB Realm Base URL", }, + "is_mongodbgov_cloud": { + Type: schema.TypeBool, + Optional: true, + Description: "MongoDB Atlas Base URL default to gov", + }, }, DataSourcesMap: getDataSourcesMap(), ResourcesMap: getResourcesMap(), @@ -201,10 +208,17 @@ func addBetaFeatures(provider *schema.Provider) { } func providerConfigure(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) { + mongodbgovCloud := pointy.Bool(d.Get("is_mongodbgov_cloud").(bool)) + if *mongodbgovCloud { + baseURL = "https://cloud.mongodbgov.com" + } else { + baseURL = d.Get("base_url").(string) + } + config := Config{ PublicKey: d.Get("public_key").(string), PrivateKey: d.Get("private_key").(string), - BaseURL: d.Get("base_url").(string), + BaseURL: baseURL, RealmBaseURL: d.Get("realm_base_url").(string), } diff --git a/mongodbatlas/provider_test.go b/mongodbatlas/provider_test.go index 228094a1a3..0aee6e2592 100644 --- a/mongodbatlas/provider_test.go +++ b/mongodbatlas/provider_test.go @@ -56,6 +56,15 @@ func testAccPreCheck(t *testing.T) { } } +func testAccPreCheckGov(t *testing.T) { + if os.Getenv("MONGODB_ATLAS_PUBLIC_KEY") == "" || + os.Getenv("MONGODB_ATLAS_PRIVATE_KEY") == "" || + os.Getenv("MONGODB_ATLAS_PROJECT_ID_GOV") == "" || + os.Getenv("MONGODB_ATLAS_ORG_ID_GOV") == "" { + t.Fatal("`MONGODB_ATLAS_PUBLIC_KEY_GOV`, `MONGODB_ATLAS_PRIVATE_KEY_GOV`, `MONGODB_ATLAS_PROJECT_ID_GOV` and `MONGODB_ATLAS_ORG_ID_GOV` must be set for acceptance testing") + } +} + func testAccPreCheckBetaFeatures(t *testing.T) { enableFeatures, _ := strconv.ParseBool(os.Getenv("MONGODB_ATLAS_ENABLE_BETA")) if !enableFeatures { diff --git a/mongodbatlas/resource_mongodbatlas_project.go b/mongodbatlas/resource_mongodbatlas_project.go index 6b3db7fad1..bebc55b783 100644 --- a/mongodbatlas/resource_mongodbatlas_project.go +++ b/mongodbatlas/resource_mongodbatlas_project.go @@ -122,6 +122,11 @@ func resourceMongoDBAtlasProject() *schema.Resource { Computed: true, Optional: true, }, + "region_usage_restrictions": { + Type: schema.TypeString, + Computed: true, + Optional: true, + }, }, } } @@ -139,6 +144,7 @@ func resourceMongoDBAtlasProjectCreate(ctx context.Context, d *schema.ResourceDa OrgID: d.Get("org_id").(string), Name: d.Get("name").(string), WithDefaultAlertsSettings: pointy.Bool(d.Get("with_default_alerts_settings").(bool)), + RegionUsageRestrictions: d.Get("region_usage_restrictions").(string), } var createProjectOptions *matlas.CreateProjectOptions diff --git a/mongodbatlas/resource_mongodbatlas_project_test.go b/mongodbatlas/resource_mongodbatlas_project_test.go index 9b6b29b1d8..50b65bdaea 100644 --- a/mongodbatlas/resource_mongodbatlas_project_test.go +++ b/mongodbatlas/resource_mongodbatlas_project_test.go @@ -177,6 +177,32 @@ func TestAccResourceMongoDBAtlasProject_CreateWithProjectOwner(t *testing.T) { }) } +func TestAccResourceMongoDBAtlasGovProject_CreateWithProjectOwner(t *testing.T) { + var ( + project matlas.Project + resourceName = "mongodbatlas_project.test" + projectName = fmt.Sprintf("testacc-project-gov-%s", acctest.RandString(10)) + orgID = os.Getenv("MONGODB_ATLAS_ORG_ID_GOV") + projectOwnerID = os.Getenv("MONGODB_ATLAS_PROJECT_OWNER_ID_GOV") + ) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheckGov(t) }, + ProviderFactories: testAccProviderFactories, + CheckDestroy: testAccCheckMongoDBAtlasProjectDestroy, + Steps: []resource.TestStep{ + { + Config: testAccMongoDBAtlasGovProjectConfigWithProjectOwner(projectName, orgID, projectOwnerID), + Check: resource.ComposeTestCheckFunc( + testAccCheckMongoDBAtlasProjectExists(resourceName, &project), + testAccCheckMongoDBAtlasProjectAttributes(&project, projectName), + resource.TestCheckResourceAttr(resourceName, "name", projectName), + resource.TestCheckResourceAttr(resourceName, "org_id", orgID), + ), + }, + }, + }) +} func TestAccResourceMongoDBAtlasProject_CreateWithFalseDefaultSettings(t *testing.T) { var ( project matlas.Project @@ -444,6 +470,17 @@ func testAccMongoDBAtlasProjectConfigWithProjectOwner(projectName, orgID, projec `, projectName, orgID, projectOwnerID) } +func testAccMongoDBAtlasGovProjectConfigWithProjectOwner(projectName, orgID, projectOwnerID string) string { + return fmt.Sprintf(` + resource "mongodbatlas_project" "test" { + name = "%[1]s" + org_id = "%[2]s" + project_owner_id = "%[3]s" + region_usage_restrictions = "GOV_REGIONS_ONLY" + } + `, projectName, orgID, projectOwnerID) +} + func testAccMongoDBAtlasProjectConfigWithFalseDefaultSettings(projectName, orgID, projectOwnerID string) string { return fmt.Sprintf(` resource "mongodbatlas_project" "test" { diff --git a/website/docs/d/project.html.markdown b/website/docs/d/project.html.markdown index 07db2f09d7..beadf19fe8 100644 --- a/website/docs/d/project.html.markdown +++ b/website/docs/d/project.html.markdown @@ -102,5 +102,7 @@ The following are valid roles: * `is_performance_advisor_enabled` - Flag that indicates whether to enable Performance Advisor and Profiler for the project. If enabled, you can analyze database logs to recommend performance improvements. * `is_realtime_performance_panel_enabled` - Flag that indicates whether to enable Real Time Performance Panel for the project. If enabled, you can see real time metrics from your MongoDB database. * `is_schema_advisor_enabled` - Flag that indicates whether to enable Schema Advisor for the project. If enabled, you receive customized recommendations to optimize your data model and enhance performance. Disable this setting to disable schema suggestions in the [Performance Advisor](https://www.mongodb.com/docs/atlas/performance-advisor/#std-label-performance-advisor) and the [Data Explorer](https://www.mongodb.com/docs/atlas/atlas-ui/#std-label-atlas-ui). +* `region_usage_restrictions` - If GOV_REGIONS_ONLY the project can be used for government regions only, otherwise defaults to standard regions. For more information see [MongoDB Atlas for Government](https://www.mongodb.com/docs/atlas/government/api/#creating-a-project). + See [MongoDB Atlas API - Project](https://docs.atlas.mongodb.com/reference/api/project-get-one/) - [and MongoDB Atlas API - Teams](https://docs.atlas.mongodb.com/reference/api/project-get-teams/) Documentation for more information. diff --git a/website/docs/d/projects.html.markdown b/website/docs/d/projects.html.markdown index 943f6d2c4b..6a78cc794a 100644 --- a/website/docs/d/projects.html.markdown +++ b/website/docs/d/projects.html.markdown @@ -81,5 +81,6 @@ The following are valid roles: * `is_performance_advisor_enabled` - Flag that indicates whether to enable Performance Advisor and Profiler for the project. If enabled, you can analyze database logs to recommend performance improvements. * `is_realtime_performance_panel_enabled` - Flag that indicates whether to enable Real Time Performance Panel for the project. If enabled, you can see real time metrics from your MongoDB database. * `is_schema_advisor_enabled` - Flag that indicates whether to enable Schema Advisor for the project. If enabled, you receive customized recommendations to optimize your data model and enhance performance. Disable this setting to disable schema suggestions in the [Performance Advisor](https://www.mongodb.com/docs/atlas/performance-advisor/#std-label-performance-advisor) and the [Data Explorer](https://www.mongodb.com/docs/atlas/atlas-ui/#std-label-atlas-ui). +* `region_usage_restrictions` - If GOV_REGIONS_ONLY the project can be used for government regions only, otherwise defaults to standard regions. For more information see [MongoDB Atlas for Government](https://www.mongodb.com/docs/atlas/government/api/#creating-a-project). See [MongoDB Atlas API - Projects](https://docs.atlas.mongodb.com/reference/api/project-get-all/) - [and MongoDB Atlas API - Teams](https://docs.atlas.mongodb.com/reference/api/project-get-teams/) Documentation for more information. diff --git a/website/docs/index.html.markdown b/website/docs/index.html.markdown index 2709b13c58..e33c5ff9a6 100644 --- a/website/docs/index.html.markdown +++ b/website/docs/index.html.markdown @@ -34,6 +34,19 @@ The [MongoDB Atlas documentation](https://docs.atlas.mongodb.com/tutorial/manage **Role**: If unsure of which role level to grant your key, we suggest creating an organization API Key with an Organization Owner role. This ensures that you have sufficient access for all actions. +# Configure MongoDB Atlas for Government + +In order to enable the Terraform MongoDB Atlas Provider for use with MongoDB Atlas for Government add is_mongodbgov_cloud = true to your provider configuration: +```terraform +# Configure the MongoDB Atlas Provider for MongoDB Atlas for Government +provider "mongodbatlas" { + public_key = var.mongodbatlas_public_key + private_key = var.mongodbatlas_private_key + is_mongodbgov_cloud = true +} +# Create the resources +``` + **API Key Access List**: Some Atlas API resources such as Cloud Backup Restores, Cloud Backup Snapshots, and Cloud Backup Schedules **require** an Atlas API Key Access List to utilize these feature. Hence, if using Terraform, or any other programmatic control, to manage these resources you must have the IP address or CIDR block that the connection is coming from added to the Atlas API Key Access List of the Atlas API key you are using. See [Resources that require API Key List](https://www.mongodb.com/docs/atlas/configure-api-access/#use-api-resources-that-require-an-access-list) ## Authenticate the Provider diff --git a/website/docs/r/project.html.markdown b/website/docs/r/project.html.markdown index 8f88ee5cc4..145a0af72a 100644 --- a/website/docs/r/project.html.markdown +++ b/website/docs/r/project.html.markdown @@ -87,6 +87,7 @@ api_keys allows one to assign an existing organization programmatic API key to a * `is_performance_advisor_enabled` - (Optional) Flag that indicates whether to enable Performance Advisor and Profiler for the project. If enabled, you can analyze database logs to recommend performance improvements. * `is_realtime_performance_panel_enabled` - (Optional) Flag that indicates whether to enable Real Time Performance Panel for the project. If enabled, you can see real time metrics from your MongoDB database. * `is_schema_advisor_enabled` - (Optional) Flag that indicates whether to enable Schema Advisor for the project. If enabled, you receive customized recommendations to optimize your data model and enhance performance. Disable this setting to disable schema suggestions in the [Performance Advisor](https://www.mongodb.com/docs/atlas/performance-advisor/#std-label-performance-advisor) and the [Data Explorer](https://www.mongodb.com/docs/atlas/atlas-ui/#std-label-atlas-ui). +* `region_usage_restrictions` - (Optional - set value to GOV_REGIONS_ONLY) Designates that this project can be used for government regions only. If not set the project will default to standard regions. You cannot deploy clusters across government and standard regions in the same project. AWS is the only cloud provider for AtlasGov. For more information see [MongoDB Atlas for Government](https://www.mongodb.com/docs/atlas/government/api/#creating-a-project). ## Attributes Reference From 72b7dd8e49952395223012542e1176f6cb1abc0d Mon Sep 17 00:00:00 2001 From: Dosty Everts Date: Fri, 28 Oct 2022 19:27:39 -0500 Subject: [PATCH 07/13] INTMDB-370 -- PIT Restore Example (#870) * INTMDB-369: Updated validation logic for cloud_backup_snapshot_restore_job (#813) * Updated validation logic for cloud_backup_snapshot_restore_job * Fixed lint errors * Updated test-upgrade v110 to use pit restore * Fixed var name in example for pit ts * Updated v110 example to use cloud backup snapshot resource with pit and valid instructions * Removed changes to v110 example and created a v146 example * Fixed the v110 example to work with disk_size requirements and added link to new examples on the tf docs. * Fixed documentation and moved example * Moved example again, and fixed links in documentation * Fixed formatting on example * Fixed formatting to account for removal of disk size --- .../point-in-time/README.md | 26 +++++++++++ .../point-in-time/main.tf | 40 +++++++++++++++++ .../point-in-time/variables.tf | 16 +++++++ .../point-in-time/versions.tf | 9 ++++ .../v110/cloud-backup-snapshot/v110/main.tf | 6 +-- .../cloud-backup-snapshot/v110/variables.tf | 2 +- ..._backup_snapshot_restore_job.html.markdown | 44 ++++++++++++++++++- 7 files changed, 137 insertions(+), 6 deletions(-) create mode 100644 examples/atlas-backup-snapshot-restore-job/point-in-time/README.md create mode 100644 examples/atlas-backup-snapshot-restore-job/point-in-time/main.tf create mode 100644 examples/atlas-backup-snapshot-restore-job/point-in-time/variables.tf create mode 100644 examples/atlas-backup-snapshot-restore-job/point-in-time/versions.tf diff --git a/examples/atlas-backup-snapshot-restore-job/point-in-time/README.md b/examples/atlas-backup-snapshot-restore-job/point-in-time/README.md new file mode 100644 index 0000000000..cf70cb7669 --- /dev/null +++ b/examples/atlas-backup-snapshot-restore-job/point-in-time/README.md @@ -0,0 +1,26 @@ +# MongoDB Atlas Provider -- Cloud Backup Snapshot +This example creates a project, cluster, cloud provider snapshot, and a restore job for said snapshot. The cluster is configured to use cloud backup and point in time restore. + +Variables Required: +- `org_id`: ID of atlas organization +- `project_name`: Name of the project +- `cluster_name`: Name of the cluster +- `point_in_time_utc_seconds`: Point in time to restore to, a number of seconds since unix epoch. + +In order to utilize the backup restore job via point in time, fist you need a backup with which to restore. +This example has been configured to only create the backup restore if `point_in_time_utc_seconds` is a non-zero number. +As such, utilize the following example `terraform.tfvars` and pseudo-code to execute a workign example: + +Example `terraform.tfvars` +``` +org_id = "627a9687f7f7f7f774de306f14" +project_name = "cloud_backup_snapshot_v110" +cluster_name = "v110-cluster" +point_in_time_utc_seconds = 0 +``` + +- Run `terraform apply` +- Update `point_in_time_utc_seconds` to the [current epoch time](https://www.epoch101.com/) +- Run `terraform apply` + +You'll now have a project, cluster, backup snapshot, and restore job pointing to specific point in time which to restore. \ No newline at end of file diff --git a/examples/atlas-backup-snapshot-restore-job/point-in-time/main.tf b/examples/atlas-backup-snapshot-restore-job/point-in-time/main.tf new file mode 100644 index 0000000000..993fe23d1e --- /dev/null +++ b/examples/atlas-backup-snapshot-restore-job/point-in-time/main.tf @@ -0,0 +1,40 @@ +# This will Create a Project, Cluster, cloud backup snapshot and restore job + +resource "mongodbatlas_project" "project_test" { + name = var.project_name + org_id = var.org_id +} + +resource "mongodbatlas_cluster" "cluster_test" { + project_id = mongodbatlas_project.project_test.id + name = var.cluster_name + + # Provider Settings "block" + provider_name = "AWS" + provider_region_name = "US_EAST_1" + provider_instance_size_name = "M10" + cloud_backup = true # enable cloud provider snapshots + pit_enabled = true +} + + +resource "mongodbatlas_cloud_backup_snapshot" "test" { + project_id = mongodbatlas_cluster.cluster_test.project_id + cluster_name = mongodbatlas_cluster.cluster_test.name + description = "My description" + retention_in_days = "1" +} + +resource "mongodbatlas_cloud_backup_snapshot_restore_job" "test" { + count = (var.point_in_time_utc_seconds == 0 ? 0 : 1) + project_id = mongodbatlas_cloud_backup_snapshot.test.project_id + cluster_name = mongodbatlas_cloud_backup_snapshot.test.cluster_name + snapshot_id = mongodbatlas_cloud_backup_snapshot.test.id + + delivery_type_config { + point_in_time = true + target_cluster_name = mongodbatlas_cluster.cluster_test.name + target_project_id = mongodbatlas_cluster.cluster_test.project_id + point_in_time_utc_seconds = var.point_in_time_utc_seconds + } +} diff --git a/examples/atlas-backup-snapshot-restore-job/point-in-time/variables.tf b/examples/atlas-backup-snapshot-restore-job/point-in-time/variables.tf new file mode 100644 index 0000000000..d9937a4987 --- /dev/null +++ b/examples/atlas-backup-snapshot-restore-job/point-in-time/variables.tf @@ -0,0 +1,16 @@ +variable "project_name" { + description = "Atlas project name" + default = "" +} +variable "org_id" { + description = "The organization ID" + default = "" +} +variable "cluster_name" { + description = "Cluster name" + default = "" +} +variable "point_in_time_utc_seconds" { + description = "Point in time timestamp for snapshot_restore_job" + default = 0 +} diff --git a/examples/atlas-backup-snapshot-restore-job/point-in-time/versions.tf b/examples/atlas-backup-snapshot-restore-job/point-in-time/versions.tf new file mode 100644 index 0000000000..8ad7bdc042 --- /dev/null +++ b/examples/atlas-backup-snapshot-restore-job/point-in-time/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_providers { + mongodbatlas = { + source = "mongodb/mongodbatlas" + version = "~> 1.4.6" + } + } + required_version = ">= 0.13" +} diff --git a/examples/test-upgrade/v110/cloud-backup-snapshot/v110/main.tf b/examples/test-upgrade/v110/cloud-backup-snapshot/v110/main.tf index a5de15afac..56fa799c23 100644 --- a/examples/test-upgrade/v110/cloud-backup-snapshot/v110/main.tf +++ b/examples/test-upgrade/v110/cloud-backup-snapshot/v110/main.tf @@ -6,9 +6,8 @@ resource "mongodbatlas_project" "project_test" { } resource "mongodbatlas_cluster" "cluster_test" { - project_id = mongodbatlas_project.project_test.id - name = var.cluster_name - disk_size_gb = 5 + project_id = mongodbatlas_project.project_test.id + name = var.cluster_name # Provider Settings "block" provider_name = "AWS" @@ -36,4 +35,3 @@ resource "mongodbatlas_cloud_provider_snapshot_restore_job" "test" { target_project_id = mongodbatlas_cluster.cluster_test.project_id } } - diff --git a/examples/test-upgrade/v110/cloud-backup-snapshot/v110/variables.tf b/examples/test-upgrade/v110/cloud-backup-snapshot/v110/variables.tf index 3819b212ac..d6b75a8b50 100644 --- a/examples/test-upgrade/v110/cloud-backup-snapshot/v110/variables.tf +++ b/examples/test-upgrade/v110/cloud-backup-snapshot/v110/variables.tf @@ -9,4 +9,4 @@ variable "org_id" { variable "cluster_name" { description = "Cluster name" default = "" -} +} \ No newline at end of file diff --git a/website/docs/r/cloud_backup_snapshot_restore_job.html.markdown b/website/docs/r/cloud_backup_snapshot_restore_job.html.markdown index 7948d647ec..757a99cd6b 100644 --- a/website/docs/r/cloud_backup_snapshot_restore_job.html.markdown +++ b/website/docs/r/cloud_backup_snapshot_restore_job.html.markdown @@ -88,6 +88,48 @@ description: |- } ``` +### Example of a point in time restore +``` +resource "mongodbatlas_cluster" "cluster_test" { + project_id = mongodbatlas_project.project_test.id + name = var.cluster_name + + # Provider Settings "block" + provider_name = "AWS" + provider_region_name = "US_EAST_1" + provider_instance_size_name = "M10" + cloud_backup = true # enable cloud provider snapshots + pit_enabled = true +} + + +resource "mongodbatlas_cloud_backup_snapshot" "test" { + project_id = mongodbatlas_cluster.cluster_test.project_id + cluster_name = mongodbatlas_cluster.cluster_test.name + description = "My description" + retention_in_days = "1" +} + +resource "mongodbatlas_cloud_backup_snapshot_restore_job" "test" { + count = (var.point_in_time_utc_seconds == 0 ? 0 : 1) + project_id = mongodbatlas_cloud_backup_snapshot.test.project_id + cluster_name = mongodbatlas_cloud_backup_snapshot.test.cluster_name + snapshot_id = mongodbatlas_cloud_backup_snapshot.test.id + + delivery_type_config { + point_in_time = true + target_cluster_name = mongodbatlas_cluster.cluster_test.name + target_project_id = mongodbatlas_cluster.cluster_test.project_id + point_in_time_utc_seconds = var.point_in_time_utc_seconds + } +} +``` + +### Available complete examples +- [Restore from automated backup snapshot](https://github.com/mongodb/terraform-provider-mongodbatlas/blob/master/examples/test-upgrade/v110/cloud-backup-snapshot/v110) +- [Restore from backup snapshot download](https://github.com/mongodb/terraform-provider-mongodbatlas/blob/master/examples/test-upgrade/v100/design-id-reference/snapshot-restore) +- [Restore from backup snapshot at point in time](https://github.com/mongodb/terraform-provider-mongodbatlas/blob/master/examples/atlas-backup-snapshot-restore-job/point-in-time) + ## Argument Reference * `project_id` - (Required) The unique identifier of the project for the Atlas cluster whose snapshot you want to restore. @@ -96,7 +138,7 @@ description: |- * `delivery_type_config` - (Required) Type of restore job to create. Possible configurations are: **download**, **automated**, or **pointInTime** only one must be set it in ``true``. * `delivery_type_config.automated` - Set to `true` to use the automated configuration. * `delivery_type_config.download` - Set to `true` to use the download configuration. -* `delivery_type_config.pointInTime` - Set to `true` to use the pointInTime configuration. +* `delivery_type_config.pointInTime` - Set to `true` to use the pointInTime configuration. If using pointInTime configuration, you must also specify either `oplog_ts` and `oplog_inc`, or `point_in_time_utc_seconds`. * `delivery_type_config.target_cluster_name` - Name of the target Atlas cluster to which the restore job restores the snapshot. Required for **automated** and **pointInTime**. * `delivery_type_config.target_project_id` - Name of the target Atlas cluster to which the restore job restores the snapshot. Required for **automated** and **pointInTime**. * `delivery_type_config.oplog_ts` - Optional setting for **pointInTime** configuration. Timestamp in the number of seconds that have elapsed since the UNIX epoch from which to you want to restore this snapshot. This is the first part of an Oplog timestamp. From 7a80b753501796ac897ce30d5893800fd0d98861 Mon Sep 17 00:00:00 2001 From: martinstibbe <33664051+martinstibbe@users.noreply.github.com> Date: Tue, 1 Nov 2022 08:30:46 -0500 Subject: [PATCH 08/13] Correct example in test to use arrays and minGram parameter error (#891) --- .../resource_mongodbatlas_search_index_test.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mongodbatlas/resource_mongodbatlas_search_index_test.go b/mongodbatlas/resource_mongodbatlas_search_index_test.go index 7fd2901349..6ce13d32d8 100644 --- a/mongodbatlas/resource_mongodbatlas_search_index_test.go +++ b/mongodbatlas/resource_mongodbatlas_search_index_test.go @@ -270,20 +270,20 @@ func testAccMongoDBAtlasSearchIndexConfigAdvanced(projectID, clusterName string) analyzers = <<-EOF [{ "name": "index_analyzer_test_name", - "charFilters": { + "charFilters": [{ "type": "mapping", "mappings": {"\\" : "/"} - }, - "tokenizer": { + }], + "tokenizer": [{ "type": "nGram", - "min_gram": 2, - "max_gram": 5 - }, - "tokenFilters": { + "minGram": 2, + "maxGram": 5 + }], + "tokenFilters": [{ "type": "length", "min": 20, "max": 33 - } + }] }] EOF } From 1934a4c5ede428ba1feaa712dc1beaa41ec81897 Mon Sep 17 00:00:00 2001 From: martinstibbe <33664051+martinstibbe@users.noreply.github.com> Date: Tue, 1 Nov 2022 08:31:30 -0500 Subject: [PATCH 09/13] INTMDB-378: Add link for How To Guide for existing container ID (#883) * Add link for How To Guide for existing container ID * Document corrections * 3 remaining doc updates --- website/docs/d/cluster.html.markdown | 2 + website/docs/d/clusters.html.markdown | 6 +- .../docs/d/network_container.html.markdown | 2 + .../docs/d/network_containers.html.markdown | 2 + website/docs/d/network_peering.html.markdown | 2 + website/docs/guides/howto-guide.html.markdown | 107 ++++++++++++++++++ website/docs/r/cluster.html.markdown | 2 + .../docs/r/network_container.html.markdown | 2 + website/docs/r/network_peering.html.markdown | 2 + 9 files changed, 125 insertions(+), 2 deletions(-) create mode 100644 website/docs/guides/howto-guide.html.markdown diff --git a/website/docs/d/cluster.html.markdown b/website/docs/d/cluster.html.markdown index b50c046525..df7579c830 100644 --- a/website/docs/d/cluster.html.markdown +++ b/website/docs/d/cluster.html.markdown @@ -120,6 +120,8 @@ In addition to all arguments above, the following attributes are exported: * `container_id` - The Network Peering Container ID. +-> **NOTE:** If you need to get an existing container ID see the [How-To Guide](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/howto-guide.html). + * `version_release_system` - Release cadence that Atlas uses for this cluster. * `advanced_configuration` - Get the advanced configuration options. See [Advanced Configuration](#advanced-configuration) below for more details. diff --git a/website/docs/d/clusters.html.markdown b/website/docs/d/clusters.html.markdown index 9a608aec01..5bf405197a 100644 --- a/website/docs/d/clusters.html.markdown +++ b/website/docs/d/clusters.html.markdown @@ -119,7 +119,9 @@ In addition to all arguments above, the following attributes are exported: * `replication_specs` - Configuration for cluster regions. See [Replication Spec](#replication-spec) below for more details. -* `container_id` - The Network Peering Container ID. +* `container_id` - The Network Peering Container ID. + +-> **NOTE:** If you need to get an existing container ID see the [How-To Guide](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/howto-guide.html). * `version_release_system` - Release cadence that Atlas uses for this cluster. @@ -214,4 +216,4 @@ Contains a key-value pair that tags that the cluster was created by a Terraform * `sample_refresh_interval_bi_connector` - Interval in seconds at which the mongosqld process re-samples data to create its relational schema. The default value is 300. The specified value must be a positive integer. Available only for Atlas deployments in which BI Connector for Atlas is enabled. -See detailed information for arguments and attributes: [MongoDB API Clusters](https://docs.atlas.mongodb.com/reference/api/clusters-create-one/) +See detailed information for arguments and attributes: [MongoDB API Clusters](https://docs.atlas.mongodb.com/reference/api/clusters-create-one/) \ No newline at end of file diff --git a/website/docs/d/network_container.html.markdown b/website/docs/d/network_container.html.markdown index bf62f23d25..a5003966b3 100644 --- a/website/docs/d/network_container.html.markdown +++ b/website/docs/d/network_container.html.markdown @@ -59,3 +59,5 @@ In addition to all arguments above, the following attributes are exported: See detailed information for arguments and attributes: [MongoDB API Network Peering Container](https://docs.atlas.mongodb.com/reference/api/vpc-create-container/) + +-> **NOTE:** If you need to get an existing container ID see the [How-To Guide](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/howto-guide.html). \ No newline at end of file diff --git a/website/docs/d/network_containers.html.markdown b/website/docs/d/network_containers.html.markdown index 99671c52fd..19542a0e72 100644 --- a/website/docs/d/network_containers.html.markdown +++ b/website/docs/d/network_containers.html.markdown @@ -62,3 +62,5 @@ In addition to all arguments above, the following attributes are exported: See detailed information for arguments and attributes: [MongoDB API Network Peering Container](https://docs.atlas.mongodb.com/reference/api/vpc-get-containers-list/) + +-> **NOTE:** If you need to get an existing container ID see the [How-To Guide](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/howto-guide.html). \ No newline at end of file diff --git a/website/docs/d/network_peering.html.markdown b/website/docs/d/network_peering.html.markdown index e4e6383163..e83a9d9383 100644 --- a/website/docs/d/network_peering.html.markdown +++ b/website/docs/d/network_peering.html.markdown @@ -12,6 +12,8 @@ description: |- -> **NOTE:** Groups and projects are synonymous terms. You may find **group_id** in the official documentation. +-> **NOTE:** If you need to get an existing container ID see the [How-To Guide](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/howto-guide.html). + ## Example Usage diff --git a/website/docs/guides/howto-guide.html.markdown b/website/docs/guides/howto-guide.html.markdown new file mode 100644 index 0000000000..6e835d1722 --- /dev/null +++ b/website/docs/guides/howto-guide.html.markdown @@ -0,0 +1,107 @@ +--- +layout: "mongodbatlas" +page_title: "MongoDB Atlas Provider How-To Guide" +sidebar_current: "docs-mongodbatlas-guides-how-to-guide" +description: |- +MongoDB Atlas Provider : How-To Guide +--- + +# MongoDB Atlas Provider: How-To Guide + +The Terraform MongoDB Atlas Provider guide to perform common tasks with the provider. + +##How to Get A Pre-existing Container ID + +The following is an end to end example of how to get an existing container id. + +1) Start with an empty project + +2) Empty state file + +3) Apply a curl command to build cluster + +4) Run `terraform apply` to retrieve the container id + +The following illustrates step 3 and 4 above, assuming 1 & 2 were true: + +1) Create a cluster using a curl command to simulate non-Terraform created cluster. This will also create a container. + +``` +curl --user "pub:priv" --digest \ +--header "Content-Type: application/json" \ +--include \ +--request POST "https://cloud.mongodb.com/api/atlas/v1.0/groups/grpid/clusters?pretty=true" \ +--data ' +{ + "name": "SingleRegionCluster", + "numShards": 1, + "providerSettings": { + "providerName": "AWS", + "instanceSizeName": "M40", + "regionName": "US_EAST_1" + }, + "clusterType": "REPLICASET", + "replicationFactor": 3, + "replicationSpecs": [ + { + "numShards": 1, + "regionsConfig": { + "US_EAST_1": { + "analyticsNodes": 0, + "electableNodes": 3, + "priority": 7, + "readOnlyNodes": 0 + } + }, + "zoneName": "Zone 1" + } + ], + "backupEnabled": false, + "autoScaling": { + "diskGBEnabled": true + } +}' +``` + + + +2) Then apply this Terraform config to then read the information from the appropriate Data Sources and output the container id. + + +``` +data "mongodbatlas_cluster" "admin" { + name = "SingleRegionCluster" + project_id = local.mongodbatlas_project_id +} + +data "mongodbatlas_network_container" "admin" { + project_id = local.mongodbatlas_project_id + container_id = data.mongodbatlas_cluster.admin.container_id +} + +output "container" { + value = data.mongodbatlas_network_container.admin.container_id +} + +Apply complete! Resources: 0 added, 0 changed, 0 destroyed. + +Outputs: + +container = "62ffe4ecb79e2e007c375935" +``` + + +This example was tested using versions: +- darwin_amd64 +- provider registry.terraform.io/hashicorp/aws v4.26.0 +- provider registry.terraform.io/mongodb/mongodbatlas v1.4.3 + + +### Helpful Links + +* [Report bugs](https://github.com/mongodb/terraform-provider-mongodbatlas/issues) + +* [Request Features](https://feedback.mongodb.com/forums/924145-atlas?category_id=370723) + +* [Contact Support](https://docs.atlas.mongodb.com/support/) covered by MongoDB Atlas support plans, Developer and above. + \ No newline at end of file diff --git a/website/docs/r/cluster.html.markdown b/website/docs/r/cluster.html.markdown index 442f571f75..c0dd6ec715 100644 --- a/website/docs/r/cluster.html.markdown +++ b/website/docs/r/cluster.html.markdown @@ -14,6 +14,8 @@ description: |- -> **NOTE:** A network container is created for a cluster to reside in if one does not yet exist in the project. To use this automatically created container with another resource, such as peering, the `container_id` is exported after creation. +-> **NOTE:** If you need to get an existing container ID see the [How-To Guide](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/howto-guide.html). + ~> **IMPORTANT:**
• New Users: If you are not already using `mongodbatlas_cluster` for your deployment we recommend starting with the [`mongodbatlas_advanced_cluster`](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/advanced_cluster). `mongodbatlas_advanced_cluster` has all the same functionality as `mongodbatlas_cluster` but also supports multi-cloud clusters.
• Free tier cluster creation (M0) is supported. diff --git a/website/docs/r/network_container.html.markdown b/website/docs/r/network_container.html.markdown index f55a9fa366..3b020764a9 100644 --- a/website/docs/r/network_container.html.markdown +++ b/website/docs/r/network_container.html.markdown @@ -108,3 +108,5 @@ $ terraform import mongodbatlas_network_container.my_container 1112222b3bf994038 ``` See detailed information for arguments and attributes: [MongoDB API Network Peering Container](https://docs.atlas.mongodb.com/reference/api/vpc-create-container/) + +-> **NOTE:** If you need to get an existing container ID see the [How-To Guide](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/howto-guide.html). \ No newline at end of file diff --git a/website/docs/r/network_peering.html.markdown b/website/docs/r/network_peering.html.markdown index 5a73a68643..ebdecc5eb4 100644 --- a/website/docs/r/network_peering.html.markdown +++ b/website/docs/r/network_peering.html.markdown @@ -431,3 +431,5 @@ $ terraform import mongodbatlas_network_peering.my_peering 1112222b3bf99403840e8 ``` See detailed information for arguments and attributes: [MongoDB API Network Peering Connection](https://docs.atlas.mongodb.com/reference/api/vpc-create-peering-connection/) + +-> **NOTE:** If you need to get an existing container ID see the [How-To Guide](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/howto-guide.html). \ No newline at end of file From e0edf107388aed4b1c260ef5add9f446bcb493e4 Mon Sep 17 00:00:00 2001 From: admin <33664051+martinstibbe@users.noreply.github.com> Date: Tue, 1 Nov 2022 19:11:59 -0500 Subject: [PATCH 10/13] Update CHANGELOG.md --- CHANGELOG.md | 75 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 63 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b9ba3e789..09d586d8c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,22 +1,73 @@ +## [v1.5.0](https://github.com/mongodb/terraform-provider-mongodbatlas/tree/v1.5.0) (2022-11-01) + +[Full Changelog](https://github.com/mongodb/terraform-provider-mongodbatlas/compare/v1.4.6...v1.5.0) + +**Fixed** + +- INTMDB-224 Support AtlasGov with Terraform [\#865](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/865) +- INTMDB-314 Feature add: Add ability to upgrade shared/TENANT tiers for clusters and advanced clusters [\#874](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/874) +- INTMDB-326 Review code/tests and docs for resource_mongodbatlas_search_index [\#891](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/891) +- INTMDB-334 Determine best path forward for GCP PSC timeouts and implement [\#859](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/859) +- INTMDB-364 Add support for serverless private endpoints (AWS) [\#314](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/314) +- INTMDB-370 Docs not complete for cloud_backup_snapshot_restore_job [\#870](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/870) +- INTMDB-373 Add new notification parameters to the mongodbatlas_alert_config resource [\#883](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/883) +- INTMDB-377 Release 1.5 (both pre and then GA) [\#](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/) +- INTMDB-378 Document for users how to get a pre-existing container id [\#883](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/883) +- INTMDB-394 MS Teams alert support in terraform provider is missing [\#](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/) +- INTMDB-405 Add cluster label to advanced clusters [\#857](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/857) +- INTMDB-406 MILLION_RPU unit isn't supported by provider #854 [\#854](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/854) +- INTMDB-403 Update third_party_integration.markdown [\#851](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/851) +- INTMDB-384 Fix PrivateLink test flakiness [\#895](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/895) + +**Closed issues:** +- MS Teams alert support in terraform provider is missing [\#827](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/827) +- MILLION_RPU unit isn't supported by provider not_stale [\#854](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/854) + +**Merged pull requests:** +- Chore(deps): Bump octokit/request-action from 2.1.6 to 2.1.7 [\#868](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/868) +- Docs: fix custom_dns_configuration_cluster_aws [\#860](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/860) +- INTMDB-403: Update third_party_integration.markdown [\#851](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/851) +- INTMDB-404: mongodbatlas_advanced_cluster doc updates [\#852](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/852) +- Docs: fix custom_dns_configuration_cluster_aws [\#860](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/860) +- Relying on atlas api for unit validation on alert configuration [\#862](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/862) +- INTMD-428: doc update to "mongodbatlas_projects" [\#869](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/869) +- Adding a github actions to automatically close stale issues/PRs based on CLOUDP-79100 [\#872](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/872) +- Chore(deps): Bump github.com/gruntwork-io/terratest from 0.40.22 to 0.40.24 [\#875](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/875) +- Update cluster.html.markdown [\#878](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/878) +- Update teams.html.markdown [\#881](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/881) +- INTMDB-378: Add link for How To Guide for existing container ID [\#883](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/883) +- Encryption_at_rest M10+ limit doc update [\#886](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/886) +- Add APIx1 CODEOWNER [\#894](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/894) +- Chore(deps): Bump golangci/golangci-lint-action from 3.2.0 to 3.3.0 [\#897](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/897) + + + +- Chore(deps): Bump github.com/gruntwork-io/terratest from 0.40.21 to 0.40.22 [\#842](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/842) ([dependabot[bot]](https://github.com/apps/dependabot)) + +- Rename team.html.markdown into teams.html.markdown [\#838](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/838) ([leo-ferlin-sutton](https://github.com/leo-ferlin-sutton)) + +- Chore(deps): Bump github.com/gruntwork-io/terratest from 0.40.20 to 0.40.21 [\#825](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/825) ([dependabot[bot]](https://github.com/apps/dependabot)) + +- Fix create index error msg[\#824](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/824) ([ebouther](https://github.com/ebouther)) ## [v1.4.6](https://github.com/mongodb/terraform-provider-mongodbatlas/tree/v1.4.6) (2022-09-19) [Full Changelog](https://github.com/mongodb/terraform-provider-mongodbatlas/compare/v1.4.5...v1.4.6) **Fixed** -- INTMDB-387 - [Terraform] Enable Azure NVME for Atlas Dedicated clusters [\#833](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/833) -- INTMDB-342 - [Terraform] Update TestAccDataSourceMongoDBAtlasPrivateEndpointRegionalMode_basic test to use a new project to prevent conflicts [\#837](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/837) -- INTMDB-347 - [Terraform] cloud_backup is not being correctly imported - issue [\#768](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/768) -- INTMDB-354 - [Terraform] Update docs around what requires an API key access list [\#834](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/834) +- INTMDB-387 - Enable Azure NVME for Atlas Dedicated clusters [\#833](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/833) +- INTMDB-342 - Update TestAccDataSourceMongoDBAtlasPrivateEndpointRegionalMode_basic test to use a new project to prevent conflicts [\#837](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/837) +- INTMDB-347 - Cloud_backup is not being correctly imported - issue [\#768](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/768) +- INTMDB-354 - Update docs around what requires an API key access list [\#834](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/834) - INTMDB-363 - [Updated Feature] Add serverless backup to mongodbatlas_serverless_instance [\#830](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/830) -- INTMDB-379 - [Terraform] Release 1.4.6 (both pre and then GA) -- INTMDB-381 - [Terraform] Customer is unable to disable backup auto export [\#823](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/823) -- INTMDB-383 - [Terraform] Update the BYOK/encryption at rest resource [\#805](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/805) +- INTMDB-379 - Release 1.4.6 (both pre and then GA) +- INTMDB-381 - Customer is unable to disable backup auto export [\#823](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/823) +- INTMDB-383 - Update the BYOK/encryption at rest resource [\#805](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/805) - INTMDB-385 - use_org_and_group_names_in_export_prefix is not working for a customer -- INTMDB-386 - [Terraform] Add new role types to invitation verification [\#840](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/840) -- INTMDB-371 - [Terraform] Timeout when creating privatelink_endpoint [\#806](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/806) -- INTMDB-372 - [Terraform] Fix failing test for testAccMongoDBAtlasAlertConfigurationConfigWithMatchers [\#836](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/836) -- INTMDB-358 - [terraform] Upgrade to go1.18 [\#835](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/835) -- INTMDB-391 - [Terraform] Doc Fix for teams.html.markdown [\#838](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/838) +- INTMDB-386 - Add new role types to invitation verification [\#840](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/840) +- INTMDB-371 - Timeout when creating privatelink_endpoint [\#806](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/806) +- INTMDB-372 - Fix failing test for testAccMongoDBAtlasAlertConfigurationConfigWithMatchers [\#836](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/836) +- INTMDB-358 - Upgrade to go1.18 [\#835](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/835) +- INTMDB-391 - Doc Fix for teams.html.markdown [\#838](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/838) **Closed issues:** - importing existing cluster does not populate backup status #768 [\#768](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/768) From ed37f306fba7fb6ba72916ae66276d78e9c0e194 Mon Sep 17 00:00:00 2001 From: admin <33664051+martinstibbe@users.noreply.github.com> Date: Wed, 2 Nov 2022 07:40:37 -0500 Subject: [PATCH 11/13] Update CHANGELOG.md --- CHANGELOG.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09d586d8c8..f75745aea6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,6 @@ - INTMDB-405 Add cluster label to advanced clusters [\#857](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/857) - INTMDB-406 MILLION_RPU unit isn't supported by provider #854 [\#854](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/854) - INTMDB-403 Update third_party_integration.markdown [\#851](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/851) -- INTMDB-384 Fix PrivateLink test flakiness [\#895](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/895) **Closed issues:** - MS Teams alert support in terraform provider is missing [\#827](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/827) @@ -40,15 +39,6 @@ - Add APIx1 CODEOWNER [\#894](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/894) - Chore(deps): Bump golangci/golangci-lint-action from 3.2.0 to 3.3.0 [\#897](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/897) - - -- Chore(deps): Bump github.com/gruntwork-io/terratest from 0.40.21 to 0.40.22 [\#842](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/842) ([dependabot[bot]](https://github.com/apps/dependabot)) - -- Rename team.html.markdown into teams.html.markdown [\#838](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/838) ([leo-ferlin-sutton](https://github.com/leo-ferlin-sutton)) - -- Chore(deps): Bump github.com/gruntwork-io/terratest from 0.40.20 to 0.40.21 [\#825](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/825) ([dependabot[bot]](https://github.com/apps/dependabot)) - -- Fix create index error msg[\#824](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/824) ([ebouther](https://github.com/ebouther)) ## [v1.4.6](https://github.com/mongodb/terraform-provider-mongodbatlas/tree/v1.4.6) (2022-09-19) [Full Changelog](https://github.com/mongodb/terraform-provider-mongodbatlas/compare/v1.4.5...v1.4.6) From 3ce1092bf616b1695169746db6ca8c2b46c449fe Mon Sep 17 00:00:00 2001 From: Dosty Everts Date: Wed, 2 Nov 2022 08:15:33 -0500 Subject: [PATCH 12/13] INTMDB-314 Cluster Tenant Upgrade (#874) * Initial commit for cluster upgrade * Updated to use a custom customizeDiff func * Setting cluster_id and resource ID to the updated values in the case of a cluster upgrade * Updated logic for determining whether upgrade is required * Removed conflation on willUpgrade and tenant changes. Added error checking * Updated cluster docs to denote upgrade support * Added an example tenant upgrade * Fixed formatting issues * Added code to upgrade advanced_cluster * Moved example again, for some reason * Moved examples, got advanced-cluster tenantUpgrade working * Fixed linter issues with advanced cluster * removed unnecessary explicit setting of cluster_id * Updated new examples to work with tf 0.13 * Update website/docs/r/advanced_cluster.html.markdown Co-authored-by: Melissa Plunkett * Update website/docs/r/advanced_cluster.html.markdown Co-authored-by: Melissa Plunkett * Update website/docs/r/advanced_cluster.html.markdown Co-authored-by: Melissa Plunkett * Update website/docs/r/cluster.html.markdown Co-authored-by: Melissa Plunkett * Addressed some criticisms of new tenant-upgrade examples * Applied suggested docs changes for cluster tenant upgrade * Apply suggestions from code review Applied docs changes suggested for advanced-cluster tenant upgrade readme Co-authored-by: Melissa Plunkett * Updated cluster tenant upgrade readme to match that of the advanced cluster * Addressed last remaining README suggestions for new examples * Fixed naming on variables and re-pausing cluster after upgrade if necessary * Reduced nested ifs in cluster update * No longer attempting to unpause tenant tier clusters prior to upgrade. Any updates fail * Fixed linter error on bool init Co-authored-by: Melissa Plunkett --- .../tenant-upgrade/README.md | 32 +++++ .../tenant-upgrade/main.tf | 29 ++++ .../tenant-upgrade/variables.tf | 22 +++ .../tenant-upgrade/versions.tf | 8 ++ .../atlas-cluster/tenant-upgrade/README.md | 33 +++++ examples/atlas-cluster/tenant-upgrade/main.tf | 19 +++ .../atlas-cluster/tenant-upgrade/variables.tf | 22 +++ .../atlas-cluster/tenant-upgrade/versions.tf | 8 ++ .../resource_mongodbatlas_advanced_cluster.go | 74 +++++++++- mongodbatlas/resource_mongodbatlas_cluster.go | 133 ++++++++++++++---- website/docs/r/advanced_cluster.html.markdown | 23 +++ website/docs/r/cluster.html.markdown | 12 +- 12 files changed, 388 insertions(+), 27 deletions(-) create mode 100644 examples/atlas-advanced-cluster/tenant-upgrade/README.md create mode 100644 examples/atlas-advanced-cluster/tenant-upgrade/main.tf create mode 100644 examples/atlas-advanced-cluster/tenant-upgrade/variables.tf create mode 100644 examples/atlas-advanced-cluster/tenant-upgrade/versions.tf create mode 100644 examples/atlas-cluster/tenant-upgrade/README.md create mode 100644 examples/atlas-cluster/tenant-upgrade/main.tf create mode 100644 examples/atlas-cluster/tenant-upgrade/variables.tf create mode 100644 examples/atlas-cluster/tenant-upgrade/versions.tf diff --git a/examples/atlas-advanced-cluster/tenant-upgrade/README.md b/examples/atlas-advanced-cluster/tenant-upgrade/README.md new file mode 100644 index 0000000000..5051df631b --- /dev/null +++ b/examples/atlas-advanced-cluster/tenant-upgrade/README.md @@ -0,0 +1,32 @@ +# MongoDB Atlas Provider -- Advanced Cluster Tenant Upgrade +This example creates a project and cluster. It is intended to show how to upgrade from shared, aka tenant, to dedicated tier. + +Variables Required: +- `atlas_org_id`: ID of the Atlas organization +- `public_key`: Atlas public key +- `private_key`: Atlas private key +- `provider_name`: Name of provider to use for cluster (TENANT, AWS, GCP) +- `backing_provider_name`: If provider_name is tenant, the backing provider (AWS, GCP) +- `provider_instance_size_name`: Size of the cluster (Shared: M0, M2, M5, Dedicated: M10+.) + +For this example, first we'll start out on the shared tier, then upgrade to a dedicated tier. + +Utilize the following to execute a working example, replacing the org id, public and private key with your values: + +Apply with the following `terraform.tfvars` to first create a shared tier cluster: +``` +atlas_org_id = "627a9687f7f7f7f774de306f14" +public_key = +private_key = +provider_name = "TENANT" +backing_provider_name = "AWS" +provider_instance_size_name = "M2" +``` + +Apply with the following `terraform.tfvars` to upgrade the shared tier cluster you just created to dedicated tier: +``` +atlas_org_id = "627a9687f7f7f7f774de306f14" +public_key = +private_key = +provider_name = "GCP" +provider_instance_size_name = "M10" \ No newline at end of file diff --git a/examples/atlas-advanced-cluster/tenant-upgrade/main.tf b/examples/atlas-advanced-cluster/tenant-upgrade/main.tf new file mode 100644 index 0000000000..8ee986e7e2 --- /dev/null +++ b/examples/atlas-advanced-cluster/tenant-upgrade/main.tf @@ -0,0 +1,29 @@ +provider "mongodbatlas" { + public_key = var.public_key + private_key = var.private_key +} + +resource "mongodbatlas_advanced_cluster" "cluster" { + project_id = mongodbatlas_project.project.id + name = "ClusterToUpgrade" + cluster_type = "REPLICASET" + + replication_specs { + num_shards = 1 + + region_configs { + electable_specs { + instance_size = var.provider_instance_size_name + } + provider_name = var.provider_name + backing_provider_name = var.backing_provider_name + region_name = "US_EAST_1" + priority = 7 + } + } +} + +resource "mongodbatlas_project" "project" { + name = "TenantUpgradeTest" + org_id = var.atlas_org_id +} \ No newline at end of file diff --git a/examples/atlas-advanced-cluster/tenant-upgrade/variables.tf b/examples/atlas-advanced-cluster/tenant-upgrade/variables.tf new file mode 100644 index 0000000000..2986570c19 --- /dev/null +++ b/examples/atlas-advanced-cluster/tenant-upgrade/variables.tf @@ -0,0 +1,22 @@ +variable "atlas_org_id" { + description = "Atlas organization id" + default = "" +} +variable "public_key" { + description = "Public API key to authenticate to Atlas" +} +variable "private_key" { + description = "Private API key to authenticate to Atlas" +} +variable "provider_name" { + description = "Atlas cluster provider name" + default = "AWS" +} +variable "backing_provider_name" { + description = "Atlas cluster backing provider name" + default = null +} +variable "provider_instance_size_name" { + description = "Atlas cluster provider instance name" + default = "M10" +} \ No newline at end of file diff --git a/examples/atlas-advanced-cluster/tenant-upgrade/versions.tf b/examples/atlas-advanced-cluster/tenant-upgrade/versions.tf new file mode 100644 index 0000000000..92fca3b63d --- /dev/null +++ b/examples/atlas-advanced-cluster/tenant-upgrade/versions.tf @@ -0,0 +1,8 @@ +terraform { + required_providers { + mongodbatlas = { + source = "mongodb/mongodbatlas" + } + } + required_version = ">= 0.13" +} \ No newline at end of file diff --git a/examples/atlas-cluster/tenant-upgrade/README.md b/examples/atlas-cluster/tenant-upgrade/README.md new file mode 100644 index 0000000000..34c91e11a5 --- /dev/null +++ b/examples/atlas-cluster/tenant-upgrade/README.md @@ -0,0 +1,33 @@ +# MongoDB Atlas Provider -- Cluster Tenant Upgrade +This example creates a project and cluster. It is intended to show how to upgrade from shared, aka tenant, to dedicated tier. + +Variables Required: +- `atlas_org_id`: ID of the Atlas organization +- `public_key`: Atlas public key +- `private_key`: Atlas private key +- `provider_name`: Name of provider to use for cluster (TENANT, AWS, GCP) +- `backing_provider_name`: If provider_name is tenant, the backing provider (AWS, GCP) +- `provider_instance_size_name`: Size of the cluster (Shared: M0, M2, M5, Dedicated: M10+.) + +For this example, first we'll start out on the shared tier, then upgrade to a dedicated tier. + + +Utilize the following to execute a working example, replacing the org id, public and private key with your values: + +Apply with the following `terraform.tfvars` to first create a shared tier cluster: +``` +atlas_org_id = "627a9687f7f7f7f774de306f14" +public_key = +private_key = +provider_name = "TENANT" +backing_provider_name = "AWS" +provider_instance_size_name = "M2" +``` + +Apply with the following `terraform.tfvars` to upgrade the shared tier cluster you just created to dedicated tier: +``` +atlas_org_id = "627a9687f7f7f7f774de306f14" +public_key = +private_key = +provider_name = "GCP" +provider_instance_size_name = "M10" \ No newline at end of file diff --git a/examples/atlas-cluster/tenant-upgrade/main.tf b/examples/atlas-cluster/tenant-upgrade/main.tf new file mode 100644 index 0000000000..6896f35e6d --- /dev/null +++ b/examples/atlas-cluster/tenant-upgrade/main.tf @@ -0,0 +1,19 @@ +provider "mongodbatlas" { + public_key = var.public_key + private_key = var.private_key +} + +resource "mongodbatlas_cluster" "cluster" { + project_id = mongodbatlas_project.project.id + name = "ClusterToUpgrade" + cluster_type = "REPLICASET" + provider_name = var.provider_name + backing_provider_name = var.backing_provider_name + provider_region_name = "US_EAST_1" + provider_instance_size_name = var.provider_instance_size_name +} + +resource "mongodbatlas_project" "project" { + name = "TenantUpgradeTest" + org_id = var.atlas_org_id +} diff --git a/examples/atlas-cluster/tenant-upgrade/variables.tf b/examples/atlas-cluster/tenant-upgrade/variables.tf new file mode 100644 index 0000000000..2986570c19 --- /dev/null +++ b/examples/atlas-cluster/tenant-upgrade/variables.tf @@ -0,0 +1,22 @@ +variable "atlas_org_id" { + description = "Atlas organization id" + default = "" +} +variable "public_key" { + description = "Public API key to authenticate to Atlas" +} +variable "private_key" { + description = "Private API key to authenticate to Atlas" +} +variable "provider_name" { + description = "Atlas cluster provider name" + default = "AWS" +} +variable "backing_provider_name" { + description = "Atlas cluster backing provider name" + default = null +} +variable "provider_instance_size_name" { + description = "Atlas cluster provider instance name" + default = "M10" +} \ No newline at end of file diff --git a/examples/atlas-cluster/tenant-upgrade/versions.tf b/examples/atlas-cluster/tenant-upgrade/versions.tf new file mode 100644 index 0000000000..92fca3b63d --- /dev/null +++ b/examples/atlas-cluster/tenant-upgrade/versions.tf @@ -0,0 +1,8 @@ +terraform { + required_providers { + mongodbatlas = { + source = "mongodb/mongodbatlas" + } + } + required_version = ">= 0.13" +} \ No newline at end of file diff --git a/mongodbatlas/resource_mongodbatlas_advanced_cluster.go b/mongodbatlas/resource_mongodbatlas_advanced_cluster.go index 3f0f2df10c..5787698028 100644 --- a/mongodbatlas/resource_mongodbatlas_advanced_cluster.go +++ b/mongodbatlas/resource_mongodbatlas_advanced_cluster.go @@ -21,6 +21,8 @@ import ( matlas "go.mongodb.org/atlas/mongodbatlas" ) +type acCtxKey string + const ( errorClusterAdvancedCreate = "error creating MongoDB ClusterAdvanced: %s" errorClusterAdvancedRead = "error reading MongoDB ClusterAdvanced (%s): %s" @@ -31,11 +33,13 @@ const ( errorAdvancedClusterAdvancedConfRead = "error reading Advanced Configuration Option form MongoDB Cluster (%s): %s" ) +var upgradeRequestCtxKey acCtxKey = "upgradeRequest" + func resourceMongoDBAtlasAdvancedCluster() *schema.Resource { return &schema.Resource{ CreateWithoutTimeout: resourceMongoDBAtlasAdvancedClusterCreate, ReadWithoutTimeout: resourceMongoDBAtlasAdvancedClusterRead, - UpdateWithoutTimeout: resourceMongoDBAtlasAdvancedClusterUpdate, + UpdateWithoutTimeout: resourceMongoDBAtlasAdvancedClusterUpdateOrUpgrade, DeleteWithoutTimeout: resourceMongoDBAtlasAdvancedClusterDelete, Importer: &schema.ResourceImporter{ StateContext: resourceMongoDBAtlasAdvancedClusterImportState, @@ -509,6 +513,42 @@ func resourceMongoDBAtlasAdvancedClusterRead(ctx context.Context, d *schema.Reso return nil } +func resourceMongoDBAtlasAdvancedClusterUpdateOrUpgrade(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + if upgradeRequest := getUpgradeRequest(d); upgradeRequest != nil { + upgradeCtx := context.WithValue(ctx, upgradeRequestCtxKey, upgradeRequest) + return resourceMongoDBAtlasAdvancedClusterUpgrade(upgradeCtx, d, meta) + } + + return resourceMongoDBAtlasAdvancedClusterUpdate(ctx, d, meta) +} + +func resourceMongoDBAtlasAdvancedClusterUpgrade(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + conn := meta.(*MongoDBClient).Atlas + ids := decodeStateID(d.Id()) + projectID := ids["project_id"] + clusterName := ids["cluster_name"] + + upgradeRequest := ctx.Value(upgradeRequestCtxKey).(*matlas.Cluster) + + if upgradeRequest == nil { + return diag.FromErr(fmt.Errorf("upgrade called without %s in ctx", string(upgradeRequestCtxKey))) + } + + upgradeResponse, _, err := upgradeCluster(ctx, conn, upgradeRequest, projectID, clusterName) + + if err != nil { + return diag.FromErr(fmt.Errorf(errorClusterAdvancedUpdate, clusterName, err)) + } + + d.SetId(encodeStateID(map[string]string{ + "cluster_id": upgradeResponse.ID, + "project_id": projectID, + "cluster_name": clusterName, + })) + + return resourceMongoDBAtlasAdvancedClusterRead(ctx, d, meta) +} + func resourceMongoDBAtlasAdvancedClusterUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { // Get client connection. conn := meta.(*MongoDBClient).Atlas @@ -1077,6 +1117,38 @@ func replicationSpecsHashSet(v interface{}) int { return schema.HashString(buf.String()) } +func getUpgradeRequest(d *schema.ResourceData) *matlas.Cluster { + if !d.HasChange("replication_specs") { + return nil + } + + cs, us := d.GetChange("replication_specs") + currentSpecs := expandAdvancedReplicationSpecs(cs.(*schema.Set).List()) + updatedSpecs := expandAdvancedReplicationSpecs(us.(*schema.Set).List()) + + if len(currentSpecs) != 1 || len(updatedSpecs) != 1 || len(currentSpecs[0].RegionConfigs) != 1 || len(updatedSpecs[0].RegionConfigs) != 1 { + return nil + } + + currentRegion := currentSpecs[0].RegionConfigs[0] + updatedRegion := updatedSpecs[0].RegionConfigs[0] + currentSize := currentRegion.ElectableSpecs.InstanceSize + + if currentRegion.ElectableSpecs.InstanceSize == updatedRegion.ElectableSpecs.InstanceSize || !(currentSize == "M0" || + currentSize == "M2" || + currentSize == "M5") { + return nil + } + + return &matlas.Cluster{ + ProviderSettings: &matlas.ProviderSettings{ + ProviderName: updatedRegion.ProviderName, + InstanceSizeName: updatedRegion.ElectableSpecs.InstanceSize, + RegionName: updatedRegion.RegionName, + }, + } +} + func updateAdvancedCluster(ctx context.Context, conn *matlas.Client, request *matlas.AdvancedCluster, projectID, name string) (*matlas.AdvancedCluster, *matlas.Response, error) { cluster, resp, err := conn.AdvancedClusters.Update(ctx, projectID, name, request) if err != nil { diff --git a/mongodbatlas/resource_mongodbatlas_cluster.go b/mongodbatlas/resource_mongodbatlas_cluster.go index 980f25c1bc..47d208c5c2 100644 --- a/mongodbatlas/resource_mongodbatlas_cluster.go +++ b/mongodbatlas/resource_mongodbatlas_cluster.go @@ -161,7 +161,6 @@ func resourceMongoDBAtlasCluster() *schema.Resource { }, "provider_name": { Type: schema.TypeString, - ForceNew: true, Required: true, }, "pit_enabled": { @@ -353,6 +352,7 @@ func resourceMongoDBAtlasCluster() *schema.Resource { ValidateFunc: validation.StringInSlice([]string{"LTS", "CONTINUOUS"}, false), }, }, + CustomizeDiff: resourceClusterCustomizeDiff, } } @@ -900,27 +900,42 @@ func resourceMongoDBAtlasClusterUpdate(ctx context.Context, d *schema.ResourceDa } } - // Has changes - if !reflect.DeepEqual(cluster, matlas.Cluster{}) { + var didUnpauseCluster = false + + if isUpgradeRequired(d) { + updatedCluster, _, err := upgradeCluster(ctx, conn, cluster, projectID, clusterName) + + if err != nil { + return diag.FromErr(fmt.Errorf(errorClusterUpdate, clusterName, err)) + } + + d.SetId(encodeStateID(map[string]string{ + "cluster_id": updatedCluster.ID, + "project_id": projectID, + "cluster_name": updatedCluster.Name, + "provider_name": updatedCluster.ProviderSettings.ProviderName, + })) + } else if !reflect.DeepEqual(cluster, matlas.Cluster{}) { err := resource.RetryContext(ctx, 3*time.Hour, func() *resource.RetryError { _, _, err := updateCluster(ctx, conn, cluster, projectID, clusterName) - if err != nil { - var target *matlas.ErrorResponse - if errors.As(err, &target) && target.ErrorCode == "CANNOT_UPDATE_PAUSED_CLUSTER" { - clusterRequest := &matlas.Cluster{ - Paused: pointy.Bool(false), - } - _, _, err := updateCluster(ctx, conn, clusterRequest, projectID, clusterName) - if err != nil { - return resource.NonRetryableError(fmt.Errorf(errorClusterUpdate, clusterName, err)) - } - } - if errors.As(err, &target) && target.HTTPCode == 400 { - return resource.NonRetryableError(fmt.Errorf(errorClusterUpdate, clusterName, err)) + + if didErrOnPausedCluster(err) { + clusterRequest := &matlas.Cluster{ + Paused: pointy.Bool(false), } + + _, _, err = updateCluster(ctx, conn, clusterRequest, projectID, clusterName) + + didUnpauseCluster = true } + + if err != nil { + return resource.NonRetryableError(fmt.Errorf(errorClusterUpdate, clusterName, err)) + } + return nil }) + if err != nil { return diag.FromErr(fmt.Errorf(errorClusterUpdate, clusterName, err)) } @@ -942,7 +957,7 @@ func resourceMongoDBAtlasClusterUpdate(ctx context.Context, d *schema.ResourceDa } } - if d.Get("paused").(bool) { + if didUnpauseCluster { clusterRequest := &matlas.Cluster{ Paused: pointy.Bool(true), } @@ -956,6 +971,16 @@ func resourceMongoDBAtlasClusterUpdate(ctx context.Context, d *schema.ResourceDa return resourceMongoDBAtlasClusterRead(ctx, d, meta) } +func didErrOnPausedCluster(err error) bool { + if err == nil { + return false + } + + var target *matlas.ErrorResponse + + return errors.As(err, &target) && target.ErrorCode == "CANNOT_UPDATE_PAUSED_CLUSTER" +} + func resourceMongoDBAtlasClusterDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { // Get client connection. conn := meta.(*MongoDBClient).Atlas @@ -1116,6 +1141,7 @@ func expandProviderSetting(d *schema.ResourceData) (*matlas.ProviderSettings, er instanceSize = getInstanceSizeToInt(d.Get("provider_instance_size_name").(string)) compute *matlas.Compute autoScalingEnabled = d.Get("auto_scaling_compute_enabled").(bool) + providerName = cast.ToString(d.Get("provider_name")) ) if minInstanceSize != 0 && autoScalingEnabled { @@ -1140,12 +1166,15 @@ func expandProviderSetting(d *schema.ResourceData) (*matlas.ProviderSettings, er } providerSettings := &matlas.ProviderSettings{ - BackingProviderName: cast.ToString(d.Get("backing_provider_name")), - InstanceSizeName: cast.ToString(d.Get("provider_instance_size_name")), - ProviderName: cast.ToString(d.Get("provider_name")), - RegionName: region, - VolumeType: cast.ToString(d.Get("provider_volume_type")), - DiskTypeName: cast.ToString(d.Get("provider_disk_type_name")), + InstanceSizeName: cast.ToString(d.Get("provider_instance_size_name")), + ProviderName: providerName, + RegionName: region, + VolumeType: cast.ToString(d.Get("provider_volume_type")), + DiskTypeName: cast.ToString(d.Get("provider_disk_type_name")), + } + + if providerName == "TENANT" { + providerSettings.BackingProviderName = cast.ToString(d.Get("backing_provider_name")) } if autoScalingEnabled { @@ -1172,8 +1201,10 @@ func expandProviderSetting(d *schema.ResourceData) (*matlas.ProviderSettings, er } func flattenProviderSettings(d *schema.ResourceData, settings *matlas.ProviderSettings, clusterName string) { - if err := d.Set("backing_provider_name", settings.BackingProviderName); err != nil { - log.Printf(errorClusterSetting, "backing_provider_name", clusterName, err) + if settings.ProviderName == "TENANT" { + if err := d.Set("backing_provider_name", settings.BackingProviderName); err != nil { + log.Printf(errorClusterSetting, "backing_provider_name", clusterName, err) + } } if settings.DiskIOPS != nil && *settings.DiskIOPS != 0 { @@ -1209,6 +1240,16 @@ func flattenProviderSettings(d *schema.ResourceData, settings *matlas.ProviderSe } } +func isUpgradeRequired(d *schema.ResourceData) bool { + currentSize, updatedSize := d.GetChange("provider_instance_size_name") + + if currentSize == updatedSize { + return false + } + + return currentSize == "M0" || currentSize == "M2" || currentSize == "M5" +} + func expandReplicationSpecs(d *schema.ResourceData) ([]matlas.ReplicationSpec, error) { rSpecs := make([]matlas.ReplicationSpec, 0) @@ -1417,6 +1458,22 @@ func resourceClusterRefreshFunc(ctx context.Context, name, projectID string, cli } } +func resourceClusterCustomizeDiff(ctx context.Context, d *schema.ResourceDiff, meta interface{}) error { + var err error + currentProvider, updatedProvider := d.GetChange("provider_name") + + willProviderChange := currentProvider != updatedProvider + willLeaveTenant := willProviderChange && currentProvider == "TENANT" + + if willLeaveTenant { + err = d.SetNewComputed("backing_provider_name") + } else if willProviderChange { + err = d.ForceNew("provider_name") + } + + return err +} + func formatMongoDBMajorVersion(val interface{}) string { if strings.Contains(val.(string), ".") { return val.(string) @@ -1668,3 +1725,29 @@ func updateCluster(ctx context.Context, conn *matlas.Client, request *matlas.Clu return cluster, resp, nil } + +func upgradeCluster(ctx context.Context, conn *matlas.Client, request *matlas.Cluster, projectID, name string) (*matlas.Cluster, *matlas.Response, error) { + request.Name = name + + cluster, resp, err := conn.Clusters.Upgrade(ctx, projectID, request) + if err != nil { + return nil, nil, err + } + + stateConf := &resource.StateChangeConf{ + Pending: []string{"CREATING", "UPDATING", "REPAIRING"}, + Target: []string{"IDLE"}, + Refresh: resourceClusterRefreshFunc(ctx, name, projectID, conn), + Timeout: 3 * time.Hour, + MinTimeout: 30 * time.Second, + Delay: 1 * time.Minute, + } + + // Wait, catching any errors + _, err = stateConf.WaitForStateContext(ctx) + if err != nil { + return nil, nil, err + } + + return cluster, resp, nil +} diff --git a/website/docs/r/advanced_cluster.html.markdown b/website/docs/r/advanced_cluster.html.markdown index 5c39f82532..d58500d2f7 100644 --- a/website/docs/r/advanced_cluster.html.markdown +++ b/website/docs/r/advanced_cluster.html.markdown @@ -15,6 +15,8 @@ More information on considerations for using advanced clusters please see [Consi ~> **IMPORTANT:**
• The primary difference between [`mongodbatlas_cluster`](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/cluster) and [`mongodbatlas_advanced_cluster`](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/advanced_cluster) is that `mongodbatlas_advanced_cluster` supports multi-cloud clusters. We recommend new users start with the `mongodbatlas_advanced_cluster` resource. +
• Upgrading the shared tier is supported. Any change from a shared tier cluster, aka tenant, to a different instance size will be considered a tenant upgrade. When upgrading from the shared tier, change the `provider_name` from "TENANT" to your preferred provider (AWS, GCP or Azure) and remove the variable `backing_provider_name`. See the [Example Tenant Cluster Upgrade](#Example-Tenant-Cluster-Upgrade) below. Note you can upgrade a shared tier cluster only to a single provider M10 or greater. +
• WARNING WHEN UPGRADING TENANT/SHARED CLUSTERS!!! When upgrading from the shared tier *only* the upgrade changes will be applied. This is done in-order to avoid a corrupt state file in the event that the upgrade succeeds, but subsequent updates fail within the same `terraform apply`. In order to apply any other cluster changes, run a secondary `terraform apply` after the upgrade succeeds. -> **NOTE:** Groups and projects are synonymous terms. You may find group_id in the official documentation. -> **NOTE:** A network container is created for a advanced cluster to reside in if one does not yet exist in the project. To use this automatically created container with another resource, such as peering, the `container_id` is exported after creation. @@ -69,6 +71,27 @@ resource "mongodbatlas_advanced_cluster" "test" { } ``` +### Example Tenant Cluster Upgrade + +```terraform +resource "mongodbatlas_advanced_cluster" "test" { + project_id = "PROJECT ID" + name = "NAME OF CLUSTER" + cluster_type = "REPLICASET" + + replication_specs { + region_configs { + electable_specs { + instance_size = "M10" + } + provider_name = "AWS" + region_name = "US_EAST_1" + priority = 1 + } + } +} +``` + ### Example Multicloud. ```terraform diff --git a/website/docs/r/cluster.html.markdown b/website/docs/r/cluster.html.markdown index c0dd6ec715..c1c9758b53 100644 --- a/website/docs/r/cluster.html.markdown +++ b/website/docs/r/cluster.html.markdown @@ -19,7 +19,17 @@ description: |- ~> **IMPORTANT:**
• New Users: If you are not already using `mongodbatlas_cluster` for your deployment we recommend starting with the [`mongodbatlas_advanced_cluster`](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/advanced_cluster). `mongodbatlas_advanced_cluster` has all the same functionality as `mongodbatlas_cluster` but also supports multi-cloud clusters.
• Free tier cluster creation (M0) is supported. -
• Shared tier clusters (M0, M2, M5) cannot be upgraded to higher tiers via API or by this Provider. WARNING! If you attempt to upgrade from an existing shared tier cluster that you manage with this Provider to a dedicated cluster (M10+) Terraform will see it as a request to destroy the shared tier cluster and as a request to create a dedicated tier cluster, i.e. Terraform will not see it as a request to upgrade. If you accept the plan in this case the shared tier cluster would be destroyed and you would lose the data on that cluster. Do not attempt to upgrade from the shared to dedicated tier via this Provider, it is not supported! +
• Shared tier clusters (M0, M2, M5) can be upgraded to dedicated tiers (M10+) via this provider. WARNING WHEN UPGRADING TENANT/SHARED CLUSTERS!!! Any change from shared tier to a different instance size will be considered a tenant upgrade. When upgrading from shared tier to dedicated simply change the `provider_name` from "TENANT" to your preferred provider (AWS, GCP, AZURE) and remove the variable `backing_provider_name`, for example if you have an existing tenant/shared cluster and want to upgrade your Terraform config should be changed from: +``` +provider_instance_size_name = "M0" +provider_name = "TENANT" +backing_provider_name = "AWS" +``` +To: +``` +provider_instance_size_name = "M10" +provider_name = "AWS" +```
• Changes to cluster configurations can affect costs. Before making changes, please see [Billing](https://docs.atlas.mongodb.com/billing/).
• If your Atlas project contains a custom role that uses actions introduced in a specific MongoDB version, you cannot create a cluster with a MongoDB version less than that version unless you delete the custom role. From 6ca031f0413ddabb00ee0a609f972b7c9369097e Mon Sep 17 00:00:00 2001 From: admin <33664051+martinstibbe@users.noreply.github.com> Date: Wed, 2 Nov 2022 13:02:55 -0500 Subject: [PATCH 13/13] Update CHANGELOG.md --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f75745aea6..d70e54d113 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,7 +33,6 @@ - Adding a github actions to automatically close stale issues/PRs based on CLOUDP-79100 [\#872](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/872) - Chore(deps): Bump github.com/gruntwork-io/terratest from 0.40.22 to 0.40.24 [\#875](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/875) - Update cluster.html.markdown [\#878](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/878) -- Update teams.html.markdown [\#881](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/881) - INTMDB-378: Add link for How To Guide for existing container ID [\#883](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/883) - Encryption_at_rest M10+ limit doc update [\#886](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/886) - Add APIx1 CODEOWNER [\#894](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/894)