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

terraform plan fails for bitbucketserver_plugin_config & bitbucketserver_plugin when plugin is uninstalled using bitbucket UI #59

Open
rvnyk opened this issue Aug 23, 2023 · 0 comments

Comments

@rvnyk
Copy link

rvnyk commented Aug 23, 2023

Steps to reproduce the bug :

  • 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
  ]
}
 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant