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

New Resource: azurerm_databricks_workspace #1134

Merged
merged 14 commits into from Oct 1, 2018

Conversation

yaron2
Copy link
Contributor

@yaron2 yaron2 commented Apr 18, 2018

This PR adds Azure Databricks Workspace support as "azurerm_databricks_workspace".

Fixes #1133

@achandmsft
Copy link
Contributor

@tombuildsstuff @metacpp could one of you please take a look at this PR so we can ship this?

return fmt.Errorf("Cannot read Databricks Workspace Instance %s (resource group %s) ID", name, resGroup)
}

log.Printf("[DEBUG] Waiting for Databricks Workspace (%s) to become available", d.Get("workspace_name"))
Copy link

Choose a reason for hiding this comment

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

Why not using name variable here?


future, err := client.CreateOrUpdate(ctx, workspace, resGroup, name)
if err != nil {
return err
Copy link

Choose a reason for hiding this comment

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

Better to refine the error message here to be consist with other resources.

return fmt.Errorf("Cannot read Databricks Workspace %s (resource group %s) ID", name, resGroup)
}

log.Printf("[DEBUG] Waiting for Databricks Workspace (%s) to become available", d.Get("workspace_name"))
Copy link

Choose a reason for hiding this comment

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

name?

azurerm/resource_arm_databricks_workspace.go Outdated Show resolved Hide resolved
resp, err := client.Get(ctx, resGroup, name)

