Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
MattMencel committed Jul 8, 2019
2 parents 5abe3c8 + b895922 commit 230cd99
Show file tree
Hide file tree
Showing 47 changed files with 3,292 additions and 123 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ examples/**/test.tf
examples/**/test.tfvars
examples/**/terraform
examples/**/terraform.zip

#never upload the build to git
terraform-provider-azurerm
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
## 1.32.0 (Unreleased)

FEATURES:

* **New Resource:** `azurerm_api_management_backend` [GH-3676]

IMPROVEMENTS:

* `azurerm_app_service` - support for storage mounts [GH-3792]
* `azurerm_app_service` - support for user assigned identities [GH-3637]
* `azurerm_app_service_slot` - support for user assigned identities [GH-3637]
* `azurerm_batch_pool` - support for custom images with the `storage_image_reference` property [GH-3530]
* `azurerm_container_registry` - support for `network_rule_set` property [GH-3194]
* `azurerm_iothub` - support for the `file_upload` property [GH-3735]
* `azurerm_kubernetes_cluster` - support for auto scaling [GH-3361]
* `azurerm_security_center_contact` - the `phone` property is now optional [GH-3761]
* `azurerm_storage_account` - the `account_kind` property now supports `FileStorage` [GH-3750]
* `azurerm_storage_account` - support for the `enable_advanced_threat_protection` property [GH-3782]
* `azurerm_virtual_machine_scale_set` - prevent `public_ip_address_configuration` from being lost during update [GH-3767]


BUG FIXES:

* `azurerm_image` - prevent crash when using `data_disk` [GH-3797]
* `azurerm_role_assignment` - now correctly uses `scope` when looking up the role definition by name [GH-3768]

## 1.31.0 (June 28, 2019)
Expand Down
10 changes: 7 additions & 3 deletions azurerm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1039,10 +1039,14 @@ func (c *ArmClient) registerSecurityCenterClients(endpoint, subscriptionId strin
workspaceSettingsClient := securitySvc.NewWorkspaceSettingsClientWithBaseURI(endpoint, subscriptionId, ascLocation)
c.configureClient(&workspaceSettingsClient.Client, auth)

advancedThreatProtectionClient := securitySvc.NewAdvancedThreatProtectionClientWithBaseURI(endpoint, subscriptionId, ascLocation)
c.configureClient(&advancedThreatProtectionClient.Client, auth)

c.securityCenter = &securitycenter.Client{
ContactsClient: contactsClient,
PricingClient: pricingsClient,
WorkspaceClient: workspaceSettingsClient,
ContactsClient: contactsClient,
PricingClient: pricingsClient,
WorkspaceClient: workspaceSettingsClient,
AdvancedThreatProtectionClient: advancedThreatProtectionClient,
}
}

Expand Down
37 changes: 37 additions & 0 deletions azurerm/data_source_kubernetes_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,29 @@ func dataSourceArmKubernetesCluster() *schema.Resource {
Computed: true,
},

"max_count": {
Type: schema.TypeInt,
Computed: true,
},

"min_count": {
Type: schema.TypeInt,
Computed: true,
},

"enable_auto_scaling": {
Type: schema.TypeBool,
Computed: true,
},

"availability_zones": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},

// TODO: remove this in a future version
"dns_prefix": {
Type: schema.TypeString,
Expand Down Expand Up @@ -565,6 +588,20 @@ func flattenKubernetesClusterDataSourceAgentPoolProfiles(input *[]containerservi
agentPoolProfile["count"] = int(*profile.Count)
}

if profile.MinCount != nil {
agentPoolProfile["min_count"] = int(*profile.MinCount)
}

if profile.MaxCount != nil {
agentPoolProfile["max_count"] = int(*profile.MaxCount)
}

if profile.EnableAutoScaling != nil {
agentPoolProfile["enable_auto_scaling"] = *profile.EnableAutoScaling
}

agentPoolProfile["availability_zones"] = utils.FlattenStringSlice(profile.AvailabilityZones)

if profile.Name != nil {
agentPoolProfile["name"] = *profile.Name
}
Expand Down
82 changes: 82 additions & 0 deletions azurerm/data_source_kubernetes_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,64 @@ func TestAccDataSourceAzureRMKubernetesCluster_addOnProfileRouting(t *testing.T)
})
}

