Skip to content

Commit

Permalink
Add envSecrets block to HowTo Custom Provider tutorial (#1166)
Browse files Browse the repository at this point in the history
* adding envSecrets

* updated per suggestion
  • Loading branch information
lakshmimsft authored and sk593 committed Aug 7, 2024
1 parent 29ed1c6 commit c2279d2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
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'
}
}
}
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

0 comments on commit c2279d2

Please sign in to comment.