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

Add databricks_compliance_security_profile_workspace_setting resource #3564

Merged
merged 4 commits into from
May 16, 2024

Conversation

harshshah-db
Copy link
Contributor

@harshshah-db harshshah-db commented May 10, 2024

Changes

Tests

  • make test run locally
  • relevant change in docs/ folder
  • covered with integration tests in internal/acceptance
  • relevant acceptance tests are passing
  • using Go SDK

@harshshah-db harshshah-db requested review from a team as code owners May 10, 2024 06:07
@harshshah-db harshshah-db requested review from tanmay-db and removed request for a team May 10, 2024 06:07
@harshshah-db
Copy link
Contributor Author

harshshah-db commented May 10, 2024

Hi @tanmay-db @alexott @nkvuong @hectorcast-db the test in this PR fails with the following error. Any idea what could be wrong? I already spent hours trying a bunch of stuff but I suspect I am not defining the compliance_standards field properly. Would appreciate any advice/insight.

=== Failed
=== FAIL: settings TestQueryCreateComplianceSecurityProfileSettingWithNoneStandard (0.00s)
    resource_compliance_security_profile_setting_test.go:82:
        	Error Trace:	/Users/harsh.shah/terraform-provider-databricks/settings/resource_compliance_security_profile_setting_test.go:82
        	Error:      	Received unexpected error:
        	            	compliance_security_profile_workspace: compliance_security_profile_workspace: compliance_standards: [compliance_standards]: not resource
        	Test:       	TestQueryCreateComplianceSecurityProfileSettingWithNoneStandard
  

@harshshah-db harshshah-db requested review from alexott and nkvuong May 10, 2024 06:11
@nkvuong
Copy link
Contributor

nkvuong commented May 10, 2024

Hi @tanmay-db @alexott @nkvuong @hectorcast-db the test in this PR fails with the following error. Any idea what could be wrong? I already spent hours trying a bunch of stuff but I suspect I am not defining the compliance_standards field properly. Would appreciate any advice/insight.

=== Failed
=== FAIL: settings TestQueryCreateComplianceSecurityProfileSettingWithNoneStandard (0.00s)
    resource_compliance_security_profile_setting_test.go:82:
        	Error Trace:	/Users/harsh.shah/terraform-provider-databricks/settings/resource_compliance_security_profile_setting_test.go:82
        	Error:      	Received unexpected error:
        	            	compliance_security_profile_workspace: compliance_security_profile_workspace: compliance_standards: [compliance_standards]: not resource
        	Test:       	TestQueryCreateComplianceSecurityProfileSettingWithNoneStandard
  

the issue is with

