Invalid resource names
ajchiarello opened this issue · 2 comments
When converting a yaml where the name field contains a colon, this is replicated to the resource name, which results in an invalid name for a terraform resource and fails terraform validation.
For example:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app: metallb
name: metallb-system:speaker
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: metallb-system:speaker
subjects:
- kind: ServiceAccount
name: speaker
namespace: metallb-system
becomes
resource "kubernetes_cluster_role_binding" "metallb_system:speaker" {
metadata {
name = "metallb-system:speaker"
labels = {
app = "metallb"
}
}
subject {
kind = "ServiceAccount"
name = "speaker"
namespace = "metallb-system"
}
role_ref {
api_group = "rbac.authorization.k8s.io"
kind = "ClusterRole"
name = "metallb-system:speaker"
}
}
I have encountered this issue when converting the Metrics Server files, located there: https://github.com/kubernetes-sigs/metrics-server/tree/v0.3.6/deploy/1.8+
This is the intentional restriction on terraform v0.12
hashicorp/terraform#19919