-
Notifications
You must be signed in to change notification settings - Fork 39
chore: Updates cluster resource to use cluster APIs to support certain advanced configuration attributes #1344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9e1b2ad
9562dd9
8cb0f08
319bf3e
762217d
f4707bd
a340cc1
fdddae0
9f02f86
52c9d18
1520f09
b1f387b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,9 +8,6 @@ rpdk.log | |
| #compiled file | ||
| bin/ | ||
|
|
||
| #vendor | ||
| vendor/ | ||
|
|
||
| create.json | ||
| delete.json | ||
| update.json | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,12 +19,14 @@ import ( | |
| "fmt" | ||
| "reflect" | ||
|
|
||
| "go.mongodb.org/atlas-sdk/v20231115014/admin" | ||
|
|
||
| "github.com/aws-cloudformation/cloudformation-cli-go-plugin/cfn/handler" | ||
| "github.com/aws/aws-sdk-go/service/cloudformation" | ||
| "github.com/spf13/cast" | ||
|
|
||
| "github.com/mongodb/mongodbatlas-cloudformation-resources/util" | ||
| "github.com/mongodb/mongodbatlas-cloudformation-resources/util/constants" | ||
| "github.com/spf13/cast" | ||
| "go.mongodb.org/atlas-sdk/v20231115014/admin" | ||
| ) | ||
|
|
||
| func mapClusterToModel(model *Model, cluster *admin.AdvancedClusterDescription) { | ||
|
|
@@ -374,20 +376,27 @@ func flattenPrivateEndpoint(pes *[]admin.ClusterDescriptionConnectionStringsPriv | |
| return privateEndpoints | ||
| } | ||
|
|
||
| func flattenProcessArgs(p *admin.ClusterDescriptionProcessArgs) *ProcessArgs { | ||
| return &ProcessArgs{ | ||
| func flattenProcessArgs(p *admin.ClusterDescriptionProcessArgs, cluster *admin.AdvancedClusterDescription) *ProcessArgs { | ||
| res := &ProcessArgs{ | ||
| DefaultReadConcern: p.DefaultReadConcern, | ||
| DefaultWriteConcern: p.DefaultWriteConcern, | ||
| FailIndexKeyTooLong: p.FailIndexKeyTooLong, | ||
| JavascriptEnabled: p.JavascriptEnabled, | ||
| MinimumEnabledTLSProtocol: p.MinimumEnabledTlsProtocol, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shoudn't we keep reading MinimumEnabledTLSProtocol from here in case advConfig is nil?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see flattenProcessArgs is called in read only if advancedConfig is defined by the user
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
right
no I think for consistency we should stick to one API |
||
| NoTableScan: p.NoTableScan, | ||
| OplogSizeMB: p.OplogSizeMB, | ||
| SampleSizeBIConnector: p.SampleSizeBIConnector, | ||
| SampleRefreshIntervalBIConnector: p.SampleRefreshIntervalBIConnector, | ||
| OplogMinRetentionHours: p.OplogMinRetentionHours, | ||
| TransactionLifetimeLimitSeconds: util.Int64PtrToIntPtr(p.TransactionLifetimeLimitSeconds), | ||
| } | ||
|
|
||
| if advConfig := cluster.AdvancedConfiguration; advConfig != nil { | ||
| res.MinimumEnabledTLSProtocol = advConfig.MinimumEnabledTlsProtocol | ||
| res.TlsCipherConfigMode = advConfig.TlsCipherConfigMode | ||
| res.CustomOpensslCipherConfigTls12 = advConfig.GetCustomOpensslCipherConfigTls12() | ||
| } | ||
|
|
||
| return res | ||
| } | ||
|
|
||
| func flattenLabels(clusterLabels []admin.ComponentLabel) []Labels { | ||
|
|
@@ -412,9 +421,7 @@ func expandAdvancedSettings(processArgs ProcessArgs) *admin.ClusterDescriptionPr | |
| args.DefaultWriteConcern = processArgs.DefaultWriteConcern | ||
| } | ||
| args.JavascriptEnabled = processArgs.JavascriptEnabled | ||
| if processArgs.MinimumEnabledTLSProtocol != nil { | ||
| args.MinimumEnabledTlsProtocol = processArgs.MinimumEnabledTLSProtocol | ||
| } | ||
|
|
||
| args.NoTableScan = processArgs.NoTableScan | ||
|
|
||
| if processArgs.OplogSizeMB != nil { | ||
|
|
@@ -593,9 +600,25 @@ func setClusterRequest(currentModel *Model) (*admin.AdvancedClusterDescription, | |
| clusterRequest.Tags = tags | ||
|
|
||
| clusterRequest.TerminationProtectionEnabled = currentModel.TerminationProtectionEnabled | ||
|
|
||
| clusterRequest.AdvancedConfiguration = expandClusterAdvancedConfiguration(*currentModel.AdvancedSettings) | ||
| return clusterRequest, nil | ||
| } | ||
|
|
||
| func expandClusterAdvancedConfiguration(processArgs ProcessArgs) *admin.ApiAtlasClusterAdvancedConfiguration { | ||
| var args admin.ApiAtlasClusterAdvancedConfiguration | ||
|
|
||
| if processArgs.MinimumEnabledTLSProtocol != nil { | ||
| args.MinimumEnabledTlsProtocol = processArgs.MinimumEnabledTLSProtocol | ||
| } | ||
| if processArgs.TlsCipherConfigMode != nil { | ||
| args.TlsCipherConfigMode = processArgs.TlsCipherConfigMode | ||
| } | ||
| args.CustomOpensslCipherConfigTls12 = &processArgs.CustomOpensslCipherConfigTls12 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. similar to before, do we want to check if processArgs.CustomOpensslCipherConfigTls12 is nil? or maybe we can have |
||
|
|
||
| return &args | ||
| } | ||
|
|
||
| func AddReplicationSpecIDs(src, dest []admin.ReplicationSpec) *[]admin.ReplicationSpec { | ||
| zoneToID := map[string]string{} | ||
| providerRegionToID := map[string]string{} | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.