rollbar / terraform-provider-rollbar

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

Importing Owners and Everyone teams not possible #235

Closed KieranP closed 4 months ago

KieranP commented 3 years ago
resource "rollbar_team" "owners" {
  name = "Owners"
  access_level = "standard"
}

resource "rollbar_team" "everyone" {
  name = "Everyone"
  access_level = "standard"
}
  # rollbar_team.everyone must be replaced
-/+ resource "rollbar_team" "everyone" {
      ~ access_level = "everyone" -> "standard" # forces replacement
      ~ account_id   = 12345 -> (known after apply)
      ~ id           = "12345" -> (known after apply)
        name         = "Everyone"
    }

  # rollbar_team.owners must be replaced
-/+ resource "rollbar_team" "owners" {
      ~ access_level = "owner" -> "standard" # forces replacement
      ~ account_id   = 12345 -> (known after apply)
      ~ id           = "12346" -> (known after apply)
        name         = "Owners"
    }

When I change access_level to match what current exists ("owner" and "everyone"), then I get:

│ Error: Invalid access_level: "everyone"
│
│   with rollbar_team.owners,
│   on rollbar.tf line 26, in resource "rollbar_team" "owners":
│   26:   access_level = "everyone"
│
│ Must be "standard", "light", or "view"
╵
╷
│ Error: Invalid access_level: "everyone"
│
│   with rollbar_team.everyone,
│   on rollbar.tf line 31, in resource "rollbar_team" "everyone":
│   31:   access_level = "everyone"
│
│ Must be "standard", "light", or "view"

So importing these teams to link people to seems impossible.

ewypych commented 3 years ago

Same problem here.

magnetikonline commented 6 months ago

Thanks for raising this @KieranP - I'm getting the same issue - and thats with the current v1.14.0 release.

It's a shame this is an issue for 2021 - makes the provider in it's current state virtually useless for an existing Rollbar distribution, unless I'm missing something?

zdavis-rollbar commented 4 months ago

This is designed into the application. Our API will only create (import) users with standard, light and view access_levels. The Everyone team will automatically add any imported user to any team, and the owner team is an admin level and needs to be added through the UI.

zdavis-rollbar commented 4 months ago

After some review, you can import the owners and everyone team resource, as long as you don't specify access_level explicitly in terraform file:

resource "rollbar_team" "owners_team" {
  name = "Owners"
}

resource "rollbar_team" "everyone" {
  name = "Everyone"
}

and the terraform state file will assign the access level correctly:

 {
      "mode": "managed",
      "type": "rollbar_team",
      "name": "owners_team",
      "provider": "provider[\"registry.terraform.io/rollbar/rollbar\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "access_level": "owner",
            "account_id": 111111,
            "id": "72234e5345435",
            "name": "Owners"
          },
          "sensitive_attributes": [],
          "private": "*****"
        }
      ]
    }