resource "restful_resource" "self" {
lifecycle {
# For edge cases such as renaming a property group while blueprints are using it.
# Instruct Terraform to create new property group, update references, then destroy the old one.
# Blueprints must be updated on the same apply or deletion will fail with a conflict error.
create_before_destroy = true
}
path = "/properties/api/property-groups"
create_method = "POST"
read_path = "$(path)/$(body.id)"
update_path = "$(path)/$(body.id)"
delete_path = "$(path)/$(body.id)"
force_new_attrs = ["name"]
output_attrs = ["id"] # Not cluttering state and diff with more than this
body = jsonencode({
type = "INPUT"
name = "${var.app_code}_${replace(var.app_name, " ", "_")}_${var.name}"
description = var.description
properties = var.properties
})
}
Our code using
restful
provider for reference: