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

terraform crashes when create gke #4573

Closed
autumnw opened this issue Sep 29, 2019 · 2 comments
Closed

terraform crashes when create gke #4573

autumnw opened this issue Sep 29, 2019 · 2 comments

Comments

@autumnw
Copy link

autumnw commented Sep 29, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
  • If an issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to "hashibot", a community member has claimed the issue already.

Terraform Version

Terraform v0.12.8

Affected Resource(s)

  • google_container_cluster.gke_cluster:

Terraform Configuration Files

resource "google_container_cluster" "gke_cluster" {
  name               = var.cluster_name
  location           = var.zones[0]

  #remove_default_node_pool = true
  initial_node_count = 1

  network            = var.host_network
  subnetwork         = var.host_subnet
  cluster_ipv4_cidr  = var.pods_cidr
  project            = var.project

  node_locations = [
    var.zones[1],
    var.zones[2],
  ]

  master_authorized_networks_config {
    dynamic "cidr_blocks" {
      for_each = var.cluster_master_authorized_cidr_blocks
      content {
        cidr_block   = cidr_blocks.value.ip_range
        display_name =  cidr_blocks.value.display_name
      }
    }
  }

  master_auth {
    # Setting an empty username and password explicitly disables basic auth
    username = ""
    password = ""
  }

  node_config {
    oauth_scopes = [
      "https://www.googleapis.com/auth/compute",
      "https://www.googleapis.com/auth/devstorage.read_write",
      "https://www.googleapis.com/auth/logging.write",
      "https://www.googleapis.com/auth/monitoring",
      "https://www.googleapis.com/auth/trace.append",
    ]

    labels = {
      app     = "wildfire"
      env     = var.environment
      cluster = var.cluster_name
    }

    #tags = var.tags
  }

  private_cluster_config {
    enable_private_nodes    = "true"
    enable_private_endpoint = "true"
    master_ipv4_cidr_block  = var.cluster_master_ipv4_cidr_block
  }

  ip_allocation_policy {
    services_ipv4_cidr_block = var.services_cidr
    cluster_ipv4_cidr_block  = var.pods_cidr
  }

  monitoring_service = "monitoring.googleapis.com/kubernetes"
  logging_service = "logging.googleapis.com/kubernetes"
}

resource "google_container_node_pool" "node_pool" {
  count      = length(var.node_pools)
  name       = var.node_pools[count.index]["name"]
  cluster    = google_container_cluster.gke_cluster.name

  initial_node_count = lookup(
    var.node_pools[count.index],
    "initial_node_count",
    lookup(var.node_pools[count.index], "min_count", 1),
  )

  autoscaling {
    min_node_count = lookup(var.node_pools[count.index], "min_count", 1)
    max_node_count = lookup(var.node_pools[count.index], "max_count", 100)
  }

  management {
    auto_repair  = lookup(var.node_pools[count.index], "auto_repair", true)
    auto_upgrade = lookup(var.node_pools[count.index], "auto_upgrade", true)
  }

  node_config {
    disk_size_gb =  var.node_pools[count.index]["disk_size_gb"]
    machine_type =  var.node_pools[count.index]["machine_type"]

    oauth_scopes = [
      "https://www.googleapis.com/auth/compute",
      "https://www.googleapis.com/auth/devstorage.read_only",
      "https://www.googleapis.com/auth/logging.write",
      "https://www.googleapis.com/auth/monitoring",
    ]

    labels =  var.node_pools[count.index]["labels"]

    tags = var.node_pools[count.index]["tags"]
  }
}


# The following outputs allow authentication and connectivity to the GKE Cluster.
output "client_certificate" {
  value = google_container_cluster.gke_cluster.master_auth.0.client_certificate
}

output "client_key" {
  value = google_container_cluster.gke_cluster.master_auth.0.client_key
}

output "cluster_ca_certificate" {
  value = google_container_cluster.gke_cluster.master_auth.0.cluster_ca_certificate
}

output "cluster_name" {
  value = google_container_cluster.gke_cluster.name
}

Debug Output

Panic Output

module.myk8scluster.google_container_cluster.gke_cluster: Still creating... [5m20s elapsed]
module.myk8scluster.google_container_cluster.gke_cluster: Still creating... [5m30s elapsed]
module.myk8scluster.google_container_cluster.gke_cluster: Still creating... [5m40s elapsed]
module.myk8scluster.google_container_cluster.gke_cluster: Still creating... [5m50s elapsed]

Error: rpc error: code = Unavailable desc = transport is closing

