Skip to content

Commit

Permalink
chore: remove use of deprecated GetOkExists terraform fn
Browse files Browse the repository at this point in the history
  • Loading branch information
mefellows committed Jun 6, 2022
1 parent 376e92f commit 6eebfe1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion resource_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func setSecretState(d *schema.ResourceData, secret broker.Secret) error {
} else {
// Broker does not return the value, to prevent it always thinking the value is ""
// and requires an update, set to original
if original, ok := d.GetOkExists("value"); ok {
if original, ok := d.GetOk("value"); ok {
d.Set("value", original.(string))
} else {
log.Println("[DEBUG] could not find original value for 'value'")
Expand Down
12 changes: 6 additions & 6 deletions resource_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,14 @@ func parseWebhook(d *schema.ResourceData, meta interface{}) (broker.Webhook, err
webhook.Description = d.Get("description").(string)

// Team
if team, ok := d.GetOkExists("team"); ok {
if team, ok := d.GetOk("team"); ok {
if team != "" {
webhook.TeamUUID = team.(string)
}
}

// Provider
if rawProvider, ok := d.GetOkExists("webhook_provider"); ok {
if rawProvider, ok := d.GetOk("webhook_provider"); ok {
provider := new(broker.Pacticipant)
log.Printf("[DEBUG] raw provider %+v \n", rawProvider)
err := mapstructure.Decode(rawProvider, provider)
Expand All @@ -192,7 +192,7 @@ func parseWebhook(d *schema.ResourceData, meta interface{}) (broker.Webhook, err
}

// Consumer
if rawConsumer, ok := d.GetOkExists("webhook_consumer"); ok {
if rawConsumer, ok := d.GetOk("webhook_consumer"); ok {
consumer := new(broker.Pacticipant)
log.Printf("[DEBUG] raw consumer %+v \n", rawConsumer)
err := mapstructure.Decode(rawConsumer, consumer)
Expand All @@ -207,7 +207,7 @@ func parseWebhook(d *schema.ResourceData, meta interface{}) (broker.Webhook, err
}

// Events
if eventsRaw, ok := d.GetOkExists("events"); ok {
if eventsRaw, ok := d.GetOk("events"); ok {
events := eventsRaw.(*schema.Set)
for _, event := range ExpandStringSet(events) {
log.Printf("[DEBUG]event item %+v\n", event)
Expand All @@ -219,7 +219,7 @@ func parseWebhook(d *schema.ResourceData, meta interface{}) (broker.Webhook, err

// Request
log.Println("[DEBUG] checking request")
if rawRequest, ok := d.GetOkExists("request"); ok {
if rawRequest, ok := d.GetOk("request"); ok {
log.Printf("[DEBUG] have raw request of %+v \n", rawRequest)

rawRequestList := rawRequest.([]interface{})
Expand Down Expand Up @@ -370,7 +370,7 @@ func flattenRequest(d *schema.ResourceData, r broker.Request) []interface{} {
} else {
// Broker obscures the value to "******", set the value to what it was previously
// to prevent it always thinking the value is ""
if original, ok := d.GetOkExists("request.0.password"); ok {
if original, ok := d.GetOk("request.0.password"); ok {
m["password"] = original.(string)
} else {
log.Println("[DEBUG] could not find original value for 'password'")
Expand Down

0 comments on commit 6eebfe1

Please sign in to comment.