Skip to content

Commit

Permalink
Update examples per the breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
magodo committed Nov 24, 2022
1 parent 3c59c50 commit 50efe37
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions examples/resources/restful_operation/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ resource "restful_operation" "register_rp" {
}
method = "POST"
poll = {
url_locator = format("exact[/subscriptions/%s/providers/Microsoft.ProviderHub?api-version=2014-04-01-preview]", var.subscription_id)
status_locator = "body[registrationState]"
url_locator = format("exact./subscriptions/%s/providers/Microsoft.ProviderHub?api-version=2014-04-01-preview", var.subscription_id)
status_locator = "body.registrationState"
status = {
success = "Registered"
pending = ["Registering"]
Expand Down
4 changes: 2 additions & 2 deletions examples/usecases/azure/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ resource "restful_resource" "rg" {

locals {
vnet_poll = {
status_locator = "body[status]"
status_locator = "body.status"
status = {
success = "Succeeded"
failure = "Failed"
pending = ["Pending"]
}
url_locator = "header[azure-asyncoperation]"
url_locator = "header.azure-asyncoperation"
}
}

Expand Down
4 changes: 2 additions & 2 deletions examples/usecases/msgraph/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ provider "restful" {

resource "restful_resource" "group" {
path = "/groups"
name_path = "id"
read_path = "$(path)/$(body.id)"
body = jsonencode({
description = "Self help community for library"
displayName = "Library Assist"
Expand All @@ -48,7 +48,7 @@ resource "restful_resource" "group" {

resource "restful_resource" "user" {
path = "/users"
name_path = "id"
read_path = "$(path)/$(body.id)"
body = jsonencode({
accountEnabled = true
mailNickname = "AdeleV"
Expand Down
8 changes: 4 additions & 4 deletions examples/usecases/thingsboard/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ data "restful_resource" "user" {

resource "restful_resource" "customer" {
path = "/customer"
name_path = "id.id"
read_path = "$(path)/$(body.id.id)"
body = jsonencode({
title = "Example Company"
tenantId = {
Expand All @@ -66,7 +66,7 @@ resource "restful_resource" "customer" {

resource "restful_resource" "device_profile" {
path = "/deviceProfile"
name_path = "id.id"
read_path = "$(path)/$(body.id.id)"
body = jsonencode({
tenantId = {
id = jsondecode(data.restful_resource.user.output).tenantId.id
Expand Down Expand Up @@ -101,7 +101,7 @@ resource "restful_resource" "device_profile" {

resource "restful_resource" "device" {
path = "/device"
name_path = "id.id"
read_path = "$(path)/$(body.id.id)"
body = jsonencode({
tenantId = {
id = jsondecode(data.restful_resource.user.output).tenantId.id
Expand Down Expand Up @@ -204,7 +204,7 @@ locals {

resource "restful_resource" "dashboard" {
path = "/dashboard"
name_path = "id.id"
read_path = "$(path)/$(body.id.id)"
body = jsonencode({
tenantId = {
id = jsondecode(data.restful_resource.user.output).tenantId.id
Expand Down

0 comments on commit 50efe37

Please sign in to comment.