Skip to content

Commit

Permalink
Add missing mongodb flavor configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
wcmjunior committed Feb 14, 2024
1 parent 85c57a0 commit 6923c99
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cyral/internal/repository/data_source_cyral_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,17 @@ func DataSourceRepository() *schema.Resource {
Computed: true,
},
RepoMongoDBServerTypeKey: {
Description: "Type of the MongoDB server. Allowed values: " + utils.SupportedValuesAsMarkdown(mongoServerTypes()),
Description: "Type of the MongoDB server.",
Type: schema.TypeString,
Computed: true,
},
RepoMongoDBSRVRecordName: {
Description: "Name of a DNS SRV record which contains cluster topology details",
Description: "Name of a DNS SRV record which contains cluster topology details.",
Type: schema.TypeString,
Optional: true,
},
RepoMongoDBFlavorKey: {
Description: "The flavor of the MongoDB deployment.",
Type: schema.TypeString,
Optional: true,
},
Expand Down
6 changes: 6 additions & 0 deletions cyral/internal/repository/resource_cyral_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ func repoAsConfig(repo repository.RepoInfo, resName string) string {
replicaSet := "null"
serverType := "null"
srvRecordName := "null"
flavor := "null"
if repo.MongoDBSettings.ReplicaSetName != "" {
replicaSet = fmt.Sprintf(`"%s"`, repo.MongoDBSettings.ReplicaSetName)
}
Expand All @@ -289,15 +290,20 @@ func repoAsConfig(repo repository.RepoInfo, resName string) string {
if repo.MongoDBSettings.SRVRecordName != "" {
srvRecordName = fmt.Sprintf(`"%s"`, repo.MongoDBSettings.SRVRecordName)
}
if repo.MongoDBSettings.Flavor != "" {
flavor = fmt.Sprintf(`"%s"`, repo.MongoDBSettings.Flavor)
}
config += fmt.Sprintf(`
mongodb_settings {
replica_set_name = %s
server_type = %s
srv_record_name = %s
flavor = %s
}`,
replicaSet,
serverType,
srvRecordName,
flavor,
)
}

Expand Down

0 comments on commit 6923c99

Please sign in to comment.