func TestAccDataSourceAzureRMKubernetesCluster_autoscalingNoAvailabilityZones(t *testing.T) {
dataSourceName := "data.azurerm_kubernetes_cluster.test"
ri := tf.AccRandTimeInt()
clientId := os.Getenv("ARM_CLIENT_ID")
clientSecret := os.Getenv("ARM_CLIENT_SECRET")

config := testAccDataSourceAzureRMKubernetesCluster_autoScalingNoAvailabilityZones(ri, clientId, clientSecret, testLocation())

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMKubernetesClusterDestroy,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMKubernetesClusterExists(dataSourceName),
resource.TestCheckResourceAttr(dataSourceName, "agent_pool_profile.0.min_count", "1"),
resource.TestCheckResourceAttr(dataSourceName, "agent_pool_profile.0.max_count", "2"),
resource.TestCheckResourceAttr(dataSourceName, "agent_pool_profile.0.type", "VirtualMachineScaleSets"),
resource.TestCheckResourceAttr(dataSourceName, "agent_pool_profile.0.enable_auto_scaling", "true"),
resource.TestCheckNoResourceAttr(dataSourceName, "agent_pool_profile.0.availability_zones"),
),
},
},
})
}

func TestAccDataSourceAzureRMKubernetesCluster_autoscalingWithAvailabilityZones(t *testing.T) {
dataSourceName := "data.azurerm_kubernetes_cluster.test"
ri := tf.AccRandTimeInt()
clientId := os.Getenv("ARM_CLIENT_ID")
clientSecret := os.Getenv("ARM_CLIENT_SECRET")

config := testAccDataSourceAzureRMKubernetesCluster_autoScalingWithAvailabilityZones(ri, clientId, clientSecret, testLocation())

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMKubernetesClusterDestroy,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMKubernetesClusterExists(dataSourceName),
resource.TestCheckResourceAttr(dataSourceName, "agent_pool_profile.0.min_count", "1"),
resource.TestCheckResourceAttr(dataSourceName, "agent_pool_profile.0.max_count", "2"),
resource.TestCheckResourceAttr(dataSourceName, "agent_pool_profile.0.type", "VirtualMachineScaleSets"),
resource.TestCheckResourceAttr(dataSourceName, "agent_pool_profile.0.enable_auto_scaling", "true"),
resource.TestCheckResourceAttr(dataSourceName, "agent_pool_profile.0.availability_zones.#", "2"),
resource.TestCheckResourceAttr(dataSourceName, "agent_pool_profile.0.availability_zones.0", "1"),
resource.TestCheckResourceAttr(dataSourceName, "agent_pool_profile.0.availability_zones.1", "2"),
),
},
},
})
}

func testAccDataSourceAzureRMKubernetesCluster_basic(rInt int, clientId string, clientSecret string, location string) string {
r := testAccAzureRMKubernetesCluster_basic(rInt, clientId, clientSecret, location)
return fmt.Sprintf(`
Expand Down Expand Up @@ -584,3 +642,27 @@ data "azurerm_kubernetes_cluster" "test" {
}
`, r)
}

func testAccDataSourceAzureRMKubernetesCluster_autoScalingNoAvailabilityZones(rInt int, clientId string, clientSecret string, location string) string {
r := testAccAzureRMKubernetesCluster_autoscaleNoAvailabilityZones(rInt, clientId, clientSecret, location)
return fmt.Sprintf(`
%s
data "azurerm_kubernetes_cluster" "test" {
name = "${azurerm_kubernetes_cluster.test.name}"
resource_group_name = "${azurerm_kubernetes_cluster.test.resource_group_name}"
}
`, r)
}

func testAccDataSourceAzureRMKubernetesCluster_autoScalingWithAvailabilityZones(rInt int, clientId string, clientSecret string, location string) string {
r := testAccAzureRMKubernetesCluster_autoscaleWithAvailabilityZones(rInt, clientId, clientSecret, location)
return fmt.Sprintf(`
%s
data "azurerm_kubernetes_cluster" "test" {
name = "${azurerm_kubernetes_cluster.test.name}"
resource_group_name = "${azurerm_kubernetes_cluster.test.resource_group_name}"
}
`, r)
}
Loading

0 comments on commit 230cd99

Please sign in to comment.