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

BUG: When multiple tokens exist for the same config, the returned permission level is incorrect #32

Closed
AnitaErnszt opened this issue Nov 3, 2022 · 3 comments · Fixed by #33

Comments

@AnitaErnszt
Copy link

When multiple service tokens are created for the same config, the returned permission level during Terraform state refresh is incorrect.

Reproduce:

provider "doppler" {}

resource "doppler_project" "this" {
  name        = "test-project"
}

resource "doppler_environment" "environment" {
  project = doppler_project.this.name
  name    = "local"
  slug    = "local"
}

resource "doppler_service_token" "service_token_read" {
  project = doppler_project.this.name
  config  = doppler_environment.environment.slug
  name    = "read"
  access  = "read"

  depends_on = [
    doppler_environment.environment
  ]
}

resource "doppler_service_token" "service_token_write" {
  project = doppler_project.this.name
  config  = doppler_environment.environment.slug
  name    = "write"
  access  = "read/write"

  depends_on = [
    doppler_environment.environment
  ]
}
  1. run terraform apply
  2. run terraform apply again

The 1st run successfully creates the tokens with the required permission levels.
Response on the 2nd run:

Terraform will perform the following actions:

  # doppler_service_token.service_token_read must be replaced
-/+ resource "doppler_service_token" "service_token_read" {
      ~ access  = "read/write" -> "read" # forces replacement
      ~ id      = "test-project.local.73df0b0c-b6a1-4036-aa2a-6a379a0c675a" -> (known after apply)
      ~ key     = (sensitive value)
        name    = "read"
        # (2 unchanged attributes hidden)
    }
@nmanoogian
Copy link
Member

Hey @AnitaErnszt, thanks for reporting this! I'm seeing the same behavior and I've got a fix.

@nmanoogian
Copy link
Member

Thanks again for letting us know about this! The fix has been shipped in the latest version of the provider (terraform-provider-doppler v1.1.6)

@AnitaErnszt
Copy link
Author

Thank you, managed to test it and working as expected 👍

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

Successfully merging a pull request may close this issue.

2 participants