segmentio / terraform-provider-segment

Terraform provider for Segment, using the Public API
https://registry.terraform.io/providers/segmentio/segment/latest
MIT License
25 stars 3 forks source link

Ensure created resources are tainted properly upon failed applies #99

Closed deanhuynh closed 4 months ago

deanhuynh commented 4 months ago

This ensures that duplicates are not created. This will still leave the resource dangling upon a failure, but it will be cleaned up and recreated on the next run. AWS provider follows this same process e.g here. Addresses #94

Terraform will perform the following actions:

  # segment_tracking_plan.my_tracking_plan_2 is tainted, so must be replaced
-/+ resource "segment_tracking_plan" "my_tracking_plan_2" {
      ~ created_at  = "2024-03-06T22:38:53.000Z" -> (known after apply)
      ~ id          = "tp_2dKld0tS8WtlgdrU8TznEf4b5gO" -> (known after apply)
        name        = "my-tracking-plan-4"
      ~ rules       = [
          + {
              + json_schema = jsonencode(
                    {
                      + "$schema"  = "http://json-schema.org/draft-07/schema#"
                      + properties = {
                          + context    = {
                              + type = [
                                  + "object",
                                  + "any",
                                ]
                            }
                          + properties = {}
                          + traits     = {}
                        }
                    }
                )
              + key         = "Add Rule"
              + type        = "TRACK"
              + version     = 1
            },
        ]
      + slug        = (known after apply)
      ~ updated_at  = "2024-03-06T22:38:53.000Z" -> (known after apply)
        # (2 unchanged attributes hidden)
    }

Plan: 1 to add, 0 to change, 1 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: