-
Notifications
You must be signed in to change notification settings - Fork 887
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
Conversation
15af3ce
to
71c8e39
Compare
@@ -222,7 +257,7 @@ resource "kubernetes_deployment" "main" { | |||
|
|||
container { | |||
name = "dev" | |||
image = local.devcontainer_builder_image | |||
image = var.cache_repo == "" ? local.devcontainer_builder_image : envbuilder_cached_image.cached.0.image | |||
image_pull_policy = "Always" | |||
security_context {} | |||
env { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
review: leaving as-is until coder/terraform-provider-envbuilder#31 is resolved.
There may be some additional Terraform jiggery pokery requried to convert local.envbuilder_env
into a block list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A for-loop would be nice here to set all the envs, wdyt?
Right now it can come from locals.envbuilder_env
, but eventually from envbuilder_cached_image.cached.0.env
.
env {
for_each = locals.envbuilder_env
name = each.key
value = each.value
}
Not sure if tomap
is required (for_each = tomap(locals.envbuilder_env)
), probably not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but then that needs to be referenced in the kubernetes_pod
spec below. I think that may need a dynamic{}
block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly, my tf foo is not strong enough 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll address this in a follow-up. The current way the envbuilder provider outputs the computed env isn't really conducive to this scenario right now anyway.
type = string | ||
} | ||
|
||
variable "insecure_cache_repo" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice solution 👍🏻
@@ -222,7 +257,7 @@ resource "kubernetes_deployment" "main" { | |||
|
|||
container { | |||
name = "dev" | |||
image = local.devcontainer_builder_image | |||
image = var.cache_repo == "" ? local.devcontainer_builder_image : envbuilder_cached_image.cached.0.image | |||
image_pull_policy = "Always" | |||
security_context {} | |||
env { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A for-loop would be nice here to set all the envs, wdyt?
Right now it can come from locals.envbuilder_env
, but eventually from envbuilder_cached_image.cached.0.env
.
env {
for_each = locals.envbuilder_env
name = each.key
value = each.value
}
Not sure if tomap
is required (for_each = tomap(locals.envbuilder_env)
), probably not?
71c8e39
to
821ea40
Compare
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
See also: #14199
Updates the devcontainer-kubernetes template to use the coder/envbuilder provider.
Caching is completely optional here.