gitlab_user_sshkey resources do not converge
GitLab Provider version
3.14.0
GitLab version
14.9.3
Terraform version
0.13.7
Relevant Terraform Configuration
resource "gitlab_group_access_token" "bot-token" {
group = 123
name = "Bot Token"
access_level = "developer"
scopes = [ "api" ]
}
resource "tls_private_key" "bot-key" {
algorithm = "ED25519"
}
resource "gitlab_user_sshkey" "bot-key" {
user_id = gitlab_group_access_token.bot-token.user_id
title = "bot-key"
key = tls_private_key.bot-key.public_key_openssh
}
Relevant log output
# gitlab_user_sshkey.bot-key must be replaced
-/+ resource "gitlab_user_sshkey" "bot-key" {
~ created_at = "2022-07-13T19:49:34Z" -> (known after apply)
~ id = "14:5" -> (known after apply)
~ key = <<~EOT # forces replacement
- ssh-ed25519 AAAA... Bot Token (whetstone.privatestorage-staging.com)
+ ssh-ed25519 AAAA...
EOT
~ key_id = 5 -> (known after apply)
title = "bot-key"
user_id = 14
}
Description
GitLab seems to modify the supplied key by adding a username and hostname. The gitlab_user_sshkey detects this difference and decides it needs to push its value. However, no matter how many times it does this, GitLab just re-modifies the value and the deployment never converges (ie, changes are always seen as required).
Edited by Timo Furrer