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

Cannot set max_count and min_count to zero when autoscaling is false #6020

Merged
merged 3 commits into from
Mar 10, 2020
Merged

Cannot set max_count and min_count to zero when autoscaling is false #6020

merged 3 commits into from
Mar 10, 2020

Conversation

SvenHamers
Copy link
Contributor

when creating a some locic in the node pool it is not possible to set the value to 0

Example:
min_count = var.default_autoscaling_enabled ? var.default_min_node_count : 0
max_count = var.default_autoscaling_enabled ? var.default_min_node_count: 0

The output of the following says it should be possible

else if minCount > 0 || maxCount > 0 {
return fmt.Errorf("max_count and min_count must be set to 0 when enable_auto_scaling is set to false")

@ghost ghost added the size/XS label Mar 6, 2020
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @SvenHamers, instead of removing the validation can we just expand it to include 0? thanks!

@katbyte katbyte added this to the v2.1.0 milestone Mar 10, 2020
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks @SvenHamers! LGTM 👍

@katbyte katbyte merged commit a503b7b into hashicorp:master Mar 10, 2020
@ghost
Copy link

ghost commented Mar 11, 2020

This has been released in version 2.1.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.1.0"
}
# ... other configuration ...

@wagnst
Copy link
Contributor

wagnst commented Mar 12, 2020

Hi @katbyte @SvenHamers,

I think this might have broken something in the default_node_pool if this code is also used there (I am not sure). When I update an existing AKS cluster with the new provider 2.1.0 I get:

Error: Error updating Default Node Pool "lhg-weur-kfkadevmdw-aks" (Resource Group "lhg-weur-kfkadevmdwaks-rg"): containerservice.AgentPoolsClient#CreateOrUpdate: Invalid input: autorest/validation: validation failed: parameter=parameters.ManagedClusterAgentPoolProfileProperties.Count constraint=Null value=(*int32)(nil) details: value can not be null; required parameter

The code bascially is

...
default_node_pool {
    ...
    node_count          = 1
    enable_auto_scaling = false
    ...
}
...

I explicitly do NOT set min_count and max_count at all in that case (autoscaling = false). But when I check the state this is set (again), although if I remove the fields manually from it - maybe thats not relevant and is the default behavior anyways:

    default_node_pool {
        availability_zones    = [
            "1",
        ]
        enable_auto_scaling   = false
        enable_node_public_ip = false
        max_count             = 0
        max_pods              = 250
        min_count             = 0
        name                  = "default"
        node_count            = 1
        node_labels           = {}
        node_taints           = []
        os_disk_size_gb       = 128
        tags                  = {}
        type                  = "VirtualMachineScaleSets"
        vm_size               = "Standard_D2s_v3"
        vnet_subnet_id        = "/subscriptions/xxx/resourceGroups/yyy/providers/Microsoft.Network/virtualNetworks/zzz/subnets/aaa"
    }

Is this related to this one or is this a new issue? Thanks!

wagnst pushed a commit to wagnst/terraform-provider-azurerm that referenced this pull request Mar 12, 2020
If autoscaling is disabled on default_node_pool, those values are set to `0`
tombuildsstuff pushed a commit that referenced this pull request Mar 30, 2020
If autoscaling is disabled on default_node_pool, those values are set to `0`
tombuildsstuff pushed a commit that referenced this pull request Apr 1, 2020
If autoscaling is disabled on default_node_pool, those values are set to `0`
@ghost
Copy link

ghost commented Apr 9, 2020

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 Apr 9, 2020
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.

3 participants