rollbar / terraform-provider-rollbar

Terraform provider for Rollbar
https://rollbar.com
MIT License
28 stars 13 forks source link

Pawel/add timezone timeformat #377

Closed pawelsz-rb closed 8 months ago

pawelsz-rb commented 1 year ago

Description of the change

  1. Adding timezone and time_format to project resource.
  2. Updating project by name, timezone and time_format in place (no new resource on change)
  3. Preserve backward compatibility - skip default timezone and time_format on read.

Checklists

Development

Code review

pawelsz-rb commented 1 year ago

I only found one odd edge case, importing a project that was not created by Terraform resets the timezone/time format configuration to the default values. If fixing this would require other hacky solutions, I'd rather keep it as is.

Yes, as I stated before, there is no perfect solution to this. When we will try to import the project with default timezone and we want to set that timezone explicitly in the tf file then we will get :

  # rollbar_project.terraform_example will be updated in-place
  ~ resource "rollbar_project" "terraform_example" {
        id            = "644248"
        name          = "terraform_example"
      + time_format   = "12h"
      + timezone      = "US/Pacific"
        # (5 unchanged attributes hidden)
    }

as the tfstate file has these 2 variables set to null. so we have 2 scenarios here:

  1. read it as it is - it will fix the import, but after the upgrade to a new tf version just running terraform apply will try to update all the projects (even without additional changes from a user)
  2. skip reading default values (this PR) - problem with terraform import for default values in time_format and timezone vars, but terraform apply will not try to make any changes even after the upgrade to new tf version.

Which way is better ? Depends on a customer and situations. I cannot say that 2) is better than 1) all the time just because it does not change the existing state of the terraform. Also, if we go with 1) a customer may choose not to upgrade now. But what will be in the future when a customer wants to get the next version ? Eventually, they will see some surprises.

We need to decide here, I am really fine with either way.

pawelsz-rb commented 8 months ago

closing this for now