Install any plugin using bitbucketserver_plugin and configuration for the plugin using bitbucketserver_plugin_config
From the Bitbucket UI , under admin options> managed apps , uninstall the plugin
Issue :
Running terraform plan tries to refresh the state for bitbucketserver_plugin and fails with failed to get plugin com.my.oauth.bitbucket-oauth from bitbucket: API Error: 404 /rest/plugins/1.0/com.my.oauth.bitbucket-oauth-key . The expectation was the resource should be marked to be created again and address the drift.
If we manually delete the module module.bitbucket.bitbucketserver_plugin.my_auth_plugin from the terraform state and try terraform plan we get a different error now from bitbucketserver_plugin_config ie Error: API Error: 405 /plugins/servlet/oauth/configure. This might be because bitbucketserver_plugin_config is trying to refresh the state of the config even if the plugin is uninstalled. The expectation was it should try to GET the resource if plugin doesnt exist (is this by design ? )
Following are the resource config :
resource "bitbucketserver_plugin" "my_auth_plugin" {
count = local.my_resource_count
key = "com.my.oauth.bitbucket-oauth"
version = var.my_auth_plugin_version
license = replace(var.my_auth_plugin_license, "\n", "\r\n")
depends_on = [
null_resource.bitbucket_validate, # validate if the bitbucket server is running
]
}
resource "bitbucketserver_plugin_config" "my_pluginconfig" {
config_endpoint = "/plugins/servlet/oauth/configure"
values = local.my_sso_config
depends_on = [
bitbucketserver_plugin.my_auth_plugin,
null_resource.wait_for_mo_auth_plugin_endpoint # wait for the plugin to be installed
]
}
Steps to reproduce the bug :
bitbucketserver_plugin
and configuration for the plugin usingbitbucketserver_plugin_config
Issue :
Running terraform plan tries to refresh the state for
bitbucketserver_plugin
and fails withfailed to get plugin com.my.oauth.bitbucket-oauth from bitbucket: API Error: 404 /rest/plugins/1.0/com.my.oauth.bitbucket-oauth-key
. The expectation was the resource should be marked to be created again and address the drift.If we manually delete the module
module.bitbucket.bitbucketserver_plugin.my_auth_plugin
from the terraform state and try terraform plan we get a different error now frombitbucketserver_plugin_config
ieError: API Error: 405 /plugins/servlet/oauth/configure
. This might be becausebitbucketserver_plugin_config
is trying to refresh the state of the config even if the plugin is uninstalled. The expectation was it should try to GET the resource if plugin doesnt exist (is this by design ? )Following are the resource config :