terraform-provider-databricks
terraform-provider-databricks copied to clipboard
[Draft] Add compliance security profile setting
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
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
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 https://github.com/databricks/terraform-provider-databricks/blob/31df20c094cef22242ec6e43f3536ba2719e2bb8/common/reflect_resource.go#L631
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?
Yeah it seems kind of strange to me that this is a []ComplianceStandard
instead of []string
, @hectorcast-db is this autogenerated? Any idea why?
@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.
Thanks @hectorcast-db, yeah this seems like a legit bug on the terraform side, I'll try to fix this
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.
@harshshah-db Hopefully today, still debugging
Here's the fix - https://github.com/databricks/terraform-provider-databricks/pull/3581 Verified it works with the failing test
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 82.58%. Comparing base (
bd32bf3
) to head (a976e1b
).
Additional details and impacted files
@@ 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%> (ø) |
@nkvuong and @alexott - Could you please review this again?