2020// Author Gergely Brautigam
2121// Author Robert Stam
2222// Author Marcin Swiderski
23+ // Author Ewout Prangsma
2324//
2425
2526package pkg
@@ -37,22 +38,23 @@ import (
3738)
3839
3940const (
40- deplTAndCAcceptedFieldName = "terms_and_conditions_accepted"
41- deplProjectFieldName = "project"
42- deplNameFieldName = "name"
43- deplDescriptionFieldName = "description"
44- deplLocationFieldName = "location"
45- deplLocationRegionFieldName = "region"
46- deplVersionFieldName = "version"
47- deplVersionDbVersionFieldName = "db_version"
48- deplSecurityFieldName = "security"
49- deplSecurityCaCertificateFieldName = "ca_certificate"
50- deplSecurityIpAllowlistFieldName = "ip_allowlist"
51- deplConfigurationFieldName = "configuration"
52- deplConfigurationModelFieldName = "model"
53- deplConfigurationNodeSizeIdFieldName = "node_size_id"
54- deplConfigurationNodeCountFieldName = "node_count"
55- deplConfigurationNodeDiskSizeFieldName = "node_disk_size"
41+ deplTAndCAcceptedFieldName = "terms_and_conditions_accepted"
42+ deplProjectFieldName = "project"
43+ deplNameFieldName = "name"
44+ deplDescriptionFieldName = "description"
45+ deplLocationFieldName = "location"
46+ deplLocationRegionFieldName = "region"
47+ deplVersionFieldName = "version"
48+ deplVersionDbVersionFieldName = "db_version"
49+ deplSecurityFieldName = "security"
50+ deplSecurityCaCertificateFieldName = "ca_certificate"
51+ deplSecurityIpAllowlistFieldName = "ip_allowlist"
52+ deplSecurityDisableFoxxAuthenticationFieldName = "disable_foxx_authentication"
53+ deplConfigurationFieldName = "configuration"
54+ deplConfigurationModelFieldName = "model"
55+ deplConfigurationNodeSizeIdFieldName = "node_size_id"
56+ deplConfigurationNodeCountFieldName = "node_count"
57+ deplConfigurationNodeDiskSizeFieldName = "node_disk_size"
5658)
5759
5860func resourceDeployment () * schema.Resource {
@@ -136,6 +138,10 @@ func resourceDeployment() *schema.Resource {
136138 Type : schema .TypeString ,
137139 Optional : true , // If not set, no allowlist is configured
138140 },
141+ deplSecurityDisableFoxxAuthenticationFieldName : {
142+ Type : schema .TypeBool ,
143+ Optional : true , // If not set, defaults to enabling foxx authentication
144+ },
139145 },
140146 },
141147 },
@@ -307,8 +313,9 @@ type version struct {
307313
308314// security is a convenient wrapper around the security schema for easy parsing
309315type securityFields struct {
310- caCertificate string
311- ipAllowlist string
316+ caCertificate string
317+ ipAllowlist string
318+ disableFoxxAuthentication bool
312319}
313320
314321// configuration is a convenient wrapper around the configuration schema for easy parsing
@@ -366,13 +373,14 @@ func expandDeploymentResource(d *schema.ResourceData, defaultProject string) (*d
366373 }
367374
368375 return & data.Deployment {
369- Name : name ,
370- Description : description ,
371- ProjectId : project ,
372- RegionId : loc .region ,
373- Version : ver .dbVersion ,
374- Certificates : & data.Deployment_CertificateSpec {CaCertificateId : sec .caCertificate },
375- IpallowlistId : sec .ipAllowlist ,
376+ Name : name ,
377+ Description : description ,
378+ ProjectId : project ,
379+ RegionId : loc .region ,
380+ Version : ver .dbVersion ,
381+ Certificates : & data.Deployment_CertificateSpec {CaCertificateId : sec .caCertificate },
382+ IpallowlistId : sec .ipAllowlist ,
383+ DisableFoxxAuthentication : sec .disableFoxxAuthentication ,
376384 Model : & data.Deployment_ModelSpec {
377385 Model : conf .model ,
378386 NodeCount : int32 (conf .nodeCount ),
@@ -418,6 +426,9 @@ func expandSecurity(s []interface{}) (sec securityFields) {
418426 if i , ok := item [deplSecurityIpAllowlistFieldName ]; ok {
419427 sec .ipAllowlist = i .(string )
420428 }
429+ if i , ok := item [deplSecurityDisableFoxxAuthenticationFieldName ]; ok {
430+ sec .disableFoxxAuthentication = i .(bool )
431+ }
421432 }
422433 return
423434}
@@ -500,8 +511,9 @@ func flattenVersion(depl *data.Deployment) []interface{} {
500511func flattenSecurity (depl * data.Deployment ) []interface {} {
501512 return []interface {}{
502513 map [string ]interface {}{
503- deplSecurityIpAllowlistFieldName : depl .GetIpallowlistId (),
504- deplSecurityCaCertificateFieldName : depl .GetCertificates ().GetCaCertificateId (),
514+ deplSecurityIpAllowlistFieldName : depl .GetIpallowlistId (),
515+ deplSecurityCaCertificateFieldName : depl .GetCertificates ().GetCaCertificateId (),
516+ deplSecurityDisableFoxxAuthenticationFieldName : depl .GetDisableFoxxAuthentication (),
505517 },
506518 }
507519}
0 commit comments