Skip to content

Commit 40e4e12

Browse files
committed
make insecure a variable, fix coder metadata resource_id
1 parent 08c04ea commit 40e4e12

File tree

1 file changed

+9
-3
lines changed
  • examples/templates/devcontainer-docker

1 file changed

+9
-3
lines changed

examples/templates/devcontainer-docker/main.tf

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ variable "cache_repo" {
9797
type = string
9898
}
9999

100+
variable "insecure_cache_repo" {
101+
default = false
102+
description = "Enable this option if your cache registry does not serve HTTPS."
103+
type = bool
104+
}
105+
100106
variable "cache_repo_docker_config_path" {
101107
default = ""
102108
description = "(Optional) Path to a docker config.json containing credentials to the provided cache repo, if required."
@@ -122,7 +128,7 @@ locals {
122128
"ENVBUILDER_CACHE_REPO" : var.cache_repo,
123129
"ENVBUILDER_DOCKER_CONFIG_BASE64" : try(data.local_sensitive_file.cache_repo_dockerconfigjson[0].content_base64, ""),
124130
"ENVBUILDER_PUSH_IMAGE" : var.cache_repo == "" ? "" : "true",
125-
#"ENVBUILDER_INSECURE": "true", # Uncomment if testing with an insecure registry.
131+
"ENVBUILDER_INSECURE" : "${var.insecure_cache_repo}",
126132
}
127133
# Convert the above map to the format expected by the docker provider.
128134
docker_env = [
@@ -174,7 +180,7 @@ resource "envbuilder_cached_image" "cached" {
174180
git_url = local.repo_url
175181
cache_repo = var.cache_repo
176182
extra_env = local.envbuilder_env
177-
#insecure = true # Uncomment if testing with an insecure registry.
183+
insecure = var.insecure_cache_repo
178184
}
179185

180186
resource "docker_container" "workspace" {
@@ -328,7 +334,7 @@ resource "coder_app" "code-server" {
328334

329335
resource "coder_metadata" "container_info" {
330336
count = data.coder_workspace.me.start_count
331-
resource_id = docker_container.workspace.0.id
337+
resource_id = coder_agent.main.id
332338
item {
333339
key = "workspace image"
334340
value = var.cache_repo == "" ? local.devcontainer_builder_image : envbuilder_cached_image.cached.0.image

0 commit comments

Comments
 (0)