Skip to content
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

updating #3

Merged
merged 9 commits into from
Aug 29, 2024
3 changes: 3 additions & 0 deletions .changelog/3713.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:dependency
provider: bump github.com/cloudflare/cloudflare-go from 0.101.0 to 0.102.0
```
3 changes: 3 additions & 0 deletions .changelog/3823.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:dependency
provider: bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.60.1 to 1.61.0 in the aws group
```
3 changes: 3 additions & 0 deletions .changelog/3824.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:dependency
provider: bump github.com/cloudflare/cloudflare-go from 0.102.0 to 0.103.0
```
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.21

require (
github.com/agext/levenshtein v1.2.3 // indirect
github.com/cloudflare/cloudflare-go v0.101.0
github.com/cloudflare/cloudflare-go v0.103.0
github.com/fatih/color v1.16.0 // indirect
github.com/google/uuid v1.6.0
github.com/hashicorp/errwrap v1.1.0 // indirect
Expand Down Expand Up @@ -36,7 +36,7 @@ require (
github.com/aws/aws-sdk-go-v2 v1.30.4
github.com/aws/aws-sdk-go-v2/config v1.27.31
github.com/aws/aws-sdk-go-v2/credentials v1.17.30
github.com/aws/aws-sdk-go-v2/service/s3 v1.60.1
github.com/aws/aws-sdk-go-v2/service/s3 v1.61.0
github.com/cloudflare/cloudflare-go/v2 v2.4.0
github.com/google/go-cmp v0.6.0
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.18 h1:tJ5RnkHC
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.18/go.mod h1:++NHzT+nAF7ZPrHPsA+ENvsXkOO8wEu+C6RXltAG4/c=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.16 h1:jg16PhLPUiHIj8zYIW6bqzeQSuHVEiWnGA0Brz5Xv2I=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.16/go.mod h1:Uyk1zE1VVdsHSU7096h/rwnXDzOzYQVl+FNPhPw7ShY=
github.com/aws/aws-sdk-go-v2/service/s3 v1.60.1 h1:mx2ucgtv+MWzJesJY9Ig/8AFHgoE5FwLXwUVgW/FGdI=
github.com/aws/aws-sdk-go-v2/service/s3 v1.60.1/go.mod h1:BSPI0EfnYUuNHPS0uqIo5VrRwzie+Fp+YhQOUs16sKI=
github.com/aws/aws-sdk-go-v2/service/s3 v1.61.0 h1:Wb544Wh+xfSXqJ/j3R4aX9wrKUoZsJNmilBYZb3mKQ4=
github.com/aws/aws-sdk-go-v2/service/s3 v1.61.0/go.mod h1:BSPI0EfnYUuNHPS0uqIo5VrRwzie+Fp+YhQOUs16sKI=
github.com/aws/aws-sdk-go-v2/service/sso v1.22.5 h1:zCsFCKvbj25i7p1u94imVoO447I/sFv8qq+lGJhRN0c=
github.com/aws/aws-sdk-go-v2/service/sso v1.22.5/go.mod h1:ZeDX1SnKsVlejeuz41GiajjZpRSWR7/42q/EyA/QEiM=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.5 h1:SKvPgvdvmiTWoi0GAJ7AsJfOz3ngVkD/ERbs5pUnHNI=
Expand All @@ -51,8 +51,8 @@ github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZ
github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8=
github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU=
github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA=
github.com/cloudflare/cloudflare-go v0.101.0 h1:SXWNSEDkbdY84iFIZGyTdWQwDfd98ljv0/4UubpleBQ=
github.com/cloudflare/cloudflare-go v0.101.0/go.mod h1:xXQHnoXKR48JlWbFS42i2al3nVqimVhcYvKnIdXLw9g=
github.com/cloudflare/cloudflare-go v0.103.0 h1:XXKzgXeUbAo7UTtM4T5wuD2bJPBtNZv7TlZAEy5QI4k=
github.com/cloudflare/cloudflare-go v0.103.0/go.mod h1:0DrjT4g8wgYFYIxhlqR8xi8dNWfyHFGilUkU3+XV8h0=
github.com/cloudflare/cloudflare-go/v2 v2.4.0 h1:gys/26GoVDklgfq8NYV39WgvOEwzK/XAqYObmnI6iFg=
github.com/cloudflare/cloudflare-go/v2 v2.4.0/go.mod h1:AoIzb05z/rvdJLztPct4tSa+3IqXJJ6c+pbUFMOlTr8=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
Expand Down
28 changes: 21 additions & 7 deletions internal/sdkv2provider/schema_cloudflare_access_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -895,8 +895,13 @@ func convertSaasSchemaToStruct(d *schema.ResourceData) *cloudflare.SaasApplicati

customClaims, _ := d.Get("saas_app.0.custom_claim").([]interface{})
for _, customClaims := range customClaims {
claimsAsMap := customClaims.(map[string]interface{})
SaasConfig.CustomClaims = append(SaasConfig.CustomClaims, convertOIDCClaimSchemaToStruct(claimsAsMap))
claimAsMap := customClaims.(map[string]interface{})
claim := convertOIDCClaimSchemaToStruct(claimAsMap)
if SaasConfig.CustomClaims == nil {
SaasConfig.CustomClaims = &[]cloudflare.OIDCClaimConfig{claim}
} else {
*SaasConfig.CustomClaims = append(*SaasConfig.CustomClaims, claim)
}
}

if _, ok := d.GetOk("saas_app.0.hybrid_and_implicit_options"); ok {
Expand All @@ -916,7 +921,12 @@ func convertSaasSchemaToStruct(d *schema.ResourceData) *cloudflare.SaasApplicati
customAttributes, _ := d.Get("saas_app.0.custom_attribute").([]interface{})
for _, customAttributes := range customAttributes {
attributeAsMap := customAttributes.(map[string]interface{})
SaasConfig.CustomAttributes = append(SaasConfig.CustomAttributes, convertSAMLAttributeSchemaToStruct(attributeAsMap))
attribute := convertSAMLAttributeSchemaToStruct(attributeAsMap)
if SaasConfig.CustomAttributes == nil {
SaasConfig.CustomAttributes = &[]cloudflare.SAMLAttributeConfig{attribute}
} else {
*SaasConfig.CustomAttributes = append(*SaasConfig.CustomAttributes, convertSAMLAttributeSchemaToStruct(attributeAsMap))
}
}
}
}
Expand Down Expand Up @@ -1179,8 +1189,10 @@ func convertSaasStructToSchema(d *schema.ResourceData, app *cloudflare.SaasAppli
}

var customClaims []interface{}
for _, claim := range app.CustomClaims {
customClaims = append(customClaims, convertOIDCClaimStructToSchema(claim))
if app.CustomClaims != nil {
for _, claim := range *app.CustomClaims {
customClaims = append(customClaims, convertOIDCClaimStructToSchema(claim))
}
}
if len(customClaims) != 0 {
m["custom_claim"] = customClaims
Expand Down Expand Up @@ -1209,8 +1221,10 @@ func convertSaasStructToSchema(d *schema.ResourceData, app *cloudflare.SaasAppli
}

var customAttributes []interface{}
for _, attr := range app.CustomAttributes {
customAttributes = append(customAttributes, convertSAMLAttributeStructToSchema(attr))
if app.CustomAttributes != nil {
for _, attr := range *app.CustomAttributes {
customAttributes = append(customAttributes, convertSAMLAttributeStructToSchema(attr))
}
}
if len(customAttributes) != 0 {
m["custom_attribute"] = customAttributes
Expand Down