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

Add envSecrets block to HowTo Custom Provider tutorial #1166

Merged
merged 2 commits into from
Jul 26, 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 @@ -43,7 +43,7 @@ Create a Bicep file `env.bicep` with the secretStore resource:

`recipeConfig/terraform/providers` allows you to setup configurations for one or multiple Terraform Providers. For more information refer to the [Radius Environment schema]({{< ref environment-schema >}}) page.

In your `env.bicep` file add an Environment resource, along with Recipe configuration which leverages properties from the previously defined secret store. In this example you're also passing in `host` as an environment variable to highlight use cases where, depending on provider configuration requirements, users can pass environment variables to the Terraform recipes runtime.
In your `env.bicep` file add an Environment resource, along with Recipe configuration which leverages properties from the previously defined secret store. In this example you're also passing in `host` and `port` as environment variables to highlight use cases where, depending on provider configuration requirements, users can pass environment variables as plain text and as secret values in `envSecrets` block to the Terraform recipes runtime.

{{< rad file="snippets/env.bicep" embed=true marker="//ENV" >}}

Expand All @@ -57,7 +57,7 @@ Create a Terraform recipe which deploys a PostgreSQL database instance using cus

Update your Environment with the Terraform Recipe.

{{< rad file="snippets/env-complete.bicep" embed=true marker="//ENV" markdownConfig="{linenos=table,hl_lines=[\"32-40\"],linenostart=30,lineNos=false}" >}}
{{< rad file="snippets/env-complete.bicep" embed=true marker="//ENV" markdownConfig="{linenos=table,hl_lines=[\"37-45\"],linenostart=30,lineNos=false}" >}}

## Step 5: Deploy your Radius Environment

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ resource pgsSecretStore 'Applications.Core/secretStores@2023-10-01-preview' = {
password: {
value: password
}
host: {
value: 'my-postgres-host'
}
}
}
}
Expand All @@ -40,7 +43,6 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = {
providers: {
postgresql: [ {
sslmode: 'disable'
port: 5432
secrets: {
username: {
source: pgsSecretStore.id
Expand All @@ -55,7 +57,13 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = {
}
}
env: {
PGHOST: 'postgres.corerp-resources-terraform-pg-app.svc.cluster.local'
PGPORT: '5432'
}
envSecrets: {
PGHOST: {
source: pgsSecretStore.id
key: 'host'
willtsai marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
recipes: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ resource pgsSecretStore 'Applications.Core/secretStores@2023-10-01-preview' = {
password: {
value: password
}
host: {
value: 'my-postgres-host'
}
}
}
}
Expand Down Expand Up @@ -55,7 +58,13 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = {
}
}
env: {
PGHOST: 'postgres.corerp-resources-terraform-pg-app.svc.cluster.local'
PGPORT: '5432'
}
envSecrets: {
PGHOST: {
source: pgsSecretStore.id
key: 'host'
}
}
}
}
Expand Down
Loading