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

[WIP] - Add HDInsight provider #814

Closed

Conversation

jeanfrancoislelezec
Copy link

@jeanfrancoislelezec jeanfrancoislelezec commented Feb 8, 2018

Please find a first commit HDIsnsight
For the moment create operation isn't working due to an issue on configuration property. On the go api the field "Configuration'" is type of *map[string]interface{} and on azure side ( rest api) the structure is

configurations": {
"gateway": {
"restAuthCredential.isEnabled": true,
"restAuthCredential.username": "http-user",
"restAuthCredential.password": "password"
},

            "core-site": {  
                "fs.defaultFS": "wasb://[email protected]",  
                "fs.azure.account.key.storageaccount.blob.core.windows.net": storage-account-key"  
            }  

I've tried to deal with json structure but desrialization occured on azure side
And I can not add hdinsinght go api properly in the project

Thanks for your help

#37

Copy link
Contributor

@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 @jeanfrancoislelezec

Thanks for this PR - I've taken a look through and left some comments in-line, but this is off to a good start :)

Most of the comments I've made are around matching the design of the Azure API to both ease migration and to be able to handle future changes; also since this resource is quite large, I’ve made a few suggestions to focus on just the required attributes for the time being - we can add the optional attributes in the future

Thanks!

"azurerm_snapshot": dataSourceArmSnapshot(),
"azurerm_subnet": dataSourceArmSubnet(),
"azurerm_subscription": dataSourceArmSubscription(),
"azurerm_virtual_network": dataSourceArmVirtualNetwork(),
"azurerm_virtual_network_gateway": dataSourceArmVirtualNetworkGateway(),
Copy link
Contributor

Choose a reason for hiding this comment

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

this looks like a merge conflict - can we add these back in?


return &client, nil
}

func (c *ArmClient) registerHDIInsightClients(endpoint, subscriptionID string, auth autorest.Authorizer, sender autorest.Sender) {
Copy link
Contributor

Choose a reason for hiding this comment

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

minor - can we update the method name to registerHDInsightsClients to match the other clients?

Also - since HDInsights is in a new Resource Provider (e.g. Microsoft.Compute/Microsoft.HDInsight) - we need to add Microsoft.HDInsight to the list of Resource Providers which gets automatically gets registered (note: this is case-sensitive). This means that Terraform users don't have to navigate to the Portal and manually activate the HDInsights Resource Provider (or, attempt to deploy an HDInsights Cluster via the Portal) - unless they opt-out of this behaviour.

hde.Authorizer = auth
hde.Sender = sender
hde.SkipResourceProviderRegistration = c.skipProviderRegistration
c.hdiExtentionClient = hde
Copy link
Contributor

Choose a reason for hiding this comment

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

since we're not using the extensions client at this time - could we remove the registration (and the field?)

hda.Authorizer = auth
hda.Sender = sender
hda.SkipResourceProviderRegistration = c.skipProviderRegistration
c.hdiApplicationClient = hda
Copy link
Contributor

Choose a reason for hiding this comment

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

since we're not using the applications client at this time - could we remove the registration (and the field?)

hdc.Authorizer = auth
hdc.Sender = sender
hdc.SkipResourceProviderRegistration = c.skipProviderRegistration
c.hdiClusterClient = hdc
Copy link
Contributor

Choose a reason for hiding this comment

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

minor can we update this to the newer format:

clustersClient := hdinsight.NewClustersClientWithBaseURI(endpoint, subscriptionID)
c.configureClient(&clustersClient.Client, auth)
c.hdiClusterClient = clustersClient

},
},
},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

can we split the three of these out into their own sub-list to match the Azure API? e.g.

"os_profile": {
  Type:     schema.TypeSet,
  Optional: true,
  MaxItems: 1,
  Elem: &schema.Resource{
    Schema: map[string]*schema.Schema{
      "username": {
        Type:     schema.TypeString,
        Required: true,
      },
      "password": {
        Type:     schema.TypeString,
        Optional: true,
        Sensitive: true,
      },
      "ssh_public_key": {
        Type:     schema.TypeString,
        Optional: true,
      },
    },
  },
},

"subnet_name": {
Type: schema.TypeString,
Required: true,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

can we split these two out into their own network_profile block to match the Azure API? e.g.

"network_profile": {
  Type:     schema.TypeList,
  Optional: true,
  MaxItems: 1,
  Elem: &schema.Resource{
    Schema: map[string]*schema.Schema{
      "virtual_network_id": {
        Type:     schema.TypeString,
        Required: true,
      },
      "subnet_name": {
        Type:     schema.TypeString,
        Required: true,
      },
    },
  },
},

Type: schema.TypeInt,
Optional: true,
},
"scripts": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Given Custom Scripts are optional (and this is a large resource) - I think it might be worth removing these from the initial PR. We can add support for Custom Scripts back in a subsequent PR - however I think that they're going to require a few tests, would be easier to review separately - what do you think?

Choose a reason for hiding this comment

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

Yes we could move Custom Scripts on next PR

}

/*
func resourceArmHDInsightUpdate(d *schema.ResourceData, meta interface{}) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

it looks like it's possible to update the size/count of the machines; so can we add this back in at some point?

// return fmt.Errorf()
}
}
// not implemented in azure-sdk
Copy link
Contributor

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

Yes
o Azure Datalake store is configure throught configuration section with core-site and cluster_identity properties

@jeanfrancoislelezec
Copy link
Author

You can close this pull request in favor of PR #924 that is most advanced

@jjcollinge
Copy link
Contributor

@jeanfrancoislelezec sorry I didn't see your PR before I made mine! I'm not sure mine is more 'advanced' - it's certainly not as clean as yours. I'll review yours next week and see if I can blend the 2 and we can combine our efforts. Thanks.

@jeanfrancoislelezec
Copy link
Author

@jjcollinge definitely your version is more advanced. I've still an issue on read method :(; I can give a hand on yours :)

@tombuildsstuff tombuildsstuff modified the milestones: Future, Being Sorted Oct 25, 2018
@ghost
Copy link

ghost commented Mar 6, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 6, 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.

4 participants