Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #13 from rapid7/terraform_v0.12
Browse files Browse the repository at this point in the history
updates for terraform 12
  • Loading branch information
mfreebairn-r7 authored Jan 2, 2020
2 parents 4bcd17f + 4849587 commit 79f6e76
Show file tree
Hide file tree
Showing 1,928 changed files with 595,266 additions and 26,366 deletions.
8 changes: 8 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module github.com/rapid7/terraform-provider-kong

go 1.12

require (
github.com/dghubble/sling v1.2.0
github.com/hashicorp/terraform v0.12.6
)
617 changes: 617 additions & 0 deletions go.sum

Large diffs are not rendered by default.

14 changes: 3 additions & 11 deletions kong/resource_kong_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ func resourceKongAPI() *schema.Resource {
},

Schema: map[string]*schema.Schema{
"id": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},

"name": &schema.Schema{
Type: schema.TypeString,
Required: true,
Expand Down Expand Up @@ -166,7 +161,7 @@ func resourceKongAPICreate(d *schema.ResourceData, meta interface{}) error {
func resourceKongAPIRead(d *schema.ResourceData, meta interface{}) error {
sling := meta.(*sling.Sling)

id := d.Get("id").(string)
id := d.Id()
api := new(APIResponse)

errorResponse := make(map[string]interface{})
Expand Down Expand Up @@ -213,7 +208,7 @@ func resourceKongAPIUpdate(d *schema.ResourceData, meta interface{}) error {
func resourceKongAPIDelete(d *schema.ResourceData, meta interface{}) error {
sling := meta.(*sling.Sling)

id := d.Get("id").(string)
id := d.Id()

errorResponse := make(map[string]interface{})
response, error := sling.New().Delete("apis/").Path(id).Receive(nil, &errorResponse)
Expand All @@ -230,6 +225,7 @@ func resourceKongAPIDelete(d *schema.ResourceData, meta interface{}) error {

func getAPIFromResourceData(d *schema.ResourceData) *APIRequest {
api := &APIRequest{
ID: d.Id(),
Name: d.Get("name").(string),
Hosts: d.Get("hosts").(string),
Uris: d.Get("uris").(string),
Expand All @@ -245,10 +241,6 @@ func getAPIFromResourceData(d *schema.ResourceData) *APIRequest {
HTTPIfTerminated: d.Get("http_if_terminated").(bool),
}

if id, ok := d.GetOk("id"); ok {
api.ID = id.(string)
}

return api
}

Expand Down
14 changes: 3 additions & 11 deletions kong/resource_kong_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ func resourceKongConsumer() *schema.Resource {
},

Schema: map[string]*schema.Schema{
"id": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},

"username": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -75,7 +70,7 @@ func resourceKongConsumerCreate(d *schema.ResourceData, meta interface{}) error
func resourceKongConsumerRead(d *schema.ResourceData, meta interface{}) error {
sling := meta.(*sling.Sling)

id := d.Get("id").(string)
id := d.Id()
consumer := new(Consumer)

errorResponse := make(map[string]interface{})
Expand Down Expand Up @@ -121,7 +116,7 @@ func resourceKongConsumerUpdate(d *schema.ResourceData, meta interface{}) error
func resourceKongConsumerDelete(d *schema.ResourceData, meta interface{}) error {
sling := meta.(*sling.Sling)

id := d.Get("id").(string)
id := d.Id()

errorResponse := make(map[string]interface{})
response, error := sling.New().Delete("consumers/").Path(id).Receive(nil, &errorResponse)
Expand All @@ -138,14 +133,11 @@ func resourceKongConsumerDelete(d *schema.ResourceData, meta interface{}) error

func getConsumerFromResourceData(d *schema.ResourceData) *Consumer {
consumer := &Consumer{
ID: d.Id(),
Username: d.Get("username").(string),
CustomID: d.Get("custom_id").(string),
}

if id, ok := d.GetOk("id"); ok {
consumer.ID = id.(string)
}

return consumer
}

Expand Down
6 changes: 0 additions & 6 deletions kong/resource_kong_consumer_acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ func resourceKongConsumerACL() *schema.Resource {
},

Schema: map[string]*schema.Schema{
"id": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "The id of the consumer-acl association.",
},

"consumer": &schema.Schema{
Type: schema.TypeString,
Required: true,
Expand Down
10 changes: 1 addition & 9 deletions kong/resource_kong_consumer_credential_basic_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ func resourceKongBasicAuthCredential() *schema.Resource {
},

Schema: map[string]*schema.Schema{
"id": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},

"username": &schema.Schema{
Type: schema.TypeString,
Required: true,
Expand Down Expand Up @@ -151,15 +146,12 @@ func resourceKongBasicAuthCredentialDelete(d *schema.ResourceData, meta interfac
//TODO: pasword should be SHA1 hashed to avoid differences on refresh - https://github.com/Mashape/kong/blob/master/kong/plugins/basic-auth/crypto.lua
func getBasicAuthCredentialFromResourceData(d *schema.ResourceData) *BasicAuthCredential {
basicAuthCredential := &BasicAuthCredential{
ID: d.Id(),
Username: d.Get("username").(string),
Password: d.Get("password").(string),
Consumer: d.Get("consumer").(string),
}

if id, ok := d.GetOk("id"); ok {
basicAuthCredential.ID = id.(string)
}

return basicAuthCredential
}

Expand Down
10 changes: 1 addition & 9 deletions kong/resource_kong_consumer_credential_jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ func resourceKongJWTCredential() *schema.Resource {
},

Schema: map[string]*schema.Schema{
"id": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},

"key": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -158,17 +153,14 @@ func resourceKongJWTCredentialDelete(d *schema.ResourceData, meta interface{}) e

func getJWTCredentialFromResourceData(d *schema.ResourceData) *JWTCredential {
jwtCredential := &JWTCredential{
ID: d.Id(),
Key: d.Get("key").(string),
Algorithm: d.Get("algorithm").(string),
RSAPublicKey: d.Get("rsa_public_key").(string),
Secret: d.Get("secret").(string),
Consumer: d.Get("consumer").(string),
}

if id, ok := d.GetOk("id"); ok {
jwtCredential.ID = id.(string)
}

return jwtCredential
}

Expand Down
10 changes: 1 addition & 9 deletions kong/resource_kong_consumer_credential_key_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ func resourceKongKeyAuthCredential() *schema.Resource {
},

Schema: map[string]*schema.Schema{
"id": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},

"key": &schema.Schema{
Type: schema.TypeString,
Required: true,
Expand Down Expand Up @@ -134,14 +129,11 @@ func resourceKongKeyAuthCredentialDelete(d *schema.ResourceData, meta interface{

func getKeyAuthCredentialFromResourceData(d *schema.ResourceData) *KeyAuthCredential {
keyAuthCredential := &KeyAuthCredential{
ID: d.Id(),
Key: d.Get("key").(string),
Consumer: d.Get("consumer").(string),
}

if id, ok := d.GetOk("id"); ok {
keyAuthCredential.ID = id.(string)
}

return keyAuthCredential
}

Expand Down
10 changes: 1 addition & 9 deletions kong/resource_kong_key_auth_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ func resourceKongKeyAuthPlugin() *schema.Resource {
},

Schema: map[string]*schema.Schema{
"id": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},

"key_names": &schema.Schema{
Type: schema.TypeString,
Required: true,
Expand Down Expand Up @@ -157,17 +152,14 @@ func resourceKeyAuthPluginDelete(d *schema.ResourceData, meta interface{}) error

func getKeyAuthPluginFromResourceData(d *schema.ResourceData) *KeyAuthPlugin {
plugin := &KeyAuthPlugin{
ID: d.Id(),
Name: "key-auth",
KeyNames: d.Get("key_names").(string),
HideCredentials: d.Get("hide_credentials").(bool),
Anonymous: d.Get("anonymous").(string),
API: d.Get("api").(string),
}

if id, ok := d.GetOk("id"); ok {
plugin.ID = id.(string)
}

return plugin
}

Expand Down
15 changes: 15 additions & 0 deletions vendor/cloud.google.com/go/AUTHORS

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions vendor/cloud.google.com/go/CONTRIBUTORS

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 79f6e76

Please sign in to comment.