@@ -102,8 +102,62 @@ func TestFlattenDeploymentResource(t *testing.T) {
102102 },
103103 deplSecurityFieldName : []interface {}{
104104 map [string ]interface {}{
105- deplSecurityCaCertificateFieldName : "certificate-id" ,
106- deplSecurityIpAllowlistFieldName : "ip-allowlist" ,
105+ deplSecurityCaCertificateFieldName : "certificate-id" ,
106+ deplSecurityIpAllowlistFieldName : "ip-allowlist" ,
107+ deplSecurityDisableFoxxAuthenticationFieldName : false ,
108+ },
109+ },
110+ deplConfigurationFieldName : []interface {}{
111+ map [string ]interface {}{
112+ deplConfigurationModelFieldName : "oneshard" ,
113+ deplConfigurationNodeSizeIdFieldName : "a8" ,
114+ deplConfigurationNodeCountFieldName : 3 ,
115+ deplConfigurationNodeDiskSizeFieldName : 32 ,
116+ },
117+ },
118+ }
119+ assert .Equal (t , expected , flattened )
120+ }
121+
122+ func TestFlattenDeploymentResourceDisableFoxxAuth (t * testing.T ) {
123+ depl := & data.Deployment {
124+ Name : "test-name" ,
125+ Description : "test-desc" ,
126+ ProjectId : "123456789" ,
127+ RegionId : "gcp-europe-west4" ,
128+ Version : "3.6.0" ,
129+ Certificates : & data.Deployment_CertificateSpec {
130+ CaCertificateId : "certificate-id" ,
131+ },
132+ IpallowlistId : "ip-allowlist" ,
133+ DisableFoxxAuthentication : true ,
134+ Model : & data.Deployment_ModelSpec {
135+ Model : "oneshard" ,
136+ NodeSizeId : "a8" ,
137+ NodeCount : 3 ,
138+ NodeDiskSize : 32 ,
139+ },
140+ }
141+ flattened := flattenDeployment (depl )
142+ expected := map [string ]interface {}{
143+ deplProjectFieldName : "123456789" ,
144+ deplNameFieldName : "test-name" ,
145+ deplDescriptionFieldName : "test-desc" ,
146+ deplLocationFieldName : []interface {}{
147+ map [string ]interface {}{
148+ deplLocationRegionFieldName : "gcp-europe-west4" ,
149+ },
150+ },
151+ deplVersionFieldName : []interface {}{
152+ map [string ]interface {}{
153+ deplVersionDbVersionFieldName : "3.6.0" ,
154+ },
155+ },
156+ deplSecurityFieldName : []interface {}{
157+ map [string ]interface {}{
158+ deplSecurityCaCertificateFieldName : "certificate-id" ,
159+ deplSecurityIpAllowlistFieldName : "ip-allowlist" ,
160+ deplSecurityDisableFoxxAuthenticationFieldName : true ,
107161 },
108162 },
109163 deplConfigurationFieldName : []interface {}{
@@ -128,7 +182,8 @@ func TestExpandingDeploymentResource(t *testing.T) {
128182 Certificates : & data.Deployment_CertificateSpec {
129183 CaCertificateId : "certificate-id" ,
130184 },
131- IpallowlistId : "ip-allowlist" ,
185+ IpallowlistId : "ip-allowlist" ,
186+ DisableFoxxAuthentication : false ,
132187 Model : & data.Deployment_ModelSpec {
133188 Model : "oneshard" ,
134189 NodeSizeId : "a8" ,
@@ -152,8 +207,65 @@ func TestExpandingDeploymentResource(t *testing.T) {
152207 },
153208 deplSecurityFieldName : []interface {}{
154209 map [string ]interface {}{
155- deplSecurityCaCertificateFieldName : "certificate-id" ,
156- deplSecurityIpAllowlistFieldName : "ip-allowlist" ,
210+ deplSecurityCaCertificateFieldName : "certificate-id" ,
211+ deplSecurityIpAllowlistFieldName : "ip-allowlist" ,
212+ deplSecurityDisableFoxxAuthenticationFieldName : false ,
213+ },
214+ },
215+ deplConfigurationFieldName : []interface {}{
216+ map [string ]interface {}{
217+ deplConfigurationModelFieldName : "oneshard" ,
218+ deplConfigurationNodeSizeIdFieldName : "a8" ,
219+ deplConfigurationNodeCountFieldName : 3 ,
220+ deplConfigurationNodeDiskSizeFieldName : 32 ,
221+ },
222+ },
223+ }
224+ s := resourceDeployment ().Schema
225+ resourceData := schema .TestResourceDataRaw (t , s , raw )
226+ expandedDepl , err := expandDeploymentResource (resourceData , "123456789" )
227+ assert .NoError (t , err )
228+ assert .Equal (t , depl , expandedDepl )
229+ }
230+
231+ func TestExpandingDeploymentResourceDisableFoxxAuth (t * testing.T ) {
232+ depl := & data.Deployment {
233+ Name : "test-name" ,
234+ Description : "test-desc" ,
235+ ProjectId : "123456789" ,
236+ RegionId : "gcp-europe-west4" ,
237+ Version : "3.6.0" ,
238+ Certificates : & data.Deployment_CertificateSpec {
239+ CaCertificateId : "certificate-id" ,
240+ },
241+ IpallowlistId : "ip-allowlist" ,
242+ DisableFoxxAuthentication : true ,
243+ Model : & data.Deployment_ModelSpec {
244+ Model : "oneshard" ,
245+ NodeSizeId : "a8" ,
246+ NodeCount : 3 ,
247+ NodeDiskSize : 32 ,
248+ },
249+ }
250+ raw := map [string ]interface {}{
251+ deplProjectFieldName : "123456789" ,
252+ deplNameFieldName : "test-name" ,
253+ deplDescriptionFieldName : "test-desc" ,
254+ deplLocationFieldName : []interface {}{
255+ map [string ]interface {}{
256+ deplLocationRegionFieldName : "gcp-europe-west4" ,
257+ },
258+ },
259+ deplVersionFieldName : []interface {}{
260+ map [string ]interface {}{
261+ deplVersionDbVersionFieldName : "3.6.0" ,
262+ },
263+ },
264+ deplSecurityFieldName : []interface {}{
265+ map [string ]interface {}{
266+ deplSecurityCaCertificateFieldName : "certificate-id" ,
267+ deplSecurityIpAllowlistFieldName : "ip-allowlist" ,
268+ deplSecurityDisableFoxxAuthenticationFieldName : true ,
157269 },
158270 },
159271 deplConfigurationFieldName : []interface {}{
0 commit comments