davidfischer-ch / terraform-provider-aria

This is a Terraform provider for working with VMware's Aria Automation Platform (unofficial).
Mozilla Public License 2.0
3 stars 0 forks source link

Add `aria_property_group` managed resource #12

Closed davidfischer-ch closed 3 months ago

davidfischer-ch commented 4 months ago

Our code using restful provider for reference:

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
  })
}