Skip to content
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

fix missing quotes for bicepparams #4484

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 7 additions & 1 deletion cli/azd/pkg/apphost/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -1816,7 +1816,13 @@ func (b *infraGenerator) buildDeployBlock(
}
}
}

// make sure resolved value is quoted.
// We can't ask EvalString() to quote strings b/c it depends on evalBindingRef() which can return complex
// expressions where each part might be quoted or not.
// Instead, before setting the deploy parameter, we just verify that it's quoted.
if !strings.HasPrefix(resolvedValue, "'") {
resolvedValue = "'" + resolvedValue + "'"
}
manifestCtx.DeployParams[k] = resolvedValue
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using './cache.module.bicep'

param cache_volumes_0_storage = '{{ .Env.SERVICE_CACHE_VOLUME_AZURECONTAINERAPPSAPPHOST8F235654EDCACHEDATA_NAME }}'
param complex = 'tcp:cache/foo'
param host = 'cache'
param outputs_azure_container_apps_environment_id = '{{ .Env.AZURE_CONTAINER_APPS_ENVIRONMENT_ID }}'
param outputs_azure_container_registry_managed_identity_id = '{{ .Env.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID }}'
param outputs_managed_identity_client_id = '{{ .Env.MANAGED_IDENTITY_CLIENT_ID }}'
param protocol = 'tcp'

5 changes: 4 additions & 1 deletion cli/azd/pkg/apphost/testdata/aspire-projectv1.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
"cache_volumes_0_storage": "{cache.volumes.0.storage}",
"outputs_azure_container_registry_managed_identity_id": "{.outputs.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID}",
"outputs_managed_identity_client_id": "{.outputs.MANAGED_IDENTITY_CLIENT_ID}",
"outputs_azure_container_apps_environment_id": "{.outputs.AZURE_CONTAINER_APPS_ENVIRONMENT_ID}"
"outputs_azure_container_apps_environment_id": "{.outputs.AZURE_CONTAINER_APPS_ENVIRONMENT_ID}",
"host": "{cache.bindings.tcp.host}",
"protocol": "{cache.bindings.tcp.protocol}",
"complex": "{cache.bindings.tcp.protocol}:{cache.bindings.tcp.host}/foo"
}
},
"args": [
Expand Down
Loading