mirror of
https://github.com/coder/terraform-provider-envbuilder.git
synced 2025-09-22 16:47:15 +00:00
fix(internal/provider): correct escaping of strings in envbuilder_cached_image.env (#32)
Fixes #31 We had previously been doing the equivalent of value.String() when writing envbuilder_cached_image.env. This was incorrectly escaping newlines, potentially breaking ENVBUILDER_INIT_SCRIPT. This PR modifies the behaviour to correctly handle string values via ValueString() instead.
This commit is contained in:
parent
b35004a702
commit
68cc59d705
3 changed files with 36 additions and 25 deletions
examples/resources/envbuilder_cached_image
|
@ -66,10 +66,11 @@ resource "envbuilder_cached_image" "example" {
|
|||
builder_image = var.builder_image
|
||||
git_url = var.repo_url
|
||||
cache_repo = local.cache_repo
|
||||
insecure = true
|
||||
extra_env = {
|
||||
"ENVBUILDER_VERBOSE" : "true"
|
||||
"ENVBUILDER_INSECURE" : "true" # due to local registry
|
||||
"ENVBUILDER_INIT_SCRIPT" : "sleep infinity"
|
||||
"ENVBUILDER_INIT_SCRIPT" : "#!/usr/bin/env bash\necho Hello && sleep infinity"
|
||||
"ENVBUILDER_PUSH_IMAGE" : "true"
|
||||
}
|
||||
depends_on = [docker_container.registry]
|
||||
|
@ -77,8 +78,8 @@ resource "envbuilder_cached_image" "example" {
|
|||
|
||||
// Run the cached image. Depending on the contents of
|
||||
// the cache repo, this will either be var.builder_image
|
||||
// or a previously built image pusehd to var.cache_repo.
|
||||
// Running `terraform apply` once (assuming empty cache)
|
||||
// or a previously built image pushed to var.cache_repo.
|
||||
// Running `terraform apply` once (assuming empty cache)
|
||||
// will result in the builder image running, and the built
|
||||
// image being pushed to the cache repo.
|
||||
// Running `terraform apply` again will result in the
|
||||
|
@ -105,4 +106,3 @@ output "id" {
|
|||
output "image" {
|
||||
value = envbuilder_cached_image.example.image
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue