twilio / terraform-provider-twilio

Terraform Twilio provider
MIT License
62 stars 13 forks source link

twilio_verify_services_rate_limits_v2 can not update unique_name in-place yet the plan successfully applies #112

Closed apprme closed 2 years ago

apprme commented 2 years ago

Issue Summary

When changing unique_name of a twilio_verify_services_rate_limits_v2 resource, in-place update is planned. Such plan applies successfully, however unique_name does not get updated. Looking at the Update a Rate Limit API documentation, it does not seem to be supported.

Steps to Reproduce

  1. Create a rate limit

    resource "twilio_verify_services_rate_limits_v2" "rate_limit" {
    service_sid = twilio_verify_services_v2.verify.id
    unique_name = "rl_name_1"
    description = "desc1"
    }
  2. Update unique_name

    resource "twilio_verify_services_rate_limits_v2" "rate_limit" {
    service_sid = twilio_verify_services_v2.verify.id
    unique_name = "rl_name_2"
    description = "desc2"
    }
  3. Notice how this is planned as update in-place....

    Terraform will perform the following actions:
    
    # twilio_verify_services_rate_limits_v2.rate_limits will be updated in-place
    ~ resource "twilio_verify_services_rate_limits_v2" "rate_limits" {
      ~ description = "desc1" -> "desc2"
        id          = "sid-goes-here"
      ~ unique_name = "rl_name_1" -> "rl_name_2"
        # (2 unchanged attributes hidden)
    }

    ..... and successfully applied:

    
    twilio_verify_services_rate_limits_v2.rate_limits: Modifying... [id=sid-goes-here]
    twilio_verify_services_rate_limits_v2.rate_limits: Modifications complete after 1s [id=sid-goes-here]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.



4. Perform GET request to `https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/RateLimits/` and notice how `description` is updated, but `unique_name` is not.

### Expected Behaviour

Expected behaviour would be to fail with an error (at least at Apply Time) rather than return success despite silently failing. We would also expect the provider to be smart enough to handle converting the plan to a destroy/recreate operation if it can't update the attribute in place.

### Technical details:
* terraform-provider-twilio version: 0.18
* terraform version: 1.2.0
childish-sambino commented 2 years ago

Ah, looks like a bug. Will have a fix up shortly.