Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Team timezone fails for proper timezones #1944

Open
froque opened this issue Dec 6, 2024 · 1 comment
Open

Team timezone fails for proper timezones #1944

froque opened this issue Dec 6, 2024 · 1 comment

Comments

@froque
Copy link

froque commented Dec 6, 2024

Terraform Version

1.10.1

Terraform Grafana Provider Version

3.14.0

Grafana Version

Grafana Cloud

Affected Resource(s)

  • grafana_team

Terraform Configuration Files

resource "grafana_team" "test-team" {
  name  = "..."
  email = "..."
  members  = [
    ...
  ]
  preferences {
    home_dashboard_uid = null
    theme              = null
    timezone           = "Europe/Madrid"
    week_start         = null
  }
}

Expected Behavior

Terraform should be able to support the timezone as is already supported in the web interface.

The REST API also supports it, even if the documentation says it is not:

timezone - One of: utc, browser, or an empty string for the default
https://grafana.com/docs/grafana-cloud/developer-resources/api-reference/http-api/team/#update-team-preferences

❯ curl -H "Authorization: Bearer $GRAFANA_AUTH" \ 
    -H 'Content-Type: application/json' \
    -X PUT \
    -d '{"timezone": "Europe/Madrid"}' \
    "https://xxx.grafana.net/api/teams/2/preferences"
{"message":"Preferences updated"}

❯ curl -s -H "Authorization: Bearer $GRAFANA_AUTH" \
    "https://xxx.grafana.net/api/teams/2/preferences"

Actual Behavior

│ Error: expected preferences.0.timezone to be one of ["utc" "browser" ""], got Europe/Madrid
│ 
│   with grafana_team.test-team,
│   on main.tf line 30, in resource "grafana_team" "test-team":
│   30:     timezone           = "Europe/Madrid"

Steps to Reproduce

  1. create a resource grafana_team
  2. in preferences, define timezone Europe/Madrid
  3. terraform plan

Important Factoids

No response

References

No response

@Duologic
Copy link
Member

Validation happens here:

https://github.com/grafana/terraform-provider-grafana/blob/58cbf86/internal/resources/grafana/resource_team.go#L121-L127

We should probably decide whether we want client side validation or just leave it open as a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants