Skip to content

Commit

Permalink
Add missing mongodb flavor configuration (#509)
Browse files Browse the repository at this point in the history
* Add missing mongodb flavor configuration

* Update docs
  • Loading branch information
wcmjunior authored Feb 14, 2024
1 parent 93ca673 commit c4aa4f0
Show file tree
Hide file tree
Showing 3 changed files with 14 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
1 change: 1 addition & 0 deletions docs/data-sources/repository.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ Read-Only:

Read-Only:

- `flavor` (String)
- `replica_set_name` (String)
- `server_type` (String)
- `srv_record_name` (String)
Expand Down

0 comments on commit c4aa4f0

Please sign in to comment.