terraform-provider-yandex
terraform-provider-yandex copied to clipboard
Resource creation fails name: Field does not match the pattern /|[a-z]([-a-z0-9]{0,61}[a-z0-9])?/
Manifest block with resource usage and naming from vpc.tf
file
...
resource "yandex_vpc_security_group" "nodes_group_kuber-test" {
cluster_id = "${yandex_kubernetes_cluster.zonal_kuber_test.id}
name = "kuber-test_nodes_group_0"
version = "1.23"
...
Debug log from terraform apply
2023-06-19T02:02:00.871-0500 [DEBUG] Starting graph walk: walkApply
2023-06-19T02:02:00.871-0500 [DEBUG] created provider logger: level=debug
2023-06-19T02:02:00.871-0500 [INFO] provider: configuring client automatic mTLS
2023-06-19T02:02:00.877-0500 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/yandex-cloud/yandex/0.93.0/linux_amd64/terraform-provider-yandex_v0.93.0 args=[.terraform/providers/registry.terraform.io/yan
dex-cloud/yandex/0.93.0/linux_amd64/terraform-provider-yandex_v0.93.0]
2023-06-19T02:02:00.877-0500 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/yandex-cloud/yandex/0.93.0/linux_amd64/terraform-provider-yandex_v0.93.0 pid=23638
2023-06-19T02:02:00.877-0500 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/yandex-cloud/yandex/0.93.0/linux_amd64/terraform-provider-yandex_v0.93.0
2023-06-19T02:02:00.890-0500 [INFO] provider.terraform-provider-yandex_v0.93.0: configuring server automatic mTLS: timestamp=2023-06-19T02:02:00.890-0500
2023-06-19T02:02:00.906-0500 [DEBUG] provider: using plugin: version=5
2023-06-19T02:02:00.906-0500 [DEBUG] provider.terraform-provider-yandex_v0.93.0: plugin address: address=/tmp/plugin3359269328 network=unix timestamp=2023-06-19T02:02:00.906-0500
2023-06-19T02:02:00.955-0500 [WARN] ValidateProviderConfig from "provider[\"registry.terraform.io/yandex-cloud/yandex\"]" changed the config value, but that value is unused
2023-06-19T02:02:00.960-0500 [WARN] Provider "registry.terraform.io/yandex-cloud/yandex" produced an invalid plan for yandex_kubernetes_node_group.nodes_group_kuber_test, but we are tolerating it because it is using the legacy plugin SD
K.
The following problems may be the cause of any confusing errors from downstream operations:
- .deploy_policy: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
- .instance_template[0].container_network: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
- .instance_template[0].network_interface[0].ipv4: planned value cty.True for a non-computed attribute
- .instance_template[0].resources[0].gpus: planned value cty.NumberIntVal(0) for a non-computed attribute
yandex_kubernetes_node_group.nodes_group_kuber_test: Creating...
2023-06-19T02:02:00.960-0500 [INFO] Starting apply for yandex_kubernetes_node_group.nodes_group_kuber_test
2023-06-19T02:02:00.961-0500 [DEBUG] yandex_kubernetes_node_group.nodes_group_kuber_test: applying the planned Create change
2023-06-19T02:02:00.962-0500 [DEBUG] provider.terraform-provider-yandex_v0.93.0: setting computed for "instance_template.0.metadata" from ComputedKeys: timestamp=2023-06-19T02:02:00.962-0500
2023-06-19T02:02:00.962-0500 [DEBUG] provider.terraform-provider-yandex_v0.93.0: setting computed for "instance_template.0.container_network" from ComputedKeys: timestamp=2023-06-19T02:02:00.962-0500
2023-06-19T02:02:00.962-0500 [DEBUG] provider.terraform-provider-yandex_v0.93.0: setting computed for "instance_template.0.container_network" from ComputedKeys: timestamp=2023-06-19T02:02:00.962-0500
2023-06-19T02:02:00.962-0500 [DEBUG] provider.terraform-provider-yandex_v0.93.0: setting computed for "instance_template.0.metadata" from ComputedKeys: timestamp=2023-06-19T02:02:00.962-0500
2023-06-19T02:02:00.962-0500 [DEBUG] provider.terraform-provider-yandex_v0.93.0: setting computed for "version_info" from ComputedKeys: timestamp=2023-06-19T02:02:00.962-0500
2023-06-19T02:02:00.962-0500 [DEBUG] provider.terraform-provider-yandex_v0.93.0: setting computed for "deploy_policy" from ComputedKeys: timestamp=2023-06-19T02:02:00.962-0500
2023-06-19T02:02:01.560-0500 [ERROR] vertex "yandex_kubernetes_node_group.nodes_group_kuber_test" error: error while requesting API to create Kubernetes node group: server-request-id = 058cac11-ca81-427f-82df-ddfb5014ab97 server-trace-id
= 6cc0ff4cd0c228d4:a324fbdb740be23:6cc0ff4cd0c228d4:1 client-request-id = e0299d3b-a824-4348-a911-8e2eb48791d5 client-trace-id = 93be1d9d-6954-4f1a-8487-53b763d1c2a6 rpc error: code = InvalidArgument desc = Validation error:
name: Field does not match the pattern /|[a-z]([-a-z0-9]{0,61}[a-z0-9])?/
╷
│ Error: error while requesting API to create Kubernetes node group: server-request-id = 058cac11-ca81-427f-82df-ddfb5014ab97 server-trace-id = 6cc0ff4cd0c228d4:a324fbdb740be23:6cc0ff4cd0c228d4:1 client-request-id = e0299d3b-a824-4348-a9
11-8e2eb48791d5 client-trace-id = 93be1d9d-6954-4f1a-8487-53b763d1c2a6 rpc error: code = InvalidArgument desc = Validation error:
│ name: Field does not match the pattern /|[a-z]([-a-z0-9]{0,61}[a-z0-9])?/
│
│ with yandex_kubernetes_node_group.nodes_group_kuber_test,
│ on vpc.tf line 13, in resource "yandex_kubernetes_node_group" "nodes_group_kuber_test":
│ 13: resource "yandex_kubernetes_node_group" "nodes_group_kuber_test" {
Doesnt find in provider documentation any syntax examples and match patterns or something naming scheme. Underscore symbols is approved to use in resource.
This is the example from tf provider docs.
Creates a Yandex Kubernetes Node Group.
[Example Usage](https://registry.terraform.io/providers/yandex-cloud/yandex/latest/docs/resources/kubernetes_node_group#example-usage)
...
resource "yandex_kubernetes_node_group" "my_node_group" {
cluster_id = "${yandex_kubernetes_cluster.my_cluster.id}"
name = "name"
description = "description"
version = "1.17"
labels = {
"key" = "value"
}
...
When changed name and resource to next (heads over) notation all node group was deployed without errors.
...
resource "yandex_vpc_security_group" "nodes-group-kuber-test" {
cluster_id = "${yandex_kubernetes_cluster.zonal_kuber_test.id}
name = "kuber-test-nodes-group-0"
version = "1.23"
...
In web console there is restriction for underscore in name fields So, the same behavior in terrafrom. Needs to be added as check to provider for terraform validate