-
Notifications
You must be signed in to change notification settings - Fork 393
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
Added support for iam_role_arn
in databricks_instance_profile
#1943
Conversation
Please note that this is my first stab at writing anything in go, so feel free to consider this PR just as a PoC for the intended support feature if there is anything fundamentally wrong otherwise. |
ping @alexott |
Also, add documentation |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #1943 +/- ##
==========================================
+ Coverage 90.19% 90.29% +0.09%
==========================================
Files 146 146
Lines 11843 11888 +45
==========================================
+ Hits 10682 10734 +52
+ Misses 748 742 -6
+ Partials 413 412 -1
|
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.
lgtm. Let check with the PR runner
There seems to be a typo |
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.
the diff coverage is only 53.33%.
Can you add test cases for ValidInstanceProfile
function for following pieces that aren't covered:
if !ok {
if len(arnSections) != 6 {
and in ValidIamRole
if !ok {
if len(arnSections) != 6 {
if !strings.HasPrefix(arnSections[5], "role") {
And really, the ValidInstanceProfile
and ValidIamRole
are only different in the line
if !strings.HasPrefix(arnSections[5], "role")
But really you can create a function that will receive role
or instance-profile
as an argument and return result...
Sure. That'll handle the DRY issue as well |
One thing that is different between instance profile & role validation is that we're allowing empty role, while instance profile shouldn't allow it |
Oh, I got confused by the fact that InstanceProfileArn is marked as In other matters, I don't seem to be able to write a test for |
Hmmm, interesting - |
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.
lgtm
@nfx - please look & merge
iam_role_arn
parameteriam_role_arn
attribute in databricks_instance_profile
iam_role_arn
attribute in databricks_instance_profile
iam_role_arn
in databricks_instance_profile
…tabricks#1943) * Add IamRoleArn to instance_profile resource * Add tests * Add handling for empty string role ARN * Add documentation * Modifications according to PR comments * Fix typo * Unify ARN validation functions * Rename validation tests * Do not allow empty instance profile ARNs * Remove `omitempty` from required field * Add default clause
This PR adds support to manage an instance profile's IAM role ARN when it does not match the instance profile name. This feature is needed when managing instance profiles for use with Databricks SQL serverless.
See Databricks REST API documentation for instance profiles
Fixes #1911
Fixes #1710