// covers if the resource has been deleted outside of TF, but is still in the state
if resp.StatusCode == http.StatusNotFound {
Copy link

Choose a reason for hiding this comment

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

if utils.ResponseWasNotFound(resp.Response) {


future, err := client.Delete(ctx, resGroup, name)
if err != nil {
if response.WasNotFound(future.Response()) {
Copy link

Choose a reason for hiding this comment

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

What is this for?

@JunyiYi
Copy link

JunyiYi commented Apr 25, 2018

Hi @yaron2 , did you upgrade the Go SDK? If so, did you also change the vendor/vendor.json file?

@yaron2
Copy link
Contributor Author

yaron2 commented Apr 30, 2018

@JunyiYi Hey, I didn't upgrade the Go SDK

@JunyiYi
Copy link

JunyiYi commented Apr 30, 2018

@yaron2 , if not, why 4 new files are added under vendor folder (for example, vendor/github.com/Azure/azure-sdk-for-go/services/databricks/mgmt/2018-04-01/databricks/client.go)?

@yaron2
Copy link
Contributor Author

yaron2 commented Apr 30, 2018

@JunyiYi Sorry, I thought you meant something else. Yeah I added the vendor for the Databricks ARM support in the Go SDK.

@yaron2
Copy link
Contributor Author

yaron2 commented May 1, 2018

@JunyiYi Hi, I committed fixes. All yours

JunyiYi
JunyiYi previously requested changes May 3, 2018
@@ -534,6 +539,16 @@ func (c *ArmClient) registerContainerServicesClients(endpoint, subscriptionId st
c.kubernetesClustersClient = kubernetesClustersClient
}

func (c *ArmClient) registerDatabricksClients(endpoint, subscriptionId string, auth autorest.Authorizer, sender autorest.Sender) {
databricksWorkspacesClient := databricks.NewWorkspacesClientWithBaseURI(endpoint, subscriptionId)
setUserAgent(&databricksWorkspacesClient.Client)
Copy link

Choose a reason for hiding this comment

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

Is it possible to replace these lines of code with configureClient() like the example here.

ForceNew: true,
},

"location": {
Copy link

Choose a reason for hiding this comment

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

There is a locationSchema() function to declare the location field schema, you can reference the example here.

@JunyiYi
Copy link

JunyiYi commented May 3, 2018

@yaron2 , if you have updated vendor, there should be some changes made in vendor/vendor.json. Take an example for AKS here.

WodansSon
WodansSon previously approved these changes May 7, 2018
@yaron2
Copy link
Contributor Author

yaron2 commented May 17, 2018

@JunyiYi updated requested changes. should be good to go..

Copy link
Member

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hey @yaron2

Thanks for this PR / pushing those updates - I've taken a look through and left some comments inline, if we can get those sorted then we should be good to run the tests :)

Thanks!

}

// covers if the resource has been deleted outside of TF, but is still in the state
if utils.ResponseWasNotFound(resp.Response) {
Copy link
Member

Choose a reason for hiding this comment

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

this needs to be moved inside the if err != nil check above, given 404's are now treated as errors

Delete: resourceArmDatabricksWorkspaceDelete,

Schema: map[string]*schema.Schema{
"workspace_name": {
Copy link
Member

Choose a reason for hiding this comment

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

can we update this to just name to match the other resources?

Default: "standard",
ValidateFunc: validation.StringInSlice([]string{
"standard",
"premium",
Copy link
Member

Choose a reason for hiding this comment

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

are there constants in the SDK that we can use here? i.e. string(databricks.Standard),

"sku": {
Type: schema.TypeString,
Required: false,
Optional: true,
Copy link
Member

Choose a reason for hiding this comment

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

is there a reason to make this Optional + Defaulted, rather than Required? (e.g. does that match Azure?)

azurerm/resource_arm_databricks_workspace.go Outdated Show resolved Hide resolved

future, err := client.Delete(ctx, resGroup, name)
if err != nil {
return err
Copy link
Member

Choose a reason for hiding this comment

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

can we wrap this error message to make it clearer what failed here? e.g.

return fmt.Errorf("Error deleting Databricks Workspace %q (Resource Group %q): %+v", name, resGroup, err)

return nil
}

func workspaceStateRefreshFunc(ctx context.Context, client databricks.WorkspacesClient, resourceGroupName string, workspaceName string) resource.StateRefreshFunc {
Copy link
Member

Choose a reason for hiding this comment

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

(as above) I think we can remove this method?

azurerm/resource_arm_databricks_workspace.go Show resolved Hide resolved
@tombuildsstuff
Copy link
Member

One thing I forgot to comment in the PR - since this is touching a new Resource Provider, we also need to register this in the determineAzureResourceProvidersToRegister method - e.g. add the value Microsoft.Databricks (which is case sensitive)

Thanks!

@tombuildsstuff tombuildsstuff changed the title New resource: added azure databricks support New Resource: azurerm_databricks_workspace May 23, 2018
@bcornils
Copy link

I see we are blocked on this one @yaron2 or @JunyiYi are you good with the feedback here? Let me know if you need assistance to clear the blockers.

@JunyiYi
Copy link

JunyiYi commented Jun 1, 2018

@bcornils I agree with @tombuildsstuff 's comments and still waiting for the author to update the code. I think we'd better discuss some strategy (whether the reviewers should update the code for the author) when the original author hasn't been working on it after some specific time.

@katbyte
Copy link
Collaborator

katbyte commented Jun 6, 2018

Hello @yaron2,

Just wondering if your still working on this 🙂

@yaron2
Copy link
Contributor Author

yaron2 commented Jun 6, 2018 via email

@ranieuwe
Copy link
Contributor

@yaron2 what is the status on this? Do you need support?

@tombuildsstuff tombuildsstuff removed the request for review from metacpp July 16, 2018 12:02
@tombuildsstuff tombuildsstuff dismissed stale reviews from WodansSon and JunyiYi July 16, 2018 12:02

waiting on changes

@andrey-moor
Copy link
Contributor

@yaron2 do you need help with this?

@yaron2
Copy link
Contributor Author

yaron2 commented Aug 1, 2018

@andrey-moor Yeah, just moved roles and didn't get enough time to come back to this.
If you could remove the blockers that'd be great.

@andrey-moor
Copy link
Contributor

I've just run acceptance tests, and it seems fine. I will give it another look on Monday, but it seems we're unblocked here.

@tombuildsstuff @JunyiYi let me know if I've missed something.

@andrey-moor
Copy link
Contributor

andrey-moor commented Aug 8, 2018

@tombuildsstuff @JunyiYi any chance we can try to put it into the next release?

@tombuildsstuff tombuildsstuff added this to the 1.17.0 milestone Oct 1, 2018
Copy link
Member

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hey @yaron2 @andrey-moor

Thanks for pushing those changes - apologies for the delayed re-review here!

I've taken a look through and this mostly LGTM - since this needed a rebase I've gone ahead and done that (and made the changes requested in this PR so that we can ship this) - I hope you don't mind! I'm just kicking off the tests now - but we'll try to land this in 1.17 :)

Thanks!

azurerm/resource_arm_databricks_workspace.go Show resolved Hide resolved
azurerm/resource_arm_databricks_workspace_test.go Outdated Show resolved Hide resolved
azurerm/resource_arm_databricks_workspace_test.go Outdated Show resolved Hide resolved
vendor/vendor.json Show resolved Hide resolved
azurerm/resource_arm_databricks_workspace.go Show resolved Hide resolved
azurerm/resource_arm_databricks_workspace.go Outdated Show resolved Hide resolved
azurerm/resource_arm_databricks_workspace.go Outdated Show resolved Hide resolved
```
$ acctests azurerm TestAzureRMDatabrickWorkspaceName
=== RUN   TestAzureRMDatabrickWorkspaceName
--- PASS: TestAzureRMDatabrickWorkspaceName (0.00s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	1.270s
```
@tombuildsstuff
Copy link
Member

Tests pass:

$ acctests azurerm TestAccAzureRMDatabricksWorkspace_
=== RUN   TestAccAzureRMDatabricksWorkspace_basic
--- PASS: TestAccAzureRMDatabricksWorkspace_basic (667.42s)
=== RUN   TestAccAzureRMDatabricksWorkspace_withTags
--- PASS: TestAccAzureRMDatabricksWorkspace_withTags (725.72s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	1394.488s

@tombuildsstuff tombuildsstuff merged commit 3bb2097 into hashicorp:master Oct 1, 2018
tombuildsstuff added a commit that referenced this pull request Oct 1, 2018
@Lachlan-White
Copy link
Contributor

Hey @tombuildsstuff is there currently plans to have this updated to include the private virtual network options with databricks?

@Lachlan-White
Copy link
Contributor

or should i raise a feature request for this?

@tombuildsstuff
Copy link
Member

@a138076 not that I can see at this time - please open a new feature request for this :)

Thanks!

@hashicorp hashicorp locked as resolved and limited conversation to collaborators Mar 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants