Has anyone managed to use terraform to create rancher2_namespace resources which have a unique name in the cluster? I’ve got the terraform that can create a rancher2_namespace within a given cluster+project, but the thing is that by itself that’s a problem since a namespace name has to be unique across the entire cluster. The kubernetes_namespace resource can make a unique name, but it doesn’t have a way to attach it to a specific project (even the Default project).
We have a cluster qs that has two projects on it, Dev and QA. We’ve got a workload/service called foo that gets deployed (separately) to Dev and to QA. So, a typical “dev” deploy of foo and a “qa” deploy of foo where each probably has different settings and is meant to only be usable in that project. Obviously we can’t just make a namespace ‘foo’ in each project since it has to be unique across the cluster.
I get in this case that we could make the name something like name = "foo-${var.env}"
. I’d like to keep the namespace independent of the exact project name though so we don’t have to keep the two in sync. Basically looking for kubernetes_namespace (with its generate_name setting), but a thing you can assign into a cluster and a project in Rancher 2.