-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Labels
enhancementNew feature or requestNew feature or request
Description
I have come across an issue when cluster was upgraded from 1.15 to 1.16 and the config stopped working. I have updated the TF files to match the new format but plan keeps failing with a rather unhelpful message:
Error: missing expected [
Enabling Terraform TRACE logging didn't yield any clues and the only way I could spot the issue was to create another environment and compare state files.
I don't think there is a solution to migrate spec format here but a more detailed message with parsing error and some context would have allowed to pinpoint issue much quicker.
I'm using:
Terraform version: 0.12.20
terraform-provider-k8s_v0.1.4
Kubernetes 1.15 / 1.16
Resource in 1.15:
resource "k8s_cloud_google_com_v1beta1_backend_config" "www" {
metadata {
name = "www"
namespace = var.namespace
}
spec = jsonencode({
timeoutSec = 600
spec {
timeout_sec = 600
connectionDraining = {
drainingTimeoutSec = 121
connection_draining {
draining_timeout_sec = 121
}
cdn = {
cdn {
enabled = true
cachePolicy = {
includeHost = true
includeProtocol = true
includeQueryString = true
cache_policy {
include_host = true
include_protocol = true
include_query_string = true
}
}
})
}
}
Same resource in 1.16:
resource "k8s_cloud_google_com_v1beta1_backend_config" "www" {
metadata {
name = "www"
namespace = var.namespace
}
spec {
timeout_sec = 600
connection_draining {
draining_timeout_sec = 121
}
cdn {
enabled = true
cache_policy {
include_host = true
include_protocol = true
include_query_string = true
}
}
}
}
State fragment in 1.15:
{
"mode": "managed",
"type": "k8s_cloud_google_com_v1beta1_backend_config",
"name": "www",
"provider": "provider.k8s",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "test.backend_config.www",
"metadata": [
{
"annotations": {},
"creation_timestamp": "2020-03-31T08:32:16Z",
"deletion_grace_period_seconds": 0,
"deletion_timestamp": "",
"labels": {},
"name": "www",
"namespace": "test",
"resource_version": "8569",
"self_link": "/apis/cloud.google.com/v1beta1/namespaces/test/backendconfigs/www",
"uid": "39592fd1-83b7-48ac-af98-9497c4a5c9dc"
}
],
"spec": "{\"cdn\":{\"cachePolicy\":{\"includeHost\":true,\"includeProtocol\":true,\"includeQueryString\":true},\"enabled\":true},\"connectionDraining\":{\"drainingTimeoutSec\":121},\"timeoutSec\":600}"
},
"private": "bnVsbA=="
}
]
},
State fragment in 1.16:
{
"mode": "managed",
"type": "k8s_cloud_google_com_v1beta1_backend_config",
"name": "www",
"provider": "provider.k8s",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "kube.backend_config.www",
"metadata": [
{
"annotations": {},
"creation_timestamp": "2020-10-26T20:05:01Z",
"deletion_grace_period_seconds": 0,
"deletion_timestamp": "",
"labels": {},
"name": "www",
"namespace": "kube",
"resource_version": "100795599",
"self_link": "/apis/cloud.google.com/v1beta1/namespaces/kube/backendconfigs/www",
"uid": "87c19eed-6aae-4cb9-a86a-1dae1b319bb4"
}
],
"spec": [
{
"cdn": [
{
"cache_policy": [
{
"include_host": "true",
"include_protocol": "true",
"include_query_string": "true",
"query_string_blacklist": [],
"query_string_whitelist": []
}
],
"enabled": "true"
}
],
"connection_draining": [
{
"draining_timeout_sec": 121
}
],
"custom_request_headers": [],
"health_check": [],
"iap": [],
"logging": [],
"security_policy": [],
"session_affinity": [],
"timeout_sec": 600
}
]
},
"private": "bnVsbA=="
}
]
},
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request