Skip to content

Commit 8d6c9ce

Browse files
committed
OAS-3201 | Extended deployment resource to support disable_foxx_authentication setting
1 parent 6c4190c commit 8d6c9ce

File tree

3 files changed

+43
-31
lines changed

3 files changed

+43
-31
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module github.com/arangodb-managed/terraform-provider-oasis
22

33
require (
4-
github.com/arangodb-managed/apis v0.65.0
4+
github.com/arangodb-managed/apis v0.69.3
55
github.com/arangodb-managed/log-helper v0.2.0
66
github.com/gogo/protobuf v1.3.0
77
github.com/hashicorp/hcl v1.0.0 // indirect
@@ -19,7 +19,7 @@ go 1.16
1919

2020
replace github.com/Azure/go-autorest => github.com/Azure/go-autorest v14.2.0+incompatible
2121

22-
replace github.com/arangodb/kube-arangodb => github.com/arangodb/kube-arangodb v0.0.0-20210414140129-e66e59938ad5
22+
replace github.com/arangodb/kube-arangodb => github.com/arangodb/kube-arangodb v0.0.0-20210528082542-41972ad9b013
2323

2424
replace github.com/coreos/go-systemd => github.com/coreos/go-systemd v0.0.0-20190620071333-e64a0ec8b42a
2525

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0 h1:MzVXffFU
4545
github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM=
4646
github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0=
4747
github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk=
48-
github.com/arangodb-managed/apis v0.65.0 h1:tvsQXVwJmg4UgYIGG6/NemV8EDoq3M7bGtm6XNFciIw=
49-
github.com/arangodb-managed/apis v0.65.0/go.mod h1:dSEV+DTPdZNH06qVqFWA+F0OcaL2ePGEo+odyMaU72Y=
48+
github.com/arangodb-managed/apis v0.69.3 h1:xgY3wtjzuMp9HDwXgmVkc6pA8f8mqpf3uYEqtrbUCUc=
49+
github.com/arangodb-managed/apis v0.69.3/go.mod h1:dSEV+DTPdZNH06qVqFWA+F0OcaL2ePGEo+odyMaU72Y=
5050
github.com/arangodb-managed/log-helper v0.2.0 h1:QK85i0a+mGM++wK625Oe1z4HuXhvaN3vR/Nunwa1qAA=
5151
github.com/arangodb-managed/log-helper v0.2.0/go.mod h1:WJogNCCXWM5OQx/ZYvtRo/1zwm/IpKj+f4QVtM8hNJw=
5252
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=

pkg/resource_deployment.go

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// Author Gergely Brautigam
2121
// Author Robert Stam
2222
// Author Marcin Swiderski
23+
// Author Ewout Prangsma
2324
//
2425

2526
package pkg
@@ -37,22 +38,23 @@ import (
3738
)
3839

3940
const (
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

5860
func 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
309315
type 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{} {
500511
func 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

Comments
 (0)