You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Configure a custom Terraform Provider and use it in a Terraform recipe.
15
-
In this example we're going to configure a PostgreSQL Terraform provider in a Radius environment and deploy a recipe.
16
-
Ref: [Documentation for cyrilgdn/postgresql provider](https://registry.terraform.io/providers/cyrilgdn/postgresql/latest/docs)
14
+
- Configure a custom [Terraform provider](https://registry.terraform.io/browse/providers) in a Radius environment.
15
+
- Configure credentials to authenticate into the Terraform provider.
16
+
- Consume the terraform modules from a custom Terraform provider and use it in a Terraform recipe.
17
+
18
+
In this example we're going to configure a [PostgreSQL Terraform provider](https://registry.terraform.io/providers/cyrilgdn/postgresql/latest/docs) in a Radius environment and deploy a recipe.
17
19
18
20
### Prerequisites
19
21
@@ -23,58 +25,58 @@ Before you get started, you'll need to make sure you have the following tools an
## Step 1: Define a secretStore resource and store any sensitive information needed for the custom provider.
30
+
## Step 1: Define a secretStore resource for the custom provider
29
31
30
32
Configure a [Radius Secret Store]({{< ref "/guides/author-apps/secrets/overview" >}}) with any sensitive information needed as input configuration for the custom Terraform Provider. Define the namespace for the cluster that will contain your [Kubernetes Secret](https://kubernetes.io/docs/concepts/configuration/secret/) with the `resource` property.
31
33
32
34
> While this example shows a Radius-managed secret store where Radius creates the underlying secrets infrastructure, you can also bring your own existing secrets. Refer to the [secrets documentation]({{< ref "/guides/author-apps/secrets/overview" >}}) for more information.
33
35
34
-
Create a Bicep file `env.bicep`, import Radius, and define your resource:
36
+
Create a Bicep file `env.bicep` with the secretStore resource:
35
37
36
38
{{< rad file="snippets/env.bicep" embed=true marker="//SECRETSTORE" >}}
37
39
38
-
> In this example, we're creating a secret with keys `username` and `password` as sensitive inputs required by the Terraform Provider `cyrilgdn/postgresql`.
40
+
> In this example, we're creating a secret with keys `username` and `password` as sensitive data required to authenticate into the Terraform Provider `cyrilgdn/postgresql`.
`recipeConfig/terraform/providers` allows the user to setup configurations for one or multiple Terraform Providers. For more information refer to the [Radius Environment schema]({{< ref environment-schema >}}) page.
44
+
`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.
43
45
44
-
In your `env.bicep` file add an Environment resource, along with Recipe configuration which leverages the previously defined secret store for certain configuration fields.
45
-
In this example we'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 runtime.
46
+
In your `env.bicep` file add an Environment resource, along with Recipe configuration which leverages properties from the previously defined secret store.
47
+
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 runtime.
46
48
47
49
{{< rad file="snippets/env.bicep" embed=true marker="//ENV" >}}
48
50
49
-
## Step 3: Define Terraform Recipe
51
+
## Step 3: Define a Terraform Recipe
50
52
51
53
Create a Terraform recipe which deploys a postgreSQL database instance using custom Terraform provider `cyrilgdn/postgresql`
52
54
53
55
{{< rad file="snippets/postgres.tf" embed=true marker="//ENV" >}}
54
56
55
-
## Step 4: Add a Terraform Recipe to Env
57
+
## Step 4: Add a Terraform Recipe to the environment
56
58
57
-
Update your Environment with a Terraform Recipe.
59
+
Update your Environment with the Terraform Recipe.
58
60
59
61
{{< rad file="snippets/env-complete.bicep" embed=true marker="//ENV" markdownConfig="{linenos=table,hl_lines=[\"22-30\"],linenostart=30,lineNos=false}" >}}
60
62
61
63
## Step 5: Deploy your Radius Environment
62
64
63
65
Deploy your new Radius Environment:
64
66
65
-
```
67
+
```bash
66
68
rad deploy ./env.bicep -p username=****** -p password=******
67
69
```
68
70
69
71
## Done
70
72
71
-
Your Radius Environment is now ready to deploy your Radius Recipes that utilize resources associated with configured custom providers. For more information on Radius Recipes visit the [Recipes overview page]({{< ref "/guides/recipes/overview" >}}).
73
+
Your Radius Environment is now configured with a custom Terraform provider which you can use to deploy Radius Terraform recipes. For more information on Radius Recipes visit the [Recipes overview page]({{< ref "/guides/recipes/overview" >}}).
72
74
73
75
## Cleanup
74
76
75
-
You can delete a Radius Environment by running the following command:
77
+
You can delete the Radius Environment by running the following command:
0 commit comments