Skip to content

Commit

Permalink
feat: add metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
klauserber committed Oct 28, 2023
1 parent 26bd20c commit db3ca5e
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 1 deletion.
4 changes: 4 additions & 0 deletions automate/roles/coder/coder_templates/devbox/config_job.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
resource "coder_metadata" "job_hide" {
resource_id = kubernetes_job.config.id
hide = true
}

resource "kubernetes_job" "config" {
metadata {
Expand Down
13 changes: 13 additions & 0 deletions automate/roles/coder/coder_templates/devbox/deployment.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
resource "coder_metadata" "deployment_info" {
count = data.coder_workspace.me.start_count
resource_id = kubernetes_deployment.main.0.id
item {
key = "username"
value = local.workspace_owner
}
item {
key = "clustername"
value = var.cluster_name
}
}

resource "kubernetes_deployment" "main" {
depends_on = [
kubernetes_job.config
Expand Down
5 changes: 4 additions & 1 deletion automate/roles/coder/coder_templates/devbox/namespace.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

resource "coder_metadata" "namespace_hide" {
resource_id = kubernetes_namespace.work-ns.id
hide = true
}
resource "kubernetes_namespace" "work-ns" {
metadata {
name = "${var.workspaces_namespace}-${local.workspace_owner}-${local.workspace_name}"
Expand Down
5 changes: 5 additions & 0 deletions automate/roles/coder/coder_templates/devbox/pvc.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
resource "coder_metadata" "pvc_hide" {
resource_id = kubernetes_persistent_volume_claim.pvc.id
hide = true
}

resource "kubernetes_persistent_volume_claim" "pvc" {
metadata {
name = "coder-${local.workspace_owner}-${local.workspace_name}"
Expand Down
10 changes: 10 additions & 0 deletions automate/roles/coder/coder_templates/devbox/role_bindings.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
resource "coder_metadata" "user_rb_hide" {
count = local.is_admin ? 0 : 1
resource_id = kubernetes_role_binding.namespace_admin.0.id
hide = true
}

resource "kubernetes_role_binding" "namespace_admin" {
count = local.is_admin ? 0 : 1
Expand All @@ -16,6 +21,11 @@ resource "kubernetes_role_binding" "namespace_admin" {
namespace = kubernetes_namespace.work-ns.metadata.0.name
}
}
resource "coder_metadata" "admin_rb_hide" {
count = local.is_admin ? 1 : 0
resource_id = kubernetes_cluster_role_binding.cluster_admin.0.id
hide = true
}

resource "kubernetes_cluster_role_binding" "cluster_admin" {
count = local.is_admin ? 1 : 0
Expand Down

0 comments on commit db3ca5e

Please sign in to comment.