panic: runtime error: invalid memory address or nil pointer dereference
2019-09-28T17:45:45.377-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x239f91a]
2019-09-28T17:45:45.377-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4:
2019-09-28T17:45:45.377-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: goroutine 65 [running]:
2019-09-28T17:45:45.377-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: github.com/terraform-providers/terraform-provider-google/google.flattenMaintenancePolicy(...)
2019-09-28T17:45:45.377-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-google/google/resource_container_cluster.go:1941
2019-09-28T17:45:45.377-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: github.com/terraform-providers/terraform-provider-google/google.resourceContainerClusterRead(0xc0002bfce0, 0x27f03a0, 0xc00013d200, 0x262ff60, 0x3f693e0)
2019-09-28T17:45:45.377-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-google/google/resource_container_cluster.go:964 +0x1f9a
2019-09-28T17:45:45.377-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: github.com/terraform-providers/terraform-provider-google/google.resourceContainerClusterCreate(0xc0002bfce0, 0x27f03a0, 0xc00013d200, 0x0, 0x0)
2019-09-28T17:45:45.377-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-google/google/resource_container_cluster.go:914 +0x1994
2019-09-28T17:45:45.377-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: github.com/terraform-providers/terraform-provider-google/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc000225d80, 0xc0007c8820, 0xc0006e0200, 0x27f03a0, 0xc00013d200, 0x2760201, 0xc0001499c8, 0xc000725ec0)
2019-09-28T17:45:45.377-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-google/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:286 +0x363
2019-09-28T17:45:45.377-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: github.com/terraform-providers/terraform-provider-google/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc00026e280, 0xc0005e79b8, 0xc0007c8820, 0xc0006e0200, 0xc000149240, 0xc0000b3218, 0x2763d80)
2019-09-28T17:45:45.377-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-google/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:285 +0x9c
2019-09-28T17:45:45.378-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: github.com/terraform-providers/terraform-provider-google/vendor/github.com/hashicorp/terraform/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc0000b2af8, 0x2e09540, 0xc0007c31d0, 0xc00015c600, 0xc0000b2af8, 0xc0007c3140, 0x27e4c40)
2019-09-28T17:45:45.378-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-google/vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provider.go:851 +0x87a
2019-09-28T17:45:45.378-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: github.com/terraform-providers/terraform-provider-google/vendor/github.com/hashicorp/terraform/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x2b179e0, 0xc0000b2af8, 0x2e09540, 0xc0007c31d0, 0xc0007c8500, 0x0, 0x0, 0x0, 0xc00000e000, 0x10f1)
2019-09-28T17:45:45.378-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-google/vendor/github.com/hashicorp/terraform/internal/tfplugin5/tfplugin5.pb.go:3217 +0x23e
2019-09-28T17:45:45.378-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: github.com/terraform-providers/terraform-provider-google/vendor/google.golang.org/grpc.(*Server).processUnaryRPC(0xc000083500, 0x2e11740, 0xc000083c80, 0xc0001b3300, 0xc00015ede0, 0x3fe1520, 0x0, 0x0, 0x0)
2019-09-28T17:45:45.378-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-google/vendor/google.golang.org/grpc/server.go:972 +0x4a2
2019-09-28T17:45:45.378-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: github.com/terraform-providers/terraform-provider-google/vendor/google.golang.org/grpc.(*Server).handleStream(0xc000083500, 0x2e11740, 0xc000083c80, 0xc0001b3300, 0x0)
2019-09-28T17:45:45.378-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-google/vendor/google.golang.org/grpc/server.go:1252 +0xe02
2019-09-28T17:45:45.378-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: github.com/terraform-providers/terraform-provider-google/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc0000a64b0, 0xc000083500, 0x2e11740, 0xc000083c80, 0xc0001b3300)
2019-09-28T17:45:45.378-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-google/vendor/google.golang.org/grpc/server.go:691 +0x9f
2019-09-28T17:45:45.378-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: created by github.com/terraform-providers/terraform-provider-google/vendor/google.golang.org/grpc.(*Server).serveStreams.func1
2019-09-28T17:45:45.378-0700 [DEBUG] plugin.terraform-provider-google_v2.9.1_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-google/vendor/google.golang.org/grpc/server.go:689 +0xa1
2019-09-28T17:45:45.380-0700 [DEBUG] plugin: plugin process exited: path=/Users/showang/git/wildfire-terraform/tests/gke/.terraform/plugins/darwin_amd64/terraform-provider-google_v2.9.1_x4 pid=86717 error="exit status 2"
2019/09/28 17:45:45 [DEBUG] module.myk8scluster.google_container_cluster.gke_cluster: apply errored, but we're indicating that via the Error pointer rather than returning it: rpc error: code = Unavailable desc = transport is closing
2019/09/28 17:45:45 [TRACE] module.myk8scluster: eval: *terraform.EvalMaybeTainted
2019/09/28 17:45:45 [TRACE] EvalMaybeTainted: module.myk8scluster.google_container_cluster.gke_cluster encountered an error during creation, so it is now marked as tainted
2019/09/28 17:45:45 [TRACE] module.myk8scluster: eval: *terraform.EvalWriteState
2019/09/28 17:45:45 [TRACE] EvalWriteState: removing state object for module.myk8scluster.google_container_cluster.gke_cluster
2019/09/28 17:45:45 [TRACE] module.myk8scluster: eval: *terraform.EvalApplyProvisioners
2019/09/28 17:45:45 [TRACE] EvalApplyProvisioners: google_container_cluster.gke_cluster has no state, so skipping provisioners
2019/09/28 17:45:45 [TRACE] module.myk8scluster: eval: *terraform.EvalMaybeTainted
2019/09/28 17:45:45 [TRACE] EvalMaybeTainted: module.myk8scluster.google_container_cluster.gke_cluster encountered an error during creation, so it is now marked as tainted
2019/09/28 17:45:45 [TRACE] module.myk8scluster: eval: *terraform.EvalWriteState
2019/09/28 17:45:45 [TRACE] EvalWriteState: removing state object for module.myk8scluster.google_container_cluster.gke_cluster
2019/09/28 17:45:45 [TRACE] module.myk8scluster: eval: *terraform.EvalIf
2019/09/28 17:45:45 [TRACE] module.myk8scluster: eval: *terraform.EvalIf
2019/09/28 17:45:45 [TRACE] module.myk8scluster: eval: *terraform.EvalWriteDiff
2019/09/28 17:45:45 [TRACE] module.myk8scluster: eval: *terraform.EvalApplyPost
2019/09/28 17:45:45 [ERROR] module.myk8scluster: eval: *terraform.EvalApplyPost, err: rpc error: code = Unavailable desc = transport is closing
2019/09/28 17:45:45 [ERROR] module.myk8scluster: eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2019/09/28 17:45:45 [TRACE] [walkApply] Exiting eval tree: module.myk8scluster.google_container_cluster.gke_cluster
2019/09/28 17:45:45 [TRACE] vertex "module.myk8scluster.google_container_cluster.gke_cluster": visit complete
2019/09/28 17:45:45 [TRACE] dag/walk: upstream of "module.myk8scluster.output.cluster_ca_certificate" errored, so skipping
2019/09/28 17:45:45 [TRACE] dag/walk: upstream of "module.myk8scluster.output.client_certificate" errored, so skipping
2019/09/28 17:45:45 [TRACE] dag/walk: upstream of "module.myk8scluster.output.client_key" errored, so skipping
2019/09/28 17:45:45 [TRACE] dag/walk: upstream of "module.myk8scluster.google_container_node_pool.node_pool1" errored, so skipping
2019/09/28 17:45:45 [TRACE] dag/walk: upstream of "module.myk8scluster.output.cluster_name" errored, so skipping
2019/09/28 17:45:45 [TRACE] dag/walk: upstream of "module.myk8scluster.google_container_node_pool.node_pool[0]" errored, so skipping
2019/09/28 17:45:45 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
2019/09/28 17:45:45 [TRACE] dag/walk: upstream of "provider.google (close)" errored, so skipping
2019/09/28 17:45:45 [TRACE] dag/walk: upstream of "root" errored, so skipping
2019-09-28T17:45:45.585-0700 [DEBUG] plugin: plugin exited

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Terraform crashed! This is always indicative of a bug within Terraform.
A crash log has been placed at "crash.log" relative to your current
working directory. It would be immensely helpful if you could please
report the crash with Terraform1 so that we can fix this.

When reporting bugs, please include your terraform version. That
information is available on the first line of crash.log. You can also
get it by running 'terraform --version' on the command line.

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!
SJCMAC8Q2G8WN:gke showang$
SJCMAC8Q2G8WN:gke showang$
SJCMAC8Q2G8WN:gke showang$ terraform version
Terraform v0.12.8

  • provider.google v2.9.1

Your version of Terraform is out of date! The latest version
is 0.12.9. You can update by downloading from www.terraform.io/downloads.html

Expected Behavior

Actual Behavior

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000
@ghost ghost added bug crash labels Sep 29, 2019
@slevenick
Copy link
Collaborator

Looks like this is a duplicate of #4010

This issue was fixed in the provider version 2.11.0 so I would recommend upgrading to any version higher than that

@ghost
Copy link

ghost commented Oct 31, 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 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Oct 31, 2019
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