diff --git a/cfn-resources/organization/cmd/resource/model.go b/cfn-resources/organization/cmd/resource/model.go
index 57545422e..c5cfe5992 100644
--- a/cfn-resources/organization/cmd/resource/model.go
+++ b/cfn-resources/organization/cmd/resource/model.go
@@ -4,17 +4,19 @@ package resource
// Model is autogenerated from the json schema
type Model struct {
- Name *string `json:",omitempty"`
- APIKey *APIKey `json:",omitempty"`
- FederatedSettingsId *string `json:",omitempty"`
- OrgOwnerId *string `json:",omitempty"`
- Profile *string `json:",omitempty"`
- AwsSecretName *string `json:",omitempty"`
- OrgId *string `json:",omitempty"`
- IsDeleted *bool `json:",omitempty"`
- ApiAccessListRequired *bool `json:",omitempty"`
- MultiFactorAuthRequired *bool `json:",omitempty"`
- RestrictEmployeeAccess *bool `json:",omitempty"`
+ Name *string `json:",omitempty"`
+ APIKey *APIKey `json:",omitempty"`
+ FederatedSettingsId *string `json:",omitempty"`
+ OrgOwnerId *string `json:",omitempty"`
+ Profile *string `json:",omitempty"`
+ AwsSecretName *string `json:",omitempty"`
+ SkipDefaultAlertsSettings *bool `json:",omitempty"`
+ GenAIFeaturesEnabled *bool `json:",omitempty"`
+ OrgId *string `json:",omitempty"`
+ IsDeleted *bool `json:",omitempty"`
+ ApiAccessListRequired *bool `json:",omitempty"`
+ MultiFactorAuthRequired *bool `json:",omitempty"`
+ RestrictEmployeeAccess *bool `json:",omitempty"`
}
// APIKey is autogenerated from the json schema
diff --git a/cfn-resources/organization/cmd/resource/resource.go b/cfn-resources/organization/cmd/resource/resource.go
index c11ca9e38..f993e0e9a 100644
--- a/cfn-resources/organization/cmd/resource/resource.go
+++ b/cfn-resources/organization/cmd/resource/resource.go
@@ -21,7 +21,7 @@ import (
"net/http"
"time"
- "go.mongodb.org/atlas-sdk/v20231115014/admin"
+ "go.mongodb.org/atlas-sdk/v20241113004/admin"
"github.com/aws-cloudformation/cloudformation-cli-go-plugin/cfn/handler"
"github.com/aws/aws-sdk-go/service/cloudformation"
@@ -76,7 +76,7 @@ func Create(req handler.Request, prevModel *Model, currentModel *Model) (handler
if peErr != nil {
return *peErr, nil
}
- conn := client.Atlas20231115014
+ conn := client.AtlasSDK
ctx := context.Background()
_, _, err := secrets.Get(&req, *currentModel.AwsSecretName)
@@ -88,12 +88,14 @@ func Create(req handler.Request, prevModel *Model, currentModel *Model) (handler
}
apikeyInputs := setAPIkeyInputs(currentModel)
+ setDefaultsIfNotDefined(currentModel)
// Set the roles from model
orgInput := &admin.CreateOrganizationRequest{
- ApiKey: apikeyInputs,
- OrgOwnerId: currentModel.OrgOwnerId,
- Name: *currentModel.Name,
+ ApiKey: apikeyInputs,
+ OrgOwnerId: currentModel.OrgOwnerId,
+ Name: *currentModel.Name,
+ SkipDefaultAlertsSettings: currentModel.SkipDefaultAlertsSettings,
}
if currentModel.FederatedSettingsId != nil {
orgInput.FederationSettingsId = currentModel.FederatedSettingsId
@@ -121,7 +123,7 @@ func Create(req handler.Request, prevModel *Model, currentModel *Model) (handler
if peErr != nil {
return *peErr, nil
}
- conn = newOrgClient.Atlas20231115014
+ conn = newOrgClient.AtlasSDK
if _, _, errUpdate := conn.OrganizationsApi.UpdateOrganizationSettings(ctx, orgID, newOrganizationSettings(currentModel)).Execute(); errUpdate != nil {
return handleError(response, constants.CREATE, err)
}
@@ -145,7 +147,7 @@ func Read(req handler.Request, prevModel *Model, currentModel *Model) (handler.P
return *peErr, nil
}
- model, response, err := currentModel.getOrgDetails(context.Background(), newOrgClient.Atlas20231115014, currentModel)
+ model, response, err := currentModel.getOrgDetails(context.Background(), newOrgClient.AtlasSDK, currentModel)
if err != nil {
return handleError(response, constants.READ, err)
}
@@ -167,11 +169,13 @@ func Update(req handler.Request, prevModel *Model, currentModel *Model) (handler
if peErr != nil {
return *peErr, nil
}
- conn := newOrgClient.Atlas20231115014
+ conn := newOrgClient.AtlasSDK
ctx := context.Background()
- atlasOrg := admin.AtlasOrganization{Id: currentModel.OrgId, Name: *currentModel.Name}
- if _, response, err := conn.OrganizationsApi.RenameOrganization(ctx, *currentModel.OrgId, &atlasOrg).Execute(); err != nil {
+ setDefaultsIfNotDefined(currentModel)
+ atlasOrg := admin.AtlasOrganization{Id: currentModel.OrgId, Name: *currentModel.Name, SkipDefaultAlertsSettings: currentModel.SkipDefaultAlertsSettings}
+
+ if _, response, err := conn.OrganizationsApi.UpdateOrganization(ctx, *currentModel.OrgId, &atlasOrg).Execute(); err != nil {
return handleError(response, constants.UPDATE, err)
}
@@ -197,7 +201,7 @@ func Delete(req handler.Request, prevModel *Model, currentModel *Model) (handler
if peErr != nil {
return *peErr, nil
}
- conn := newOrgClient.Atlas20231115014
+ conn := newOrgClient.AtlasSDK
ctx := context.Background()
// Callback
@@ -301,6 +305,7 @@ func (model *Model) getOrgDetails(ctx context.Context, conn *admin.APIClient, cu
model.Name = util.Pointer(org.Name)
model.OrgId = org.Id
model.IsDeleted = org.IsDeleted
+ model.SkipDefaultAlertsSettings = org.SkipDefaultAlertsSettings
settings, _, err := conn.OrganizationsApi.GetOrganizationSettings(ctx, org.GetId()).Execute()
if err != nil {
@@ -309,6 +314,7 @@ func (model *Model) getOrgDetails(ctx context.Context, conn *admin.APIClient, cu
model.ApiAccessListRequired = settings.ApiAccessListRequired
model.MultiFactorAuthRequired = settings.MultiFactorAuthRequired
model.RestrictEmployeeAccess = settings.RestrictEmployeeAccess
+ model.GenAIFeaturesEnabled = settings.GenAIFeaturesEnabled
return model, response, nil
}
@@ -352,5 +358,18 @@ func newOrganizationSettings(model *Model) *admin.OrganizationSettings {
ApiAccessListRequired: model.ApiAccessListRequired,
MultiFactorAuthRequired: model.MultiFactorAuthRequired,
RestrictEmployeeAccess: model.RestrictEmployeeAccess,
+ GenAIFeaturesEnabled: model.GenAIFeaturesEnabled,
+ }
+}
+
+func setDefaultsIfNotDefined(m *Model) {
+ if m == nil {
+ return
+ }
+ if m.SkipDefaultAlertsSettings == nil {
+ m.SkipDefaultAlertsSettings = util.Pointer(true)
+ }
+ if m.GenAIFeaturesEnabled == nil {
+ m.GenAIFeaturesEnabled = util.Pointer(true)
}
}
diff --git a/cfn-resources/organization/docs/README.md b/cfn-resources/organization/docs/README.md
index 62c8f499e..3f4d9e1a6 100644
--- a/cfn-resources/organization/docs/README.md
+++ b/cfn-resources/organization/docs/README.md
@@ -18,6 +18,8 @@ To declare this entity in your AWS CloudFormation template, use the following sy
"OrgOwnerId" : String,
"Profile" : String,
"AwsSecretName" : String,
+ "SkipDefaultAlertsSettings" : Boolean,
+ "GenAIFeaturesEnabled" : Boolean,
"IsDeleted" : Boolean,
"ApiAccessListRequired" : Boolean,
"MultiFactorAuthRequired" : Boolean,
@@ -37,6 +39,8 @@ Properties:
OrgOwnerId: String
Profile: String
AwsSecretName: String
+ SkipDefaultAlertsSettings: Boolean
+ GenAIFeaturesEnabled: Boolean
IsDeleted: Boolean
ApiAccessListRequired: Boolean
MultiFactorAuthRequired: Boolean
@@ -109,6 +113,26 @@ _Type_: String
_Update requires_: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)
+#### SkipDefaultAlertsSettings
+
+Disables automatic alert creation. When set to `true`, Atlas doesn't automatically create organization-level alerts. Defaults to `true` for new Atlas Organizations created with the provider to prevent infrastructure drift caused by creation of new alerts.
+
+_Required_: No
+
+_Type_: Boolean
+
+_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
+
+#### GenAIFeaturesEnabled
+
+Flag that indicates whether this organization has access to generative AI features. This setting only applies to Atlas Commercial and defaults to `true`. With this setting on, Project Owners may be able to enable or disable individual AI features at the project level. To learn more, see https://www.mongodb.com/docs/generative-ai-faq/
+
+_Required_: No
+
+_Type_: Boolean
+
+_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
+
#### IsDeleted
Flag that indicates whether this organization has been deleted.
diff --git a/cfn-resources/organization/mongodb-atlas-organization.json b/cfn-resources/organization/mongodb-atlas-organization.json
index 7eea30ddd..0cc169cb2 100644
--- a/cfn-resources/organization/mongodb-atlas-organization.json
+++ b/cfn-resources/organization/mongodb-atlas-organization.json
@@ -51,6 +51,16 @@
"description": "AwsSecretName used to set newly created Org credentials information.",
"default": "default"
},
+ "SkipDefaultAlertsSettings": {
+ "type": "boolean",
+ "description": "Disables automatic alert creation. When set to `true`, Atlas doesn't automatically create organization-level alerts. Defaults to `true` for new Atlas Organizations created with the provider to prevent infrastructure drift caused by creation of new alerts.",
+ "default": true
+ },
+ "GenAIFeaturesEnabled": {
+ "type": "boolean",
+ "description": "Flag that indicates whether this organization has access to generative AI features. This setting only applies to Atlas Commercial and defaults to `true`. With this setting on, Project Owners may be able to enable or disable individual AI features at the project level. To learn more, see https://www.mongodb.com/docs/generative-ai-faq/",
+ "default": true
+ },
"OrgId": {
"type": "string",
"description": "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.",
diff --git a/cfn-resources/organization/test/inputs_1_create.json b/cfn-resources/organization/test/inputs_1_create.json
index 93ca49d61..3aedc06f6 100644
--- a/cfn-resources/organization/test/inputs_1_create.json
+++ b/cfn-resources/organization/test/inputs_1_create.json
@@ -12,5 +12,7 @@
},
"MultiFactorAuthRequired": "true",
"RestrictEmployeeAccess": "false",
- "ApiAccessListRequired": "false"
+ "ApiAccessListRequired": "false",
+ "SkipDefaultAlertsSettings": "true",
+ "GenAIFeaturesEnabled": "true"
}
diff --git a/cfn-resources/organization/test/inputs_1_update.json b/cfn-resources/organization/test/inputs_1_update.json
index 2de2b98dc..555aec23f 100644
--- a/cfn-resources/organization/test/inputs_1_update.json
+++ b/cfn-resources/organization/test/inputs_1_update.json
@@ -12,5 +12,7 @@
},
"MultiFactorAuthRequired": "true",
"RestrictEmployeeAccess": "true",
- "ApiAccessListRequired": "false"
+ "ApiAccessListRequired": "false",
+ "SkipDefaultAlertsSettings": "false",
+ "GenAIFeaturesEnabled": "false"
}
diff --git a/examples/organization/organization.json b/examples/organization/organization.json
index e967bba3d..3670da7da 100644
--- a/examples/organization/organization.json
+++ b/examples/organization/organization.json
@@ -61,6 +61,26 @@
"false"
],
"Default": "false"
+ },
+ "SkipDefaultAlertsSettings": {
+ "Type": "String",
+ "ConstraintDescription": "boolean",
+ "AllowedValues": [
+ "true",
+ "false"
+ ],
+ "Default": "true",
+ "Description": "SkipDefaultAlertsSettings"
+ },
+ "GenAIFeaturesEnabled": {
+ "Type": "String",
+ "ConstraintDescription": "boolean",
+ "AllowedValues": [
+ "true",
+ "false"
+ ],
+ "Default": "true",
+ "Description": "Flag that indicates whether this organization has access to generative AI features. This setting only applies to Atlas Commercial and defaults to `true`. With this setting on, Project Owners may be able to enable or disable individual AI features at the project level. To learn more, see https://www.mongodb.com/docs/generative-ai-faq/"
}
},
"Mappings": {},
@@ -113,6 +133,12 @@
},
"RestrictEmployeeAccess": {
"Ref": "RestrictEmployeeAccess"
+ },
+ "SkipDefaultAlertsSettings": {
+ "Ref": "SkipDefaultAlertsSettings"
+ },
+ "GenAIFeaturesEnabled": {
+ "Ref": "GenAIFeaturesEnabled"
}
}
}