-
Notifications
You must be signed in to change notification settings - Fork 406
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
[Fix] Suppress options.pem_private_key_expiration_epoch_sec
attribute for databricks_connection
#4474
Conversation
… `databricks_connection`
options.pem_private_key_expiration_epoch_sec
attribute for databricks_connection
options.pem_private_key_expiration_epoch_sec
attribute for databricks_connection
catalog/resource_connection.go
Outdated
func suppressPemPrivateKeyExpiration(key, old, new string, d *schema.ResourceData) bool { | ||
k := "options.pem_private_key_expiration_epoch_sec" | ||
if _, ok := d.GetOk(k); ok && !d.HasChange(k) { | ||
return true | ||
} | ||
return false | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it work if we set this field to optional+computed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried this initially, but it seems that because pem_private_key_expiration_epoch_sec
is not defined in the Schema directly. I cannot call something like:
common.MustSchemaPath(m, "options", "pem_private_key_expiration_epoch_sec").Optional = true
common.MustSchemaPath(m, "options", "pem_private_key_expiration_epoch_sec").Computed = true
Error:
Stack trace from the terraform-provider-databricks plugin:
panic: options is not nested resource
goroutine 1 [running]:
github.com/databricks/terraform-provider-databricks/common.MustSchemaPath(...)
/terraform-provider-databricks/common/reflect_resource.go:232
github.com/databricks/terraform-provider-databricks/catalog.ResourceConnection.func1(0x140003abce0)
/terraform-provider-databricks/catalog/resource_connection.go:61 +0x14c
github.com/databricks/terraform-provider-databricks/common.StructToSchema({0x105685920?, 0x1400033fb80?}, 0x105720028)
/terraform-provider-databricks/common/reflect_resource.go:257 +0x1d4
github.com/databricks/terraform-provider-databricks/catalog.ResourceConnection()
/terraform-provider-databricks/catalog/resource_connection.go:58 +0x80
github.com/databricks/terraform-provider-databricks/internal/providers/sdkv2.DatabricksProvider({0x0, 0x0, 0x0})
/terraform-provider-databricks/internal/providers/sdkv2/sdkv2.go:146 +0x5180
github.com/databricks/terraform-provider-databricks/internal/providers.GetProviderServer({0x105736400, 0x106239440}, {0x0, 0x0, 0x14000131ed8?})
/terraform-provider-databricks/internal/providers/providers.go:78 +0xa4
main.main()
/terraform-provider-databricks/main.go:41 +0x268
Need to tinker a bit more
…teKeyExpiration()`
options.pem_private_key_expiration_epoch_sec
attribute for databricks_connection
options.pem_private_key_expiration_epoch_sec
attribute for databricks_connection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have any environment to test it?
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
## Release v1.66.0 ### New Features and Improvements * Add multipart permissions to `databricks_aws_unity_catalog_policy` data source ([#4440](#4440)). ### Bug Fixes * Fixed an issue where reordering objects in a (pluginfw) Share wouldn’t update properly unless other changes were made ([#4481](#4481)). * Suppress `options.pem_private_key_expiration_epoch_sec` attribute for databricks_connection ([#4474](#4474)). ### Documentation * Add an example for Databricks Apps permissions ([#4475](#4475)). * Add explanation of timeouts to the troubleshooting guide ([#4482](#4482)). * Clarify that `databricks_token` and `databricks_obo_token` could be used only with workspace-level provider ([#4480](#4480)). ### Exporter * Refactor UC, SQL and SCIM objects into separate files ([#4477](#4477)). ### Internal Changes * Remove incorrectly working integration test `TestAccLibraryUpdateTransitionFromPluginFw` ([#4487](#4487)).
Suppress
options.pem_private_key_expiration_epoch_sec
attribute from API to prevent drift when creating a Snowflake connection usingpem_private_key
.Resolves #4471
Changes
Add
suppressPemPrivateKeyExpiration
function. Whenoptions.pem_private_key_expiration_epoch_sec
exists, we suppress foroptions.pem_private_key_expiration_epoch_sec
.Tests
Tested in my local environment.
First run:
Subsequent run:
Changing another variable within
options
inside Terraform code:make test
run locallydocs/
folderinternal/acceptance