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

proxmox_virtual_environment_user_token is not idempotent if no expiration_date is set #1292

Closed
hamannju opened this issue May 14, 2024 · 1 comment · Fixed by #1293
Closed
Labels
🐛 bug Something isn't working

Comments

@hamannju
Copy link

hamannju commented May 14, 2024

Hello. I was just testing Terraform on my Proxmox cluster and I created a module in order to have a DRY way to create Kubernetes cluster environments confined to their own respective pools.

I used the resource "proxmox_virtual_environment_user_token" to create an API token for the management user without an expiration date. If I apply this configuration everything gets created correctly. However, if I run terraform plan after applying the configuration I receive this output:

module.k8s_dev.proxmox_virtual_environment_user_token.user_token will be updated in-place
  ~ resource "proxmox_virtual_environment_user_token" "user_token" {
      - expiration_date       = "1970-01-01T00:00:00Z" -> null
        id                    = "k8s_dev_user@pve!management_token"
      ~ value                 = (sensitive value)
        # (4 unchanged attributes hidden)
    }

The problem seems to be that Proxmox sets the expiration date to "1970-01-01T00:00:00Z" if no expiration date is set upon creating an API token which is different from null. I think the default behavior should be to set the expiration_date to this value if no expiration_date is defined in the resource definition.

Here is the resource definition I used, for reference:

resource "proxmox_virtual_environment_user_token" "user_token" {
  comment               = "Managed by Terraform"
  token_name            = "management_token"
  user_id               = proxmox_virtual_environment_user.pool_user.user_id
  privileges_separation = false
}

Also thank you for working on this beautiful provider, it is a blessing :)

@hamannju hamannju added the 🐛 bug Something isn't working label May 14, 2024
@bpg
Copy link
Owner

bpg commented May 14, 2024

Good catch, @hamannju! This one is easy to fix.

And thanks for the good words! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants