magodo / terraform-provider-restful

Terraform provider to manage RESTful resources
https://registry.terraform.io/providers/magodo/restful
Mozilla Public License 2.0
15 stars 5 forks source link

Add support for a list of attributes that will force the resource to be destroyed and recreated #16

Closed LaurentLesle closed 1 year ago

LaurentLesle commented 2 years ago

The following code would force the the resource group to be destroyed and recreated.

Proposed code with a fore_new attribute with list of the attributes that would force the resource to be recreated.

resource "restful_resource" "gw" {
  path = format("subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/vpnGateways/%s", var.subscription_id, "example", "var.gateway")
  create_mathod = "PUT"
  query = {
    api-version = ["2020-06-01"]
  }
  poll_delete = {
    status_locator = "code"
    status = {
      success = "404"
      pending = ["202", "200"]
    }
  }
  force_new = [
    "name", 
    "properties.isRoutingPreferenceInternet"
  ]
  body = jsonencode({
    location = "westus"
    tags = {
      foo = "bar"
    }
  })
}