func collectionToMaps(v any, s *schema.Schema, aliases map[string]map[string]string) ([]any, error) {

basically it tries to convert https://github.com/databricks/databricks-sdk-go/blob/27d08a67df5b0d35544c663f9d47577f85ffc6e4/service/settings/model.go#L199 to a Terraform resource and crashed. []ComplianceStandard crashed, but []string does not.

@edwardfeng-db you last worked on this function, any thoughts?

@edwardfeng-db
Copy link
Contributor

Yeah it seems kind of strange to me that this is a []ComplianceStandard instead of []string, @hectorcast-db is this autogenerated? Any idea why?

@hectorcast-db
Copy link
Contributor

@edwardfeng-db It is a ComplianceStandard because it is an enum and Go does not support enums directly. We create a new type from string

type ComplianceStandard string

We do this for all enums, so I am not sure why would cause an issue now.

@edwardfeng-db
Copy link
Contributor

Thanks @hectorcast-db, yeah this seems like a legit bug on the terraform side, I'll try to fix this

@harshshah-db
Copy link
Contributor Author

Thanks @hectorcast-db, yeah this seems like a legit bug on the terraform side, I'll try to fix this

@edwardfeng-db any ETA on the fix? This is blocking our public api launch which the customers have been asking for.

@edwardfeng-db
Copy link
Contributor

@harshshah-db Hopefully today, still debugging

@edwardfeng-db edwardfeng-db mentioned this pull request May 15, 2024
5 tasks
@edwardfeng-db
Copy link
Contributor

Here's the fix - #3581 Verified it works with the failing test

@codecov-commenter
Copy link

codecov-commenter commented May 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.58%. Comparing base (bd32bf3) to head (a976e1b).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3564      +/-   ##
==========================================
+ Coverage   82.57%   82.58%   +0.01%     
==========================================
  Files         188      189       +1     
  Lines       19191    19207      +16     
==========================================
+ Hits        15847    15863      +16     
  Misses       2414     2414              
  Partials      930      930              
Files Coverage Δ
settings/all_settings.go 100.00% <100.00%> (ø)
...gs/resource_compliance_security_profile_setting.go 100.00% <100.00%> (ø)

@harshshah-db harshshah-db changed the title [Draft] Add compliance security profile setting Add compliance security profile setting May 15, 2024
@harshshah-db harshshah-db changed the title Add compliance security profile setting Add databricks_compliance_security_profile_workspace_setting resource for ESC May 15, 2024
@harshshah-db harshshah-db changed the title Add databricks_compliance_security_profile_workspace_setting resource for ESC Add databricks_compliance_security_profile_workspace_setting resource for ESC May 15, 2024
@harshshah-db harshshah-db changed the title Add databricks_compliance_security_profile_workspace_setting resource for ESC Add databricks_compliance_security_profile_workspace_setting resource May 15, 2024
@harshshah-db
Copy link
Contributor Author

@nkvuong and @alexott - Could you please review this again?

@nkvuong nkvuong added this pull request to the merge queue May 16, 2024
Merged via the queue into databricks:main with commit 74f1fbc May 16, 2024
5 checks passed
hectorcast-db added a commit that referenced this pull request May 23, 2024
### New Features and Improvements

 * Fix bug in collectionToMaps ([#3581](#3581)).
 * Added `databricks_enhanced_security_monitoring_workspace_setting ` resource for ESC (Enhanced Compliance and Security) settings ([#3563](#3563)).
 * Added `databricks_automatic_cluster_update_workspace_setting` resource ([#3444](#3444)).
 * Add databricks_compliance_security_profile_workspace_setting resource ([#3564](#3564)).
 * Make customizable error logs more readable ([#3583](#3583)).
 * Fix control run state failures for `databricks_job` resource ([#3585](#3585)).
 * Added support for popular column types for `resource_sql_table` ([#3528](#3528)).
 * Modify state upgrader to remove `ebs_volume_iops` set to zero ([#3601](#3601)).
 * Add route optimized option to model serving terraform ([#3572](#3572)).
 * Rename lakehouse monitor to quality monitor ([#3584](#3584)).

### Documentation Changes
 * Fix documentation for `databricks_storage_credential` and `databricks_external_location` data sources ([#3588](#3588)).

### Exporter
 * Add support for `databricks_mws_permission_assignment` resource ([#3562](#3562)).
 * Don't list directories in the incremental mode ([#3569](#3569)).

### Internal Changes
 * Add TestMwsAccServicePrincipalResourceOnAws to flaky tests ([#3580](#3580)).

### Dependency updates
 * Bump github.com/databricks/databricks-sdk-go from 0.40.1 to 0.41.0 ([#3604](#3604)).
 * Bump github.com/hashicorp/terraform-plugin-sdk/v2 from 2.33.0 to 2.34.0 ([#3594](#3594)).
@hectorcast-db hectorcast-db mentioned this pull request May 23, 2024
github-merge-queue bot pushed a commit that referenced this pull request May 23, 2024
* Release v1.45.0

### New Features and Improvements

 * Fix bug in collectionToMaps ([#3581](#3581)).
 * Added `databricks_enhanced_security_monitoring_workspace_setting ` resource for ESC (Enhanced Compliance and Security) settings ([#3563](#3563)).
 * Added `databricks_automatic_cluster_update_workspace_setting` resource ([#3444](#3444)).
 * Add databricks_compliance_security_profile_workspace_setting resource ([#3564](#3564)).
 * Make customizable error logs more readable ([#3583](#3583)).
 * Fix control run state failures for `databricks_job` resource ([#3585](#3585)).
 * Added support for popular column types for `resource_sql_table` ([#3528](#3528)).
 * Modify state upgrader to remove `ebs_volume_iops` set to zero ([#3601](#3601)).
 * Add route optimized option to model serving terraform ([#3572](#3572)).
 * Rename lakehouse monitor to quality monitor ([#3584](#3584)).

### Documentation Changes
 * Fix documentation for `databricks_storage_credential` and `databricks_external_location` data sources ([#3588](#3588)).

### Exporter
 * Add support for `databricks_mws_permission_assignment` resource ([#3562](#3562)).
 * Don't list directories in the incremental mode ([#3569](#3569)).

### Internal Changes
 * Add TestMwsAccServicePrincipalResourceOnAws to flaky tests ([#3580](#3580)).

### Dependency updates
 * Bump github.com/databricks/databricks-sdk-go from 0.40.1 to 0.41.0 ([#3604](#3604)).
 * Bump github.com/hashicorp/terraform-plugin-sdk/v2 from 2.33.0 to 2.34.0 ([#3594](#3594)).

* fixes
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

Successfully merging this pull request may close these issues.

6 participants