Skip to content

Commit

Permalink
azurerm_hdinsight_* - support for tls_min_version (#6440)
Browse files Browse the repository at this point in the history
Fixes: #6372
  • Loading branch information
kosinsky authored Apr 13, 2020
1 parent 364f816 commit cb8fa93
Show file tree
Hide file tree
Showing 27 changed files with 761 additions and 24 deletions.
13 changes: 13 additions & 0 deletions azurerm/helpers/azure/hdinsight.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ func SchemaHDInsightTier() *schema.Schema {
}
}

func SchemaHDInsightTls() *schema.Schema {
return &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
"1.0",
"1.1",
"1.2",
}, false),
}
}

func SchemaHDInsightClusterVersion() *schema.Schema {
return &schema.Schema{
Type: schema.TypeString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ func dataSourceArmHDInsightSparkCluster() *schema.Resource {
Computed: true,
},

"tls_min_version": {
Type: schema.TypeString,
Computed: true,
},

"gateway": {
Type: schema.TypeList,
Computed: true,
Expand Down Expand Up @@ -130,6 +135,7 @@ func dataSourceArmHDInsightClusterRead(d *schema.ResourceData, meta interface{})
if props := resp.Properties; props != nil {
d.Set("cluster_version", props.ClusterVersion)
d.Set("tier", string(props.Tier))
d.Set("tls_min_version", props.MinSupportedTLSVersion)

if def := props.ClusterDefinition; def != nil {
d.Set("component_versions", flattenHDInsightsDataSourceComponentVersions(def.ComponentVersion))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ func resourceArmHDInsightHadoopCluster() *schema.Resource {

"tier": azure.SchemaHDInsightTier(),

"tls_min_version": azure.SchemaHDInsightTls(),

"component_version": {
Type: schema.TypeList,
Required: true,
Expand Down Expand Up @@ -178,6 +180,7 @@ func resourceArmHDInsightHadoopClusterCreate(d *schema.ResourceData, meta interf
clusterVersion := d.Get("cluster_version").(string)
t := d.Get("tags").(map[string]interface{})
tier := hdinsight.Tier(d.Get("tier").(string))
tls := d.Get("tls_min_version").(string)

componentVersionsRaw := d.Get("component_version").([]interface{})
componentVersions := expandHDInsightHadoopComponentVersion(componentVersionsRaw)
Expand Down Expand Up @@ -219,9 +222,10 @@ func resourceArmHDInsightHadoopClusterCreate(d *schema.ResourceData, meta interf
params := hdinsight.ClusterCreateParametersExtended{
Location: utils.String(location),
Properties: &hdinsight.ClusterCreateProperties{
Tier: tier,
OsType: hdinsight.Linux,
ClusterVersion: utils.String(clusterVersion),
Tier: tier,
OsType: hdinsight.Linux,
ClusterVersion: utils.String(clusterVersion),
MinSupportedTLSVersion: utils.String(tls),
ClusterDefinition: &hdinsight.ClusterDefinition{
Kind: utils.String("Hadoop"),
ComponentVersion: componentVersions,
Expand Down Expand Up @@ -326,6 +330,7 @@ func resourceArmHDInsightHadoopClusterRead(d *schema.ResourceData, meta interfac
if props := resp.Properties; props != nil {
d.Set("cluster_version", props.ClusterVersion)
d.Set("tier", string(props.Tier))
d.Set("tls_min_version", props.MinSupportedTLSVersion)

if def := props.ClusterDefinition; def != nil {
if err := d.Set("component_version", flattenHDInsightHadoopComponentVersion(def.ComponentVersion)); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ func resourceArmHDInsightHBaseCluster() *schema.Resource {

"tier": azure.SchemaHDInsightTier(),

"tls_min_version": azure.SchemaHDInsightTls(),

"component_version": {
Type: schema.TypeList,
Required: true,
Expand Down Expand Up @@ -131,6 +133,7 @@ func resourceArmHDInsightHBaseClusterCreate(d *schema.ResourceData, meta interfa
clusterVersion := d.Get("cluster_version").(string)
t := d.Get("tags").(map[string]interface{})
tier := hdinsight.Tier(d.Get("tier").(string))
tls := d.Get("tls_min_version").(string)

componentVersionsRaw := d.Get("component_version").([]interface{})
componentVersions := expandHDInsightHBaseComponentVersion(componentVersionsRaw)
Expand Down Expand Up @@ -172,9 +175,10 @@ func resourceArmHDInsightHBaseClusterCreate(d *schema.ResourceData, meta interfa
params := hdinsight.ClusterCreateParametersExtended{
Location: utils.String(location),
Properties: &hdinsight.ClusterCreateProperties{
Tier: tier,
OsType: hdinsight.Linux,
ClusterVersion: utils.String(clusterVersion),
Tier: tier,
OsType: hdinsight.Linux,
ClusterVersion: utils.String(clusterVersion),
MinSupportedTLSVersion: utils.String(tls),
ClusterDefinition: &hdinsight.ClusterDefinition{
Kind: utils.String("HBase"),
ComponentVersion: componentVersions,
Expand Down Expand Up @@ -253,6 +257,7 @@ func resourceArmHDInsightHBaseClusterRead(d *schema.ResourceData, meta interface
if props := resp.Properties; props != nil {
d.Set("cluster_version", props.ClusterVersion)
d.Set("tier", string(props.Tier))
d.Set("tls_min_version", props.MinSupportedTLSVersion)

if def := props.ClusterDefinition; def != nil {
if err := d.Set("component_version", flattenHDInsightHBaseComponentVersion(def.ComponentVersion)); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ func resourceArmHDInsightInteractiveQueryCluster() *schema.Resource {

"tier": azure.SchemaHDInsightTier(),

"tls_min_version": azure.SchemaHDInsightTls(),

"component_version": {
Type: schema.TypeList,
Required: true,
Expand Down Expand Up @@ -131,6 +133,7 @@ func resourceArmHDInsightInteractiveQueryClusterCreate(d *schema.ResourceData, m
clusterVersion := d.Get("cluster_version").(string)
t := d.Get("tags").(map[string]interface{})
tier := hdinsight.Tier(d.Get("tier").(string))
tls := d.Get("tls_min_version").(string)

componentVersionsRaw := d.Get("component_version").([]interface{})
componentVersions := expandHDInsightInteractiveQueryComponentVersion(componentVersionsRaw)
Expand Down Expand Up @@ -172,9 +175,10 @@ func resourceArmHDInsightInteractiveQueryClusterCreate(d *schema.ResourceData, m
params := hdinsight.ClusterCreateParametersExtended{
Location: utils.String(location),
Properties: &hdinsight.ClusterCreateProperties{
Tier: tier,
OsType: hdinsight.Linux,
ClusterVersion: utils.String(clusterVersion),
Tier: tier,
OsType: hdinsight.Linux,
ClusterVersion: utils.String(clusterVersion),
MinSupportedTLSVersion: utils.String(tls),
ClusterDefinition: &hdinsight.ClusterDefinition{
Kind: utils.String("INTERACTIVEHIVE"),
ComponentVersion: componentVersions,
Expand Down Expand Up @@ -253,6 +257,7 @@ func resourceArmHDInsightInteractiveQueryClusterRead(d *schema.ResourceData, met
if props := resp.Properties; props != nil {
d.Set("cluster_version", props.ClusterVersion)
d.Set("tier", string(props.Tier))
d.Set("tls_min_version", props.MinSupportedTLSVersion)

if def := props.ClusterDefinition; def != nil {
if err := d.Set("component_version", flattenHDInsightInteractiveQueryComponentVersion(def.ComponentVersion)); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ func resourceArmHDInsightKafkaCluster() *schema.Resource {

"tier": azure.SchemaHDInsightTier(),

"tls_min_version": azure.SchemaHDInsightTls(),

"component_version": {
Type: schema.TypeList,
Required: true,
Expand Down Expand Up @@ -132,6 +134,7 @@ func resourceArmHDInsightKafkaClusterCreate(d *schema.ResourceData, meta interfa
clusterVersion := d.Get("cluster_version").(string)
t := d.Get("tags").(map[string]interface{})
tier := hdinsight.Tier(d.Get("tier").(string))
tls := d.Get("tls_min_version").(string)

componentVersionsRaw := d.Get("component_version").([]interface{})
componentVersions := expandHDInsightKafkaComponentVersion(componentVersionsRaw)
Expand Down Expand Up @@ -173,9 +176,10 @@ func resourceArmHDInsightKafkaClusterCreate(d *schema.ResourceData, meta interfa
params := hdinsight.ClusterCreateParametersExtended{
Location: utils.String(location),
Properties: &hdinsight.ClusterCreateProperties{
Tier: tier,
OsType: hdinsight.Linux,
ClusterVersion: utils.String(clusterVersion),
Tier: tier,
OsType: hdinsight.Linux,
ClusterVersion: utils.String(clusterVersion),
MinSupportedTLSVersion: utils.String(tls),
ClusterDefinition: &hdinsight.ClusterDefinition{
Kind: utils.String("Kafka"),
ComponentVersion: componentVersions,
Expand Down Expand Up @@ -254,6 +258,7 @@ func resourceArmHDInsightKafkaClusterRead(d *schema.ResourceData, meta interface
if props := resp.Properties; props != nil {
d.Set("cluster_version", props.ClusterVersion)
d.Set("tier", string(props.Tier))
d.Set("tls_min_version", props.MinSupportedTLSVersion)

if def := props.ClusterDefinition; def != nil {
if err := d.Set("component_version", flattenHDInsightKafkaComponentVersion(def.ComponentVersion)); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ func resourceArmHDInsightMLServicesCluster() *schema.Resource {

"tier": azure.SchemaHDInsightTier(),

"tls_min_version": azure.SchemaHDInsightTls(),

"gateway": azure.SchemaHDInsightsGateway(),

"rstudio": {
Expand Down Expand Up @@ -148,6 +150,7 @@ func resourceArmHDInsightMLServicesClusterCreate(d *schema.ResourceData, meta in
clusterVersion := d.Get("cluster_version").(string)
t := d.Get("tags").(map[string]interface{})
tier := hdinsight.Tier(d.Get("tier").(string))
tls := d.Get("tls_min_version").(string)

gatewayRaw := d.Get("gateway").([]interface{})
rStudio := d.Get("rstudio").(bool)
Expand Down Expand Up @@ -187,9 +190,10 @@ func resourceArmHDInsightMLServicesClusterCreate(d *schema.ResourceData, meta in
params := hdinsight.ClusterCreateParametersExtended{
Location: utils.String(location),
Properties: &hdinsight.ClusterCreateProperties{
Tier: tier,
OsType: hdinsight.Linux,
ClusterVersion: utils.String(clusterVersion),
Tier: tier,
OsType: hdinsight.Linux,
ClusterVersion: utils.String(clusterVersion),
MinSupportedTLSVersion: utils.String(tls),
ClusterDefinition: &hdinsight.ClusterDefinition{
Kind: utils.String("MLServices"),
Configurations: gateway,
Expand Down Expand Up @@ -272,6 +276,7 @@ func resourceArmHDInsightMLServicesClusterRead(d *schema.ResourceData, meta inte
if props := resp.Properties; props != nil {
d.Set("cluster_version", props.ClusterVersion)
d.Set("tier", string(props.Tier))
d.Set("tls_min_version", props.MinSupportedTLSVersion)

if def := props.ClusterDefinition; def != nil {
if err := d.Set("gateway", azure.FlattenHDInsightsConfigurations(configuration.Value)); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ func resourceArmHDInsightRServerCluster() *schema.Resource {

"tier": azure.SchemaHDInsightTier(),

"tls_min_version": azure.SchemaHDInsightTls(),

"gateway": azure.SchemaHDInsightsGateway(),

"rstudio": {
Expand Down Expand Up @@ -148,6 +150,7 @@ func resourceArmHDInsightRServerClusterCreate(d *schema.ResourceData, meta inter
clusterVersion := d.Get("cluster_version").(string)
t := d.Get("tags").(map[string]interface{})
tier := hdinsight.Tier(d.Get("tier").(string))
tls := d.Get("tls_min_version").(string)

gatewayRaw := d.Get("gateway").([]interface{})
rStudio := d.Get("rstudio").(bool)
Expand Down Expand Up @@ -187,9 +190,10 @@ func resourceArmHDInsightRServerClusterCreate(d *schema.ResourceData, meta inter
params := hdinsight.ClusterCreateParametersExtended{
Location: utils.String(location),
Properties: &hdinsight.ClusterCreateProperties{
Tier: tier,
OsType: hdinsight.Linux,
ClusterVersion: utils.String(clusterVersion),
Tier: tier,
OsType: hdinsight.Linux,
ClusterVersion: utils.String(clusterVersion),
MinSupportedTLSVersion: utils.String(tls),
ClusterDefinition: &hdinsight.ClusterDefinition{
Kind: utils.String("RServer"),
Configurations: gateway,
Expand Down Expand Up @@ -272,6 +276,7 @@ func resourceArmHDInsightRServerClusterRead(d *schema.ResourceData, meta interfa
if props := resp.Properties; props != nil {
d.Set("cluster_version", props.ClusterVersion)
d.Set("tier", string(props.Tier))
d.Set("tls_min_version", props.MinSupportedTLSVersion)

if def := props.ClusterDefinition; def != nil {
if err := d.Set("gateway", azure.FlattenHDInsightsConfigurations(configuration.Value)); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ func resourceArmHDInsightSparkCluster() *schema.Resource {

"tier": azure.SchemaHDInsightTier(),

"tls_min_version": azure.SchemaHDInsightTls(),

"component_version": {
Type: schema.TypeList,
Required: true,
Expand Down Expand Up @@ -131,6 +133,7 @@ func resourceArmHDInsightSparkClusterCreate(d *schema.ResourceData, meta interfa
clusterVersion := d.Get("cluster_version").(string)
t := d.Get("tags").(map[string]interface{})
tier := hdinsight.Tier(d.Get("tier").(string))
tls := d.Get("tls_min_version").(string)

componentVersionsRaw := d.Get("component_version").([]interface{})
componentVersions := expandHDInsightSparkComponentVersion(componentVersionsRaw)
Expand Down Expand Up @@ -172,9 +175,10 @@ func resourceArmHDInsightSparkClusterCreate(d *schema.ResourceData, meta interfa
params := hdinsight.ClusterCreateParametersExtended{
Location: utils.String(location),
Properties: &hdinsight.ClusterCreateProperties{
Tier: tier,
OsType: hdinsight.Linux,
ClusterVersion: utils.String(clusterVersion),
Tier: tier,
OsType: hdinsight.Linux,
ClusterVersion: utils.String(clusterVersion),
MinSupportedTLSVersion: utils.String(tls),
ClusterDefinition: &hdinsight.ClusterDefinition{
Kind: utils.String("Spark"),
ComponentVersion: componentVersions,
Expand Down Expand Up @@ -253,6 +257,7 @@ func resourceArmHDInsightSparkClusterRead(d *schema.ResourceData, meta interface
if props := resp.Properties; props != nil {
d.Set("cluster_version", props.ClusterVersion)
d.Set("tier", string(props.Tier))
d.Set("tls_min_version", props.MinSupportedTLSVersion)

if def := props.ClusterDefinition; def != nil {
if err := d.Set("component_version", flattenHDInsightSparkComponentVersion(def.ComponentVersion)); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ func resourceArmHDInsightStormCluster() *schema.Resource {

"tier": azure.SchemaHDInsightTier(),

"tls_min_version": azure.SchemaHDInsightTls(),

"component_version": {
Type: schema.TypeList,
Required: true,
Expand Down Expand Up @@ -130,6 +132,7 @@ func resourceArmHDInsightStormClusterCreate(d *schema.ResourceData, meta interfa
clusterVersion := d.Get("cluster_version").(string)
t := d.Get("tags").(map[string]interface{})
tier := hdinsight.Tier(d.Get("tier").(string))
tls := d.Get("tls_min_version").(string)

componentVersionsRaw := d.Get("component_version").([]interface{})
componentVersions := expandHDInsightStormComponentVersion(componentVersionsRaw)
Expand Down Expand Up @@ -170,9 +173,10 @@ func resourceArmHDInsightStormClusterCreate(d *schema.ResourceData, meta interfa
params := hdinsight.ClusterCreateParametersExtended{
Location: utils.String(location),
Properties: &hdinsight.ClusterCreateProperties{
Tier: tier,
OsType: hdinsight.Linux,
ClusterVersion: utils.String(clusterVersion),
Tier: tier,
OsType: hdinsight.Linux,
ClusterVersion: utils.String(clusterVersion),
MinSupportedTLSVersion: utils.String(tls),
ClusterDefinition: &hdinsight.ClusterDefinition{
Kind: utils.String("Storm"),
ComponentVersion: componentVersions,
Expand Down Expand Up @@ -251,6 +255,7 @@ func resourceArmHDInsightStormClusterRead(d *schema.ResourceData, meta interface
if props := resp.Properties; props != nil {
d.Set("cluster_version", props.ClusterVersion)
d.Set("tier", string(props.Tier))
d.Set("tls_min_version", props.MinSupportedTLSVersion)

if def := props.ClusterDefinition; def != nil {
if err := d.Set("component_version", flattenHDInsightStormComponentVersion(def.ComponentVersion)); err != nil {
Expand Down
Loading

0 comments on commit cb8fa93

Please sign in to comment.