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

Invalid resource names #50

Closed
ajchiarello opened this issue Dec 2, 2019 · 2 comments · Fixed by #69
Closed

Invalid resource names #50

ajchiarello opened this issue Dec 2, 2019 · 2 comments · Fixed by #69

Comments

@ajchiarello
Copy link

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"
}
}

@tynril
Copy link

tynril commented Jan 2, 2020

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+

@stntmaniiac
Copy link

This is the intentional restriction on terraform v0.12
hashicorp/terraform#19919

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants