Closed hgontijo closed 4 years ago
Thanks for the quick turnaround. I squashed into a single commit to remove the corp URLs. :D Could you try to remove your comment so sensitive data is also deleted? Thanks!
@hgontijo Tests failed on CI 😢 https://travis-ci.org/gavinbunney/terraform-provider-bitbucketserver
You can run them locally with:
make testacc-bitbucket
I'm running the data plugin config resource test with this:
config := `
resource "bitbucketserver_plugin" "config_test" {
key = "de.codecentric.atlassian.oidc.bitbucket-oidc-plugin"
version = "1.5.1"
}
data "bitbucketserver_plugin_config" "config_test" {
key = "oidc"
depends_on = [ bitbucketserver_plugin.config_test ]
}
`
And getting this error:
--- FAIL: TestAccBitbucketPluginConfig_basic (3.67s)
testing.go:568: Step 0 error: After applying this step and refreshing, the plan was not empty:
DIFF:
UPDATE: data.bitbucketserver_plugin_config.config_test
id: "" => "<computed>"
key: "" => "oidc"
validlicense: "" => "<computed>"
values: "" => "<computed>"
STATE:
bitbucketserver_plugin.config_test:
ID = de.codecentric.atlassian.oidc.bitbucket-oidc-plugin
provider = provider.bitbucketserver
applied_license.# = 1
applied_license.0.active = false
applied_license.0.auto_renewal = false
applied_license.0.contact_email =
applied_license.0.crossgradeable = false
applied_license.0.data_center = false
applied_license.0.enterprise = false
applied_license.0.evaluation = false
applied_license.0.expiry_date = 0001-01-01 00:00:00 +0000 UTC
applied_license.0.license_type =
applied_license.0.maintenance_expired = false
applied_license.0.maintenance_expiry_date = 0001-01-01 00:00:00 +0000 UTC
applied_license.0.nearly_expired = false
applied_license.0.organization_name =
applied_license.0.purchase_past_server_cutoff_date = false
applied_license.0.raw_license =
applied_license.0.renewable = false
applied_license.0.subscription = false
applied_license.0.support_entitlement_number =
applied_license.0.upgradable = false
applied_license.0.valid = false
description = Plugin to add OpenID Connect Single-Sign-On support to Bitbucket.
enabled = true
enabled_by_default = true
key = de.codecentric.atlassian.oidc.bitbucket-oidc-plugin
name = Bitbucket Enterprise SSO with Keycloak
optional = true
user_installed = true
vendor.link = https://www.codecentric.de/
vendor.marketplace_link = https://www.codecentric.de/
vendor.name = codecentric
version = 1.5.1
The data schema looks like:
Schema: map[string]*schema.Schema{
"key": {
Type: schema.TypeString,
Required: true,
},
"validlicense": {
Type: schema.TypeBool,
Computed: true,
},
"values": {
Type: schema.TypeString,
Computed: true,
},
},
Some idea of could be causing this issue?
Dug a little bit deeper into your changes.... some thoughts:
It's failing as the "odic" endpoint you're hitting is updating the validlisense
field in the resource from false to true; so terraform thinks there will be a change. The test framework makes sure that nothing changes during an update. Fix for that is to make the validlicense
field a computed
one and it will be fine after that.
What is validlicense field actually used for? Again, sounds specific to the plugin, so would need to remove it. You can get license details from the data.plugin
stanza as it already talks to the marketplace APIs
However... thinking about it more, I'm not sure if this is a generic feature that the provider should have? As it's for a specific plugin. We could generalize it a bit more, and rather than key
have a config_endpoint
parameter in which the user's can specify the URL to post the JSON payloads to. Would be more generic than the existing one and likely still fit your use-case.
So think it needs to:
key
to config_endpoint
, and accept the entire /rest/blah
URL from thatGood thoughts. I actually don't see a need for managing the validLicense. This Rest API I'm using in here is actually not documented so I think it makes sense to keep it explicit by letting the user set the config endpoint.
I'll wait for a new PR then 👯♂
Could you release a new version as well? Thanks 👍