Azure / Azure/azure-cli

Azure containerapp compose create does not read unset environment variable defaults

Open
#32,606 3 comments 0 reactions 0 assignees View on GitHub
act-observability-squad Auto-Assign bug ContainerApp customer-reported Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

## Bug Description
I am building a containerapp using `az containerapp compose create`. My compose file's `environment` section declares several variables that are to be read in from environment variables, many of which have default values. Rather than using the default value for unset environment variables, the command uses the literal string of the variable reference as the value.

## Example
Say this is the compose file:
```yml
environment:
VAR_A: ${VAR_A}
VAR_B: ${VAR_B:-foo}
VAR_C: ${VAR_C:-bar}
```

And my locally set environment variables are:
```bash
VAR_A=hello
VAR_B=world
# VAR_C intentionally left un-set
```

Azure will read my environment variables as:
```json
"env": [
{
"name": "VAR_A",
"value": "hello"
},
{
"name": "VAR_B",
"value": "world"
},
{
"name": "VAR_C",
"value": "${VAR_C:-bar}" // BUG: This should be "bar" since VAR_C was not set
},
]
```

### Related command

`az containerapp compose create`

### Errors

Please see description

### Issue script & Debug output

Please see description.

### Expected behavior

Default values for un-declared env variables referenced in the compose file should be interpreted correctly.

### Environment Summary

azure-cli 2.81.0
containerapp extension 1.3.0b1

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.