Skip to content

Commit

Permalink
Merge pull request #5 from noderadius/feature/kong_consumer_oauth2
Browse files Browse the repository at this point in the history
add kong_consumer_oauth2 resource
  • Loading branch information
loafoe authored Mar 30, 2022
2 parents fae048c + d6028bb commit ff498d6
Show file tree
Hide file tree
Showing 7 changed files with 507 additions and 386 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.dll
*.exe
.DS_Store
.devcontainer
example.tf
terraform.tfplan
terraform.tfstate
Expand Down
44 changes: 44 additions & 0 deletions docs/resources/consumer_oauth2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# kong_consumer_oauth2

Resource that allows you to configure the OAuth2 plugin credentials for a consumer.

## Example Usage

```hcl
resource "kong_consumer" "my_consumer" {
username = "User1"
custom_id = "123"
}
resource "kong_plugin" "oauth2_plugin" {
name = "oauth2"
config_json = <<EOT
{
"global_credentials": true,
"enable_password_grant": true,
"token_expiration": 180,
"refresh_token_ttl": 180,
"provision_key": "testprovisionkey"
}
EOT
}
resource "kong_consumer_oauth2" "consumer_oauth2" {
name = "test_application"
consumer_id = "${kong_consumer.my_consumer.id}"
client_id = "client_id"
client_secret = "client_secret"
redirect_uris = ["https://asdf.com/callback", "https://test.cl/callback"]
tags = ["myTag"]
}
```

## Argument Reference

* `name` - (Required) The name associated with the credential.
* `consumer_id` - (Required) The id of the consumer to be configured with oauth2.
* `client_id` - (Optional) Unique oauth2 client id. If not set, the oauth2 plugin will generate one
* `client_secret` - (Optional) Unique oauth2 client secret. If not set, the oauth2 plugin will generate one
* `hash_secret` - (Optional) A boolean flag that indicates whether the client_secret field will be stored in hashed form. If enabled on existing plugin instances, client secrets are hashed on the fly upon first usage. Default: `false`.
* `redirect_uris` - (Required) An array with one or more URLs in your app where users will be sent after authorization ([RFC 6742 Section 3.1.2](https://tools.ietf.org/html/rfc6749#section-3.1.2)).
* `tags` - (Optional) A list of strings associated with the consumer for grouping and filtering.
25 changes: 3 additions & 22 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,16 @@ replace github.com/kevholditch/terraform-provider-kong/kong => ./kong

require (
github.com/Microsoft/go-winio v0.5.0 // indirect
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
github.com/cenkalti/backoff/v4 v4.1.1 // indirect
github.com/containerd/continuity v0.1.0 // indirect
github.com/docker/cli v20.10.8+incompatible // indirect
github.com/docker/docker v20.10.8+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f // indirect
github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f // indirect
github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect
github.com/hashicorp/go-plugin v1.4.1 // indirect
github.com/hashicorp/hcl/v2 v2.3.0 // indirect
github.com/hashicorp/terraform-plugin-sdk v1.7.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.7.0 // indirect
github.com/kong/go-kong v0.20.0
github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.1
github.com/kong/go-kong v0.28.0
github.com/lib/pq v1.0.0
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/opencontainers/runc v1.0.1 // indirect
github.com/ory/dockertest v3.3.5+incompatible
github.com/ory/dockertest/v3 v3.7.0 // indirect
github.com/ory/dockertest/v3 v3.7.0
github.com/pkg/errors v0.9.1
github.com/smartystreets/goconvey v1.6.4 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d // indirect
golang.org/x/sys v0.0.0-20210809203939-894668206c86 // indirect
gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect
gotest.tools v2.2.0+incompatible // indirect
)
Loading

0 comments on commit ff498d6

Please sign in to comment.