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

Fixes #1205 - updating bicep files for new container environment vari… #1207

Merged
merged 5 commits into from
Sep 10, 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
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,18 @@ resource frontend 'Applications.Core/containers@2023-10-01-preview' = {
application: app.id
container: {
env: {
BUCKET_NAME: s3.properties.BucketName
AWS_ACCESS_KEY_ID: aws_access_key_id
AWS_SECRET_ACCESS_KEY: aws_secret_access_key
AWS_DEFAULT_REGION: aws_region
BUCKET_NAME: {
value: s3.properties.BucketName
}
AWS_ACCESS_KEY_ID: {
value: aws_access_key_id
}
AWS_SECRET_ACCESS_KEY: {
value: aws_secret_access_key
}
AWS_DEFAULT_REGION: {
value: aws_region
}
}
image: 'ghcr.io/radius-project/samples/aws:latest'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,18 @@ resource frontend 'Applications.Core/containers@2023-10-01-preview' = {
application: app.id
container: {
env: {
BUCKET_NAME: s3.properties.BucketName
AWS_ACCESS_KEY_ID: aws_access_key_id
AWS_SECRET_ACCESS_KEY: aws_secret_access_key
AWS_DEFAULT_REGION: aws_region
BUCKET_NAME: {
value: s3.properties.BucketName
}
AWS_ACCESS_KEY_ID: {
value: aws_access_key_id
}
AWS_SECRET_ACCESS_KEY: {
value: aws_secret_access_key
}
AWS_DEFAULT_REGION: {
value: aws_region
}
}
image: 'ghcr.io/radius-project/samples/aws:latest'
}
Expand Down
16 changes: 12 additions & 4 deletions docs/content/guides/author-apps/aws/overview/snippets/aws.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,18 @@ resource frontend 'Applications.Core/containers@2023-10-01-preview' = {
application: app.id
container: {
env: {
BUCKET_NAME: s3.properties.BucketName
AWS_ACCESS_KEY_ID: aws_access_key_id
AWS_SECRET_ACCESS_KEY: aws_secret_access_key
AWS_DEFAULT_REGION: aws_region
BUCKET_NAME: {
value: s3.properties.BucketName
}
AWS_ACCESS_KEY_ID: {
value: aws_access_key_id
}
AWS_SECRET_ACCESS_KEY: {
value: aws_secret_access_key
}
AWS_DEFAULT_REGION: {
value: aws_region
}
}
image: 'ghcr.io/radius-project/samples/aws:latest'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,15 @@ resource container 'Applications.Core/containers@2023-10-01-preview' = {
container: {
image: 'ghcr.io/azure/azure-workload-identity/msal-go:latest'
env: {
KEYVAULT_NAME: keyvault.name
KEYVAULT_URL: keyvault.properties.vaultUri
SECRET_NAME: 'mysecret'
KEYVAULT_NAME: {
value: keyvault.name
}
KEYVAULT_URL: {
value: keyvault.properties.vaultUri
}
SECRET_NAME: {
value: 'mysecret'
}
}
}
connections: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ resource container 'Applications.Core/containers@2023-10-01-preview' = {
container: {
image: 'myimage'
env: {
REDIS_HOST: cache.properties.hostName
REDIS_HOST: {
value: cache.properties.hostName
}
}
}
connections: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,18 @@ resource demo 'Applications.Core/containers@2023-10-01-preview' = {
container: {
image: 'ghcr.io/radius-project/samples/demo:latest'
env: {
POSTGRESQL_HOST: extender.properties.host
POSTGRESQL_PORT: extender.properties.port
POSTGRESQL_USERNAME: extender.properties.username
POSTGRESQL_PASSWORD: extender.listSecrets().password
POSTGRESQL_HOST: {
value: extender.properties.host
}
POSTGRESQL_PORT: {
value: extender.properties.port
}
POSTGRESQL_USERNAME: {
value: extender.properties.username
}
POSTGRESQL_PASSWORD: {
value: extender.listSecrets().password
}
}
ports: {
web: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ resource container 'Applications.Core/containers@2023-10-01-preview' = {
image: 'myimage'
env: {
// Option 1: Manually set component name as an environment variable
DAPR_COMPONENTNAME: statestore.name
DAPR_COMPONENTNAME: {
value: statestore.name
}
}
}
connections: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ resource frontend 'Applications.Core/containers@2023-10-01-preview' = {
image: 'frontend:latest'
env: {
// Configures the appID of the backend service.
CONNECTION_BACKEND_APPID: 'backend'
CONNECTION_BACKEND_APPID: {
value: 'backend'
}
}
}
extensions: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ resource demo 'Applications.Core/containers@2023-10-01-preview' = {
}
}
env: {
SECRET: base64ToString(secret.data['my-secret-key'])
SECRET: {
value: base64ToString(secret.data['my-secret-key'])
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ resource container 'Applications.Core/containers@2023-10-01-preview' = {
container: {
image: 'nginx:latest'
env: {
SECRET: base64ToString(secret.data.key)
SECRET: {
value: base64ToString(secret.data.key)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ resource container 'Applications.Core/containers@2023-10-01-preview' = {
image: 'ghcr.io/radius-project/samples/demo:latest'
env: {
// Manually access Redis connection information
REDIS_CONNECTION: redis.listSecrets().connectionString
REDIS_CONNECTION: {
value: redis.listSecrets().connectionString
}
}
ports: {
web: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ weight: 300
| Key | Required | Description | Example |
|------|:--------:|-------------|---------|
| image | y | The registry and image to download and run in your container. Follows the format `<registry-hostname>:<port>/<image-name>:<tag>` where registry hostname is optional and defaults to the Docker public registry, port is optional and defaults to 443, tag is optional and defaults to `latest`.| `ghcr.io/USERNAME/myimage:latest`
| env | n | A list of environment variables to be set for the container. | `'ENV_VAR': 'value'`
| env | n | A list of environment variables to be set for the container. Environment variables can either be of `value` or a reference to a Application.Core/SecretStore resource id in the format `valueFrom`. | `'ENV_VAR': { value: 'value' }` or `'ENV_VAR': { valueFrom: { secretRef: { source: secret.id key: 'SECRET_KEY' } } }`
| command | n | Entrypoint array. Overrides the container image's ENTRYPOINT. | `['/bin/sh']`
| args | n | Arguments to the entrypoint. Overrides the container image's CMD. | `['-c', 'while true; do echo hello; sleep 10;done']`
| imagePullPolicy | n | How to pull images. Defaults to the runtime's default behavior. For Kubernetes behavior refer to https://kubernetes.io/docs/concepts/containers/images/#required-image-pull | `'Always'`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ resource frontend 'Applications.Core/containers@2023-10-01-preview' = {
container: {
image: 'registry/container:tag'
env:{
DEPLOYMENT_ENV: 'prod'
DB_CONNECTION: db.listSecrets().connectionString
DEPLOYMENT_ENV: {
value: 'prod'
}
DB_CONNECTION: {
value: db.listSecrets().connectionString
}
}
ports: {
http: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,15 @@ resource publisher 'Applications.Core/containers@2023-10-01-preview' = {
container: {
image: 'ghcr.io/radius-project/magpiego:latest'
env: {
TWILIO_NUMBER: twilio.properties.fromNumber
TWILIO_SID: twilio.listSecrets().accountSid
TWILIO_ACCOUNT: twilio.listSecrets().authToken
TWILIO_NUMBER: {
value: twilio.properties.fromNumber
}
TWILIO_SID: {
value: twilio.listSecrets().accountSid
}
TWILIO_ACCOUNT: {
value: twilio.listSecrets().authToken
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ resource publisher 'Applications.Core/containers@2023-10-01-preview' = {
container: {
image: 'ghcr.io/radius-project/magpiego:latest'
env: {
TWILIO_NUMBER: twilio.properties.fromNumber
TWILIO_SID: twilio.listSecrets().accountSid
TWILIO_ACCOUNT: twilio.listSecrets().authToken
TWILIO_NUMBER: {
value: twilio.properties.fromNumber
}
TWILIO_SID: {
value: twilio.listSecrets().accountSid
}
TWILIO_ACCOUNT: {
value: twilio.listSecrets().authToken
}
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion docs/content/tutorials/new-app/snippets/2-app-mongo.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ resource demo 'Applications.Core/containers@2023-10-01-preview' = {
container: {
image: 'ghcr.io/radius-project/samples/tutorial/demo:edge'
env: {
FOO: 'bar'
FOO: {
value: 'bar'
}
}
ports: {
web: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ resource demo 'Applications.Core/containers@2023-10-01-preview' = {
container: {
image: 'ghcr.io/radius-project/samples/tutorial/demo:edge'
env: {
FOO: 'bar'
FOO: {
value: 'bar'
}
}
ports: {
web: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ resource demo 'Applications.Core/containers@2023-10-01-preview' = {
container: {
image: 'ghcr.io/radius-project/samples/tutorial/demo:edge'
env: {
FOO: 'bar'
FOO: {
value: 'bar'
}
}
ports: {
web: {
Expand Down
8 changes: 6 additions & 2 deletions docs/content/tutorials/tutorial-dapr/snippets/dapr.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,13 @@ resource frontend 'Applications.Core/containers@2023-10-01-preview' = {
image: 'ghcr.io/radius-project/samples/dapr-frontend:latest'
env: {
// An environment variable to tell the frontend container where to find the backend
CONNECTION_BACKEND_APPID: 'backend'
CONNECTION_BACKEND_APPID: {
value: 'backend'
}
// An environment variable to override the default port that .NET Core listens on
ASPNETCORE_URLS: 'http://*:8080'
ASPNETCORE_URLS: {
value: 'http://*:8080'
}
}
// The frontend container exposes port 8080, which is used to serve the UI
ports: {
Expand Down
16 changes: 12 additions & 4 deletions holding-pen/reference-apps/aws-rds/snippets/app.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,18 @@ resource wordpress 'Applications.Core/containers@2023-10-01-preview' = {
}
}
env: {
WORDPRESS_DB_HOST: '${db.properties.Endpoint.Address}:${db.properties.Endpoint.Port}'
WORDPRESS_DB_USER: databaseUsername
WORDPRESS_DB_PASSWORD: databasePassword
WORDPRESS_DB_NAME: databaseName
WORDPRESS_DB_HOST: {
value: '${db.properties.Endpoint.Address}:${db.properties.Endpoint.Port}'
}
WORDPRESS_DB_USER: {
value: databaseUsername
}
WORDPRESS_DB_PASSWORD: {
value: databasePassword
}
WORDPRESS_DB_NAME: {
value: databaseName
}
}
}
}
Expand Down
16 changes: 12 additions & 4 deletions holding-pen/reference-apps/aws-sqs/snippets/app.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ resource producer 'Applications.Core/containers@2023-10-01-preview' = {
container: {
env: union(
{
SQS_QUEUE_URL: queue.properties.QueueUrl
HTTP_SERVER_PORT: '3000'
SQS_QUEUE_URL: {
value: queue.properties.QueueUrl
}
HTTP_SERVER_PORT: {
value: '3000'
}
},
aws_credential
)
Expand All @@ -56,8 +60,12 @@ resource consumer 'Applications.Core/containers@2023-10-01-preview' = {
container: {
env: union(
{
SQS_QUEUE_URL: queue.properties.QueueUrl
HTTP_SERVER_PORT: '4000'
SQS_QUEUE_URL: {
value: queue.properties.QueueUrl
}
HTTP_SERVER_PORT: {
value: '4000'
}
},
aws_credential
)
Expand Down
Loading