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

azurerm_kubernetes_cluster: state not recorded in case of failure #895

Closed
jambt opened this issue Feb 27, 2018 · 2 comments
Closed

azurerm_kubernetes_cluster: state not recorded in case of failure #895

jambt opened this issue Feb 27, 2018 · 2 comments

Comments

@jambt
Copy link

jambt commented Feb 27, 2018

Hi,

I ran into a bug with the azurerm_kubernetes_cluster. The deployment state is not recorded properly in case of a failure.

Terraform Version

Terraform v0.11.3
azurerm (1.1.2)

Affected Resource(s)

Please list the resources as a list, for example:

  • azurerm_kubernetes_cluster

Terraform Configuration Files

resource "azurerm_kubernetes_cluster" "aks_container" {
  name = "${var.name}"
  location = "${var.location}"
  resource_group_name = "${var.resource_group}"
  kubernetes_version = "1.8.7"
  dns_prefix = "default"

  linux_profile {
    admin_username = "admin"
    ssh_key {
      key_data = "${file("~/.ssh/id_rsa.pub")}"
    }
  }

  agent_pool_profile {
    name = "agentpool"
    count = "${var.node_count}"
    vm_size = "${var.node_vm_size}"
    os_type = "Linux"
  }

  service_principal {
    client_id = "${var.client_id}"
    client_secret = "${var.client_secret}"
  }
}

Please note the usage of admin as admin_username. Thus, resource creation will fail as this default value is not valid.

Expected Behavior

The resource should be marked as created, but tainted.

Actual Behavior

The resource is not recorded as created.

Steps to Reproduce

  1. terraform apply
  2. Change admin_username to something different
  3. terraform apply will not work, since the SDK tries to update the username which is not possible.
@katbyte katbyte self-assigned this Feb 27, 2018
@katbyte katbyte added this to the 1.1.3 milestone Feb 28, 2018
@katbyte
Copy link
Collaborator

katbyte commented Feb 28, 2018

Hello @jambt,

Thank you for finding and reporting this bug.

You are correct, it appears that when admin_username is changed a new resource should be created. To fix this we will just have the property force a new resource when it changes.

To address the original issue, when the creation fails the resource enters into a failed state. As far as terraform is concerned the creation call failed and the resource was not created. As the resource is in a unknown state it is left up to the user to decide how to proceed.

@ghost
Copy link

ghost commented Mar 31, 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 Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants