terraform-provider-rancher2: Create EKS cluster on Terraform 0.12 causes terraform to crash
Hi,
I wanted to create an EKS cluster on terraform by not specifying VPC/subnet/security group and specifying everything else. But, when I ran the terraform config, it resulted into terraform crash. Here’s the `rancher2_clusterz terraform config.
resource "rancher2_cluster" "rancher-custom" {
name = var.rancher_cluster_name
description = "${var.rancher_cluster_name} Kubernetes cluster"
eks_config {
access_key = var.AWS_ACCESS_KEY_ID
secret_key = var.AWS_SECRET_ACCESS_KEY
security_groups = var.existing_vpc ? [var.security_group_name] : [""]
service_role = var.service_role != "" ? var.service_role : aws_iam_role.eks[0].name
subnets = var.existing_vpc ? list(var.subnet_id1, var.subnet_id2, var.subnet_id3) : [""]
ami = var.ami_id == "" ? data.aws_ami.distro.id : var.ami_id
associate_worker_node_public_ip = var.associate_worker_node_public_ip
instance_type = var.instance_type
kubernetes_version = var.kubernetes_version
maximum_nodes = var.maximum_nodes
minimum_nodes = var.minimum_nodes
node_volume_size = var.disk_size
region = var.region
session_token = var.session_token
virtual_network = var.vpc_id
}
}
access_key and secret_key is set in env. The terraform plan shows the following details>
# module.cattle-eks.rancher2_cluster.rancher-custom will be created
+ resource "rancher2_cluster" "rancher-custom" {
+ annotations = (known after apply)
+ cluster_registration_token = (known after apply)
+ default_pod_security_policy_template_id = (known after apply)
+ default_project_id = (known after apply)
+ description = "test-eks Kubernetes cluster"
+ driver = (known after apply)
+ enable_network_policy = false
+ id = (known after apply)
+ kube_config = (known after apply)
+ labels = (known after apply)
+ name = "test-eks"
+ system_project_id = (known after apply)
+ cluster_auth_endpoint {
+ ca_certs = (known after apply)
+ enabled = (known after apply)
+ fqdn = (known after apply)
}
+ eks_config {
+ access_key = (sensitive value)
+ ami = "ami-0033d0dbf7f5e92af"
+ associate_worker_node_public_ip = true
+ kubernetes_version = "1.12"
+ maximum_nodes = 3
+ minimum_nodes = 1
+ node_volume_size = 20
+ region = "eu-central-1"
+ secret_key = (sensitive value)
+ security_groups = [
+ "",
]
+ service_role = "rancher-eks-role-6z4uzzvkou"
+ subnets = [
+ "",
]
+ user_data = (known after apply)
}
}
Basically, I want to utilize the VPC/Subnet creation functionality - Standard: Rancher generated VPC and Subnet which is shown in the Rancher UI at the time of cluster creation.

terraform apply output:
panic: interface conversion: interface {} is nil, not string
2019-06-27T17:54:24.415+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4:
2019-06-27T17:54:24.415+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: goroutine 113 [running]:
2019-06-27T17:54:24.415+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: github.com/terraform-providers/terraform-provider-rancher2/rancher2.toArrayString(0xc0002ddef0, 0x1, 0x1, 0xf, 0xc000688e28, 0xa)
2019-06-27T17:54:24.415+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-rancher2/rancher2/util.go:210 +0xfb
2019-06-27T17:54:24.415+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: github.com/terraform-providers/terraform-provider-rancher2/rancher2.expandClusterEKSConfig(0xc0002dddc0, 0x1, 0x1, 0xc0004cac10, 0x8, 0x60000c0008f9818, 0xffffffffffffffff, 0x3)
2019-06-27T17:54:24.415+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-rancher2/rancher2/structure_cluster_eks_config.go:128 +0x8bd
2019-06-27T17:54:24.415+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: github.com/terraform-providers/terraform-provider-rancher2/rancher2.expandCluster(0xc0002e6c40, 0x28d5f70, 0xc0008f96a0, 0xc0004c9758)
2019-06-27T17:54:24.415+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-rancher2/rancher2/structure_cluster.go:232 +0x75a
2019-06-27T17:54:24.415+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: github.com/terraform-providers/terraform-provider-rancher2/rancher2.resourceRancher2ClusterCreate(0xc0002e6c40, 0x1d7d440, 0xc00056e000, 0x2, 0x29026c0)
2019-06-27T17:54:24.415+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-rancher2/rancher2/resource_rancher2_cluster.go:34 +0x40
2019-06-27T17:54:24.415+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: github.com/terraform-providers/terraform-provider-rancher2/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc00045e780, 0xc00060c550, 0xc00000b300, 0x1d7d440, 0xc00056e000, 0x1bde201, 0xc000685948, 0xc000683ad0)
2019-06-27T17:54:24.415+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-rancher2/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:286 +0x363
2019-06-27T17:54:24.415+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: github.com/terraform-providers/terraform-provider-rancher2/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc00045fb00, 0xc0004c9a00, 0xc00060c550, 0xc00000b300, 0xc000924868, 0xc000155e30, 0x1be0820)
2019-06-27T17:54:24.415+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-rancher2/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:285 +0x9c
2019-06-27T17:54:24.415+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: github.com/terraform-providers/terraform-provider-rancher2/vendor/github.com/hashicorp/terraform/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc000154578, 0x1f595e0, 0xc00066c0f0, 0xc0001407e0, 0xc000154578, 0xc0001a6cc0, 0x1c0c7e0)
2019-06-27T17:54:24.415+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-rancher2/vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provider.go:842 +0x87a
2019-06-27T17:54:24.415+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: github.com/terraform-providers/terraform-provider-rancher2/vendor/github.com/hashicorp/terraform/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x1d44ec0, 0xc000154578, 0x1f595e0, 0xc00066c0f0, 0xc00060c0f0, 0x0, 0x0, 0x0, 0xc000017200, 0x5de)
2019-06-27T17:54:24.415+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-rancher2/vendor/github.com/hashicorp/terraform/internal/tfplugin5/tfplugin5.pb.go:3019 +0x23e
2019-06-27T17:54:24.415+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: github.com/terraform-providers/terraform-provider-rancher2/vendor/google.golang.org/grpc.(*Server).processUnaryRPC(0xc0002c1380, 0x1f62060, 0xc000575380, 0xc000492100, 0xc000142b70, 0x28d63e0, 0x0, 0x0, 0x0)
2019-06-27T17:54:24.415+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-rancher2/vendor/google.golang.org/grpc/server.go:966 +0x4a2
2019-06-27T17:54:24.416+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: github.com/terraform-providers/terraform-provider-rancher2/vendor/google.golang.org/grpc.(*Server).handleStream(0xc0002c1380, 0x1f62060, 0xc000575380, 0xc000492100, 0x0)
2019-06-27T17:54:24.416+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-rancher2/vendor/google.golang.org/grpc/server.go:1245 +0xd61
2019-06-27T17:54:24.416+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: github.com/terraform-providers/terraform-provider-rancher2/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc0001520d0, 0xc0002c1380, 0x1f62060, 0xc000575380, 0xc000492100)
2019-06-27T17:54:24.416+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-rancher2/vendor/google.golang.org/grpc/server.go:685 +0x9f
2019-06-27T17:54:24.416+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: created by github.com/terraform-providers/terraform-provider-rancher2/vendor/google.golang.org/grpc.(*Server).serveStreams.func1
2019-06-27T17:54:24.416+0200 [DEBUG] plugin.terraform-provider-rancher2_v1.3.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-rancher2/vendor/google.golang.org/grpc/server.go:683 +0xa1
2019-06-27T17:54:24.419+0200 [DEBUG] plugin: plugin process exited: path=/Users/shantanudeshpande/cloudssky_contrib/src/github.com/kubernauts/tk8-provisioner-cattle-eks/.terraform/plugins/darwin_amd64/terraform-provider-rancher2_v1.3.0_x4 pid=417 error="exit status 2"
2019/06/27 17:54:24 [DEBUG] module.cattle-eks.rancher2_cluster.rancher-custom: apply errored, but we're indicating that via the Error pointer rather than returning it: rpc error: code = Unavailable desc = transport is closing
2019/06/27 17:54:24 [TRACE] module.cattle-eks: eval: *terraform.EvalMaybeTainted
2019/06/27 17:54:24 [TRACE] EvalMaybeTainted: module.cattle-eks.rancher2_cluster.rancher-custom encountered an error during creation, so it is now marked as tainted
2019/06/27 17:54:24 [TRACE] module.cattle-eks: eval: *terraform.EvalWriteState
2019/06/27 17:54:24 [TRACE] EvalWriteState: removing state object for module.cattle-eks.rancher2_cluster.rancher-custom
2019/06/27 17:54:24 [TRACE] module.cattle-eks: eval: *terraform.EvalApplyProvisioners
2019/06/27 17:54:24 [TRACE] EvalApplyProvisioners: rancher2_cluster.rancher-custom has no state, so skipping provisioners
2019/06/27 17:54:24 [TRACE] module.cattle-eks: eval: *terraform.EvalMaybeTainted
2019/06/27 17:54:24 [TRACE] EvalMaybeTainted: module.cattle-eks.rancher2_cluster.rancher-custom encountered an error during creation, so it is now marked as tainted
2019/06/27 17:54:24 [TRACE] module.cattle-eks: eval: *terraform.EvalWriteState
2019/06/27 17:54:24 [TRACE] EvalWriteState: removing state object for module.cattle-eks.rancher2_cluster.rancher-custom
2019/06/27 17:54:24 [TRACE] module.cattle-eks: eval: *terraform.EvalIf
2019/06/27 17:54:24 [TRACE] module.cattle-eks: eval: *terraform.EvalIf
2019/06/27 17:54:24 [TRACE] module.cattle-eks: eval: *terraform.EvalWriteDiff
2019/06/27 17:54:24 [TRACE] module.cattle-eks: eval: *terraform.EvalApplyPost
2019/06/27 17:54:24 [ERROR] module.cattle-eks: eval: *terraform.EvalApplyPost, err: rpc error: code = Unavailable desc = transport is closing
2019/06/27 17:54:24 [ERROR] module.cattle-eks: eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2019/06/27 17:54:24 [TRACE] [walkApply] Exiting eval tree: module.cattle-eks.rancher2_cluster.rancher-custom
2019/06/27 17:54:24 [TRACE] vertex "module.cattle-eks.rancher2_cluster.rancher-custom": visit complete
2019/06/27 17:54:24 [TRACE] dag/walk: upstream of "module.cattle-eks.provider.rancher2 (close)" errored, so skipping
2019/06/27 17:54:24 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
2019/06/27 17:54:24 [TRACE] dag/walk: upstream of "root" errored, so skipping
2019/06/27 17:54:24 [TRACE] statemgr.Filesystem: not making a backup, because the new snapshot is identical to the old
2019/06/27 17:54:24 [TRACE] statemgr.Filesystem: no state changes since last snapshot
2019/06/27 17:54:24 [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate
2019/06/27 17:54:24 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
2019/06/27 17:54:24 [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock
2019-06-27T17:54:24.452+0200 [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 Terraform[1] 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.
[1]: https://github.com/hashicorp/terraform/issues
!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (7 by maintainers)
@ishantanu, i expect to cut a new release at the end of this week.
Submitted PR #46 to address this issue.
@ishantanu, API call from terraform provider should be the same that API cal made by GUI. Once the PR is merged, your posted tf file should work fine, making rancher to create VPC, subnets and security group.