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

Allow to disable auto-stop for SQL Endpoints #900

Merged
merged 1 commit into from
Feb 14, 2022
Merged

Allow to disable auto-stop for SQL Endpoints #900

merged 1 commit into from
Feb 14, 2022

Conversation

alexott
Copy link
Contributor

@alexott alexott commented Nov 4, 2021

No description provided.

@alexott alexott requested a review from nfx November 4, 2021 19:58
@codecov
Copy link

codecov bot commented Nov 4, 2021

Codecov Report

Merging #900 (33f9731) into master (1bfabed) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #900   +/-   ##
=======================================
  Coverage   90.95%   90.95%           
=======================================
  Files         110      110           
  Lines        9497     9499    +2     
=======================================
+ Hits         8638     8640    +2     
  Misses        509      509           
  Partials      350      350           
Impacted Files Coverage Δ
sql/resource_sql_endpoint.go 97.33% <100.00%> (+0.07%) ⬆️

@@ -85,7 +85,7 @@ func StructToSchema(v interface{}, customize func(map[string]*schema.Schema) map
}

func handleOptional(typeField reflect.StructField, schema *schema.Schema) {
if strings.Contains(typeField.Tag.Get("json"), "omitempty") {
if strings.Contains(typeField.Tag.Get("json"), "omitempty") || strings.Contains(typeField.Tag.Get("tf"), "optional") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may cause schema consistency validation errors, need to run also integration tests just to be sure

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you afraid that something will break, then I can get back to original fix:

m["auto_stop_mins"].Required = false
m["auto_stop_mins"].Optional = true

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required is false by default anyway.

This is literally the same annoying case as with num_workers, where we have a lot of hacks around.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. If I remove omitempty then it’s implicitly set to Required = true during analysis of the struct… I already hit this issue :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I need to check, maybe we can simplify other places with that

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be no struct tags for single place use

@@ -186,6 +186,8 @@ func ResourceSQLEndpoint() *schema.Resource {
s := common.StructToSchema(SQLEndpoint{}, func(
m map[string]*schema.Schema) map[string]*schema.Schema {
m["auto_stop_mins"].Default = 120
m["auto_stop_mins"].Required = false
m["auto_stop_mins"].Optional = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.Optional = true and no omitempty creates a schema consistency conflict.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's why it has .Required = false

@nfx
Copy link
Contributor

nfx commented Nov 5, 2021

this PR is of low priority, given the percentage of resource usage across all resources.

@nfx nfx added the suppress diff issue related to configuration drift, most likely from Cluster Manager label Dec 11, 2021
@nfx nfx added this to the v0.4.9 milestone Feb 3, 2022
@nfx nfx modified the milestones: v0.4.9, v0.5.0 Feb 11, 2022
@nfx nfx merged commit 73fe251 into master Feb 14, 2022
@nfx nfx deleted the issue-896 branch February 14, 2022 16:28
@nfx nfx mentioned this pull request Feb 18, 2022
michael-berk pushed a commit to michael-berk/terraform-provider-databricks that referenced this pull request Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
suppress diff issue related to configuration drift, most likely from Cluster Manager
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants