Skip to content

chore(examples): update kubernetes devcontainer template with envbuilder provider #14267

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

Merged
merged 3 commits into from
Aug 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make insecure a template variable
  • Loading branch information
johnstcn committed Aug 15, 2024
commit 821ea4086eb8db487d5435d61eacada57c11131e
19 changes: 12 additions & 7 deletions examples/templates/devcontainer-kubernetes/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ variable "cache_repo" {
type = string
}

variable "insecure_cache_repo" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice solution 👍🏻

default = false
description = "Enable this option if your cache registry does not serve HTTPS."
type = bool
}

data "coder_parameter" "cpu" {
type = "number"
name = "cpu"
Expand Down Expand Up @@ -159,7 +165,7 @@ locals {
"ENVBUILDER_CACHE_REPO" : var.cache_repo,
"ENVBUILDER_DOCKER_CONFIG_BASE64" : try(data.kubernetes_secret.cache_repo_dockerconfig_secret[0].data[".dockerconfigjson"], ""),
"ENVBUILDER_PUSH_IMAGE" : var.cache_repo == "" ? "" : "true",
#"ENVBUILDER_INSECURE": "true", # Uncomment if testing with an insecure registry.
"ENVBUILDER_INSECURE" : "${var.insecure_cache_repo}",
}
}

Expand All @@ -171,7 +177,7 @@ resource "envbuilder_cached_image" "cached" {
git_url = local.repo_url
cache_repo = var.cache_repo
extra_env = local.envbuilder_env
#insecure = true # Uncomment if testing with an insecure registry.
insecure = var.insecure_cache_repo
}

resource "kubernetes_persistent_volume_claim" "workspaces" {
Expand Down Expand Up @@ -282,11 +288,10 @@ resource "kubernetes_deployment" "main" {
name = "ENVBUILDER_PUSH_IMAGE"
value = var.cache_repo == "" ? "" : "true"
}
# Uncomment the below if testing with an insecure registry.
# env {
# name = "ENVBUILDER_INSECURE"
# value = "true"
# }
env {
name = "ENVBUILDER_INSECURE"
value = var.insecure_cache_repo
}
env {
name = "ENVBUILDER_DOCKER_CONFIG_BASE64"
value = try(data.kubernetes_secret.cache_repo_dockerconfig_secret[0].data[".dockerconfigjson"], "")
Expand Down
Loading