You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test: Ensures project withDefaultAlertsSettings works with import and introduce create_only plan modifier (#3105)
* fix: Sets default value for WithDefaultAlertsSettings during state import
* chore: Adds release note
* fix: Removes 'with_default_alerts_settings' from ImportStateVerifyIgnore in project tests when it is not set to `false` in earlier steps
* doc: update changelog message
* doc: Add back reference based on comments
* revert changes of old implementation
* refactor: Introduce Modifier interface and enhance non-updatable attribute handling to support multiple planmodifiers
* refactor: Mark with_default_alerts_settings as NonUpdateable
* refactor:Rename NonUpdatableAttributePlanModifier with CreateOnlyAttributePlanModifier in resource schemas
* feat: Implement CreateOnlyAttributePlanModifier with default boolean support and refactor IsKnown utility function
* chore: small fix to planModifier using state value when Unknown in the plan
* test: Support testing plan error after importing
* doc: Update error message in addDiags to clarify import restrictions
* chore: revert old changes for advancedclustertpf
* test: remove migration test util in favor of acc test step for empty plan check
* revert old changes
* doc: Updates docs with latest API docs
* refactor: remove the withDefaultAlertSettings override for plan
* refactor: Add create only attribute plan modifier for project_owner_id
* chore: update related docs
* refactor: Update error message to match original message
* docs: Update description for 'with_default_alerts_settings' to clarify default behavior
* refactor: Improve test function names and enhance default alert settings migration test cases
* test: Update alert settings handling in TestAccProject_withFalseDefaultSettings
* refactor: Rename Modifier interface to CreateOnlyModifier for clarity
* docs: Add comments to clarify CreateOnlyAttributePlanModifierWithBoolDefault behavior
*`org_id` - (Required) The ID of the organization you want to create the project within.
52
52
*`project_owner_id` - (Optional) Unique 24-hexadecimal digit string that identifies the Atlas user account to be granted the [Project Owner](https://docs.atlas.mongodb.com/reference/user-roles/#mongodb-authrole-Project-Owner) role on the specified project. If you set this parameter, it overrides the default value of the oldest [Organization Owner](https://docs.atlas.mongodb.com/reference/user-roles/#mongodb-authrole-Organization-Owner).
53
53
*`tags` - (Optional) Map that contains key-value pairs between 1 to 255 characters in length for tagging and categorizing the project. See [below](#tags).
54
-
*`with_default_alerts_settings` - (Optional) It allows users to disable the creation of the default alert settings. By default, this flag is set to true.
54
+
*`with_default_alerts_settings` - (Optional) Flag that indicates whether to create the project with default alert settings. This setting cannot be updated after project creation. By default, this flag is set to true.
55
55
*`is_collect_database_specifics_statistics_enabled` - (Optional) Flag that indicates whether to enable statistics in [cluster metrics](https://www.mongodb.com/docs/atlas/monitor-cluster-metrics/) collection for the project. By default, this flag is set to true.
56
56
*`is_data_explorer_enabled` - (Optional) Flag that indicates whether to enable Data Explorer for the project. If enabled, you can query your database with an easy to use interface. When Data Explorer is disabled, you cannot terminate slow operations from the [Real-Time Performance Panel](https://www.mongodb.com/docs/atlas/real-time-performance-panel/#std-label-real-time-metrics-status-tab) or create indexes from the [Performance Advisor](https://www.mongodb.com/docs/atlas/performance-advisor/#std-label-performance-advisor). You can still view Performance Advisor recommendations, but you must create those indexes from [mongosh](https://www.mongodb.com/docs/mongodb-shell/#mongodb-binary-bin.mongosh). By default, this flag is set to true.
57
57
*`is_extended_storage_sizes_enabled` - (Optional) Flag that indicates whether to enable extended storage sizes for the specified project. Clusters with extended storage sizes must be on AWS or GCP, and cannot span multiple regions. When extending storage size, initial syncs and cross-project snapshot restores will be slow. This setting should only be used as a measure of temporary relief; consider sharding if more storage is required.
// CreateOnlyAttributePlanModifier returns a plan modifier that ensures that update operations fails when the attribute is changed.
21
+
// This is useful for attributes only supported in create and not in update.
22
+
// It shows a helpful error message helping the user to update their config to match the state.
23
+
// Never use a schema.Default for create only attributes, instead use WithXXXDefault, the default will lead to plan changes that are not expected after import.
24
+
// Implement CopyFromPlan if the attribute is not in the API Response.
return"Ensures the update operation fails when updating an attribute. If the read after import don't equal the configuration value it will also raise an error."
// IsKnown returns true if the attribute is known (not null or unknown). Note that !IsKnown is not the same as IsUnknown because null is !IsKnown but not IsUnknown.
MarkdownDescription: "Human-readable label that identifies the geographic location of your MongoDB flex cluster. The region you choose can affect network latency for clients accessing your databases. For a complete list of region names, see [AWS](https://docs.atlas.mongodb.com/reference/amazon-aws/#std-label-amazon-aws), [GCP](https://docs.atlas.mongodb.com/reference/google-gcp/), and [Azure](https://docs.atlas.mongodb.com/reference/microsoft-azure/).",
// To test plan behavior after import it is necessary to use a different resource name, otherwise we get:
658
+
// Terraform is already managing a remote object for mongodbatlas_project.test. To import to this address you must first remove the existing object from the state.
659
+
// This happens because `ImportStatePersist` uses the previous WorkingDirectory where the state from previous steps are saved
ExpectError: regexp.MustCompile("with_default_alerts_settings cannot be updated or set after import, remove it from the configuration or use the state value"),
0 commit comments