Skip to content

Commit

Permalink
Merge pull request #762 from Justin-Holmes/justin/add-auth-method-rule
Browse files Browse the repository at this point in the history
Add auth method group rule type to Access group
  • Loading branch information
jacobbednarz authored Sep 1, 2020
2 parents 8d8b71a + bb536f9 commit 9dc578c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
10 changes: 10 additions & 0 deletions cloudflare/resource_cloudflare_access_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ var AccessGroupOptionSchemaElement = &schema.Resource{
Type: schema.TypeString,
Optional: true,
},
"auth_method": {
Type: schema.TypeString,
Optional: true,
},
"gsuite": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -342,6 +346,12 @@ func BuildAccessGroupCondition(options map[string]interface{}) []interface{} {
CommonName string `json:"common_name"`
}{CommonName: values.(string)}})
}
} else if accessGroupType == "auth_method" {
if values != "" {
group = append(group, cloudflare.AccessGroupAuthMethod{AuthMethod: struct {
AuthMethod string `json:"auth_method"`
}{AuthMethod: values.(string)}})
}
} else if accessGroupType == "gsuite" {
for _, v := range values.([]interface{}) {
gsuiteCfg := v.(map[string]interface{})
Expand Down
3 changes: 3 additions & 0 deletions website/docs/r/access_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ conditions which can be applied. The conditions are:
requests. Example: `everyone = true`
* `certificate` - (Optional) Whether to use mTLS certificate authentication.
* `common_name` - (Optional) Use a certificate common name to authenticate with.
* `auth_method` - (Optional) A string identifying the authentication
method code. The list of codes are listed here: https://tools.ietf.org/html/rfc8176#section-2.
Custom values are also supported.
* `gsuite` - (Optional) Use GSuite as the authentication mechanism. Example:

```hcl
Expand Down
6 changes: 3 additions & 3 deletions website/docs/r/access_policy.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ The following arguments are supported:
Allowed values: `allow`, `deny`, `non_identity`, `bypass`
* `name` - (Required) Friendly name of the Access Application.
* `precedence` - (Optional) The unique precedence for policies on a single application. Integer.
* `require` - (Optional) A series of access conditions, see [Access Groups](/docs/providers/cloudflare/r/access_group.html#conditions).
* `exclude` - (Optional) A series of access conditions, see [Access Groups](/docs/providers/cloudflare/r/access_group.html#conditions).
* `include` - (Required) A series of access conditions, see [Access Groups](/docs/providers/cloudflare/r/access_group.html#conditions).
* `require` - (Optional) A series of access conditions, see [Access Groups](/providers/cloudflare/cloudflare/latest/docs/resources/access_group#conditions).
* `exclude` - (Optional) A series of access conditions, see [Access Groups](/providers/cloudflare/cloudflare/latest/docs/resources/access_group#conditions).
* `include` - (Required) A series of access conditions, see [Access Groups](/providers/cloudflare/cloudflare/latest/docs/resources/access_group#conditions).


## Import
Expand Down

0 comments on commit 9dc578c

Please sign in to comment.