Skip to content

Commit 1e26cf1

Browse files
Expose sslMode contract and align Azure TLS behavior for mySqlDatabases/postgreSqlDatabases
Co-authored-by: nellshamrell <813007+nellshamrell@users.noreply.github.com>
1 parent 484a408 commit 1e26cf1

10 files changed

Lines changed: 42 additions & 5 deletions

File tree

Data/mySqlDatabases/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Developer documentation is embedded in the resource type definition YAML file an
1818
| `version` | string (`5.7`, `8.0`, `8.4`) | Optional | The major MySQL server version. Defaults to `8.4`. |
1919
| `host` | string | Read only | The host name used to connect to the database. Set from the Recipe module's output. |
2020
| `port` | integer | Read only | The port number used to connect to the database. Set from the Recipe module's output. |
21+
| `sslMode` | string (`required`, `disabled`) | Read only | Whether the database requires an encrypted (TLS/SSL) connection. Every Recipe in this repository currently sets this to `disabled`; the Azure Recipe explicitly disables the flexible server's `require_secure_transport` setting to match. |
2122

2223
## Recipe Packs
2324

@@ -29,4 +30,4 @@ Recipes for this resource type are provided through the platform Recipe Packs at
2930

3031
## Using the resource type
3132

32-
Add a `mySqlDatabases` resource to your application and connect a container to it. Radius injects the database's connection properties into the container as environment variables named `CONNECTION_<CONNECTION-NAME>_<PROPERTY-NAME>` (for example `CONNECTION_MYSQLDB_HOST`, `CONNECTION_MYSQLDB_PORT`, and `CONNECTION_MYSQLDB_DATABASE`). See [`test/app.bicep`](test/app.bicep) for a complete example.
33+
Add a `mySqlDatabases` resource to your application and connect a container to it. Radius injects the database's connection properties into the container as environment variables named `CONNECTION_<CONNECTION-NAME>_<PROPERTY-NAME>` (for example `CONNECTION_MYSQLDB_HOST`, `CONNECTION_MYSQLDB_PORT`, `CONNECTION_MYSQLDB_DATABASE`, and `CONNECTION_MYSQLDB_SSLMODE`). See [`test/app.bicep`](test/app.bicep) for a complete example.

Data/mySqlDatabases/mySqlDatabases.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ types:
5151
- CONNECTION_MYSQLDB_DATABASE
5252
- CONNECTION_MYSQLDB_HOST
5353
- CONNECTION_MYSQLDB_PORT
54+
- CONNECTION_MYSQLDB_SSLMODE
55+
56+
Every Recipe for this Resource Type provisions the database so `sslMode` is `disabled` (no Recipe in this repository requires an encrypted connection), so application definitions that rely on the documented outputs can connect the same way on every platform without adding TLS options to their client. The Azure Recipe explicitly disables the `require_secure_transport` server setting so its behavior matches the Kubernetes and AWS Recipes for this Resource Type.
5457
5558
apiVersions:
5659
'2025-08-01-preview':
@@ -87,4 +90,9 @@ types:
8790
type: integer
8891
description: The port number used to connect to the database. Mapped from the recipe module's output (MySQL flexible server uses 3306).
8992
readOnly: true
93+
sslMode:
94+
type: string
95+
enum: ['required', 'disabled']
96+
description: (Read Only) Whether the database requires an encrypted (TLS/SSL) connection. Mapped from the recipe module's output. `required` means clients must connect over TLS/SSL; `disabled` means the Recipe does not enforce it. Configure your client accordingly rather than assuming a particular transport.
97+
readOnly: true
9098
required: [environment,username,password]

Data/mySqlDatabases/recipes/aws/terraform/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ output "result" {
134134
host = module.db.db_instance_address
135135
port = module.db.db_instance_port
136136
database = local.sanitized_database
137+
sslMode = "disabled"
137138
}
138139
}
139140
}

Data/mySqlDatabases/recipes/kubernetes/bicep/kubernetes-mysql.bicep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ output result object = {
162162
host: '${svc.metadata.name}.${svc.metadata.namespace}.svc.cluster.local'
163163
port: port
164164
database: database
165+
sslMode: 'disabled'
165166
}
166167
secrets: {
167168
password: password

Data/postgreSqlDatabases/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Developer documentation is embedded in the resource type definition YAML file an
1919
| `initSql` | string | Optional | Optional SQL script executed on first initialization to create tables, indexes, and seed data. |
2020
| `host` | string | Read only | The host name used to connect to the database. Set from the Recipe module's output. |
2121
| `port` | integer | Read only | The port number used to connect to the database. Set from the Recipe module's output. |
22+
| `sslMode` | string (`required`, `disabled`) | Read only | Whether the database requires an encrypted (TLS/SSL) connection. Every Recipe in this repository currently sets this to `disabled`; the Azure Recipe explicitly disables the flexible server's `require_secure_transport` setting to match. |
2223

2324
## Recipe Packs
2425

@@ -30,4 +31,4 @@ Recipes for this resource type are provided through the platform Recipe Packs at
3031

3132
## Using the resource type
3233

33-
Add a `postgreSqlDatabases` resource to your application and connect a container to it. Radius injects the database's connection properties into the container as environment variables named `CONNECTION_<CONNECTION-NAME>_<PROPERTY-NAME>` (for example `CONNECTION_POSTGRES_HOST`, `CONNECTION_POSTGRES_PORT`, and `CONNECTION_POSTGRES_DATABASE`). See [`test/app.bicep`](test/app.bicep) for a complete example.
34+
Add a `postgreSqlDatabases` resource to your application and connect a container to it. Radius injects the database's connection properties into the container as environment variables named `CONNECTION_<CONNECTION-NAME>_<PROPERTY-NAME>` (for example `CONNECTION_POSTGRES_HOST`, `CONNECTION_POSTGRES_PORT`, `CONNECTION_POSTGRES_DATABASE`, and `CONNECTION_POSTGRES_SSLMODE`). See [`test/app.bicep`](test/app.bicep) for a complete example.

Data/postgreSqlDatabases/postgreSqlDatabases.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ types:
5151
- CONNECTION_POSTGRESQL_DATABASE
5252
- CONNECTION_POSTGRESQL_HOST
5353
- CONNECTION_POSTGRESQL_PORT
54+
- CONNECTION_POSTGRESQL_SSLMODE
55+
56+
Every Recipe for this Resource Type provisions the database so `sslMode` is `disabled` (no Recipe in this repository requires an encrypted connection), so application definitions that rely on the documented outputs can connect the same way on every platform without adding TLS options to their client. The Azure Recipe explicitly disables the `require_secure_transport` server setting so its behavior matches the Kubernetes Recipe for this Resource Type.
5457

5558
apiVersions:
5659
'2025-08-01-preview':
@@ -90,4 +93,9 @@ types:
9093
type: string
9194
description: The port number used to connect to the database.
9295
readOnly: true
96+
sslMode:
97+
type: string
98+
enum: ['required', 'disabled']
99+
description: (Read Only) Whether the database requires an encrypted (TLS/SSL) connection. Mapped from the recipe module's output. `required` means clients must connect over TLS/SSL; `disabled` means the Recipe does not enforce it. Configure your client accordingly rather than assuming a particular transport.
100+
readOnly: true
93101
required: [environment,username,password]

Data/postgreSqlDatabases/recipes/kubernetes/bicep/kubernetes-postgresql.bicep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ output result object = {
206206
host: '${svc.metadata.name}.${svc.metadata.namespace}.svc.cluster.local'
207207
port: port
208208
database: database
209+
sslMode: 'disabled'
209210
}
210211
secrets: {
211212
password: password

Data/postgreSqlDatabases/recipes/kubernetes/terraform/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ output "result" {
161161
host = "${kubernetes_service.postgres.metadata[0].name}.${kubernetes_service.postgres.metadata[0].namespace}.svc.cluster.local"
162162
port = local.port
163163
database = local.database
164+
sslMode = "disabled"
164165
}
165166
secrets = {
166167
password = local.password

recipe-packs/azure/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ The Azure pack accepts the provider configuration it needs to provision into you
4848
| `routesGatewayNamespace` | Namespace of the Gateway resource for `Radius.Compute/routes`. Defaults to `default`. |
4949
| `containerImagesRegistry` | Registry path (e.g. `ghcr.io/my-org`) that `Radius.Compute/containerImages` pushes built images to. |
5050
| `containerImagesRegistrySecretName` | Name of the Kubernetes Secret holding registry credentials for `Radius.Compute/containerImages`. Optional; leave empty for an unauthenticated registry. |
51-
| `postgreSqlServerConfigurations` | Server parameters forwarded verbatim to the AVM PostgreSQL flexible server `configurations` array for `Radius.Data/postgreSqlDatabases`, using the AVM item shape `{ name, source, value }`. Most commonly used to allow-list extensions via `azure.extensions` — for example `[{ name: 'azure.extensions', source: 'user-override', value: 'vector' }]` to enable pgvector. See [Extensions and modules by name in Azure Database for PostgreSQL flexible server](https://learn.microsoft.com/en-us/azure/postgresql/extensions/concepts-extensions-versions) for the supported extension names. Optional; defaults to an empty array (no extra server configuration). |
51+
| `postgreSqlServerConfigurations` | Server parameters forwarded verbatim to the AVM PostgreSQL flexible server `configurations` array for `Radius.Data/postgreSqlDatabases`, using the AVM item shape `{ name, source, value }`. Defaults to `[{ name: 'require_secure_transport', value: 'OFF' }]` so `Radius.Data/postgreSqlDatabases` behaves the same on Azure as it does with the Kubernetes Recipe for this Resource Type (see [issue #301](https://github.com/radius-project/resource-types-contrib/issues/301)). Also commonly used to allow-list extensions via `azure.extensions` — for example `[{ name: 'require_secure_transport', value: 'OFF' }, { name: 'azure.extensions', source: 'user-override', value: 'vector' }]` to enable pgvector while keeping the default TLS behavior. See [Extensions and modules by name in Azure Database for PostgreSQL flexible server](https://learn.microsoft.com/en-us/azure/postgresql/extensions/concepts-extensions-versions) for the supported extension names. Optional. |
52+
| `mySqlServerConfigurations` | Server parameters forwarded verbatim to the AVM MySQL flexible server `configurations` array for `Radius.Data/mySqlDatabases`, using the AVM item shape `{ name, source, value }`. Defaults to `[{ name: 'require_secure_transport', value: 'OFF' }]` so `Radius.Data/mySqlDatabases` behaves the same on Azure as it does with the Kubernetes and AWS Recipes for this Resource Type (see [issue #301](https://github.com/radius-project/resource-types-contrib/issues/301)). Optional. |
5253

5354
## Deploying
5455

recipe-packs/azure/aks-recipepack.bicep

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,21 @@ param containerImagesRegistry string
2424
@description('Name of the Kubernetes Secret holding registry credentials for Radius.Compute/containerImages. Leave empty for an unauthenticated registry.')
2525
param containerImagesRegistrySecretName string = ''
2626

27-
@description('Server parameters forwarded verbatim to the AVM PostgreSQL flexible server configurations array for Radius.Data/postgreSqlDatabases, using the AVM item shape with name, source, and value fields. Commonly used to allow-list extensions via the azure.extensions parameter (for example to enable pgvector). See recipe-packs/azure/README.md for an example and a link to the supported extensions. Defaults to an empty array (no extra server configuration).')
28-
param postgreSqlServerConfigurations array = []
27+
@description('Server parameters forwarded verbatim to the AVM PostgreSQL flexible server configurations array for Radius.Data/postgreSqlDatabases, using the AVM item shape with name, source, and value fields. Defaults to disabling the `require_secure_transport` server parameter so the Recipe matches the Kubernetes Recipe for this Resource Type, whose `sslMode` output is always `disabled`. Commonly overridden to allow-list extensions via the azure.extensions parameter (for example to enable pgvector) or to re-enable `require_secure_transport`. See recipe-packs/azure/README.md for an example and a link to the supported extensions.')
28+
param postgreSqlServerConfigurations array = [
29+
{
30+
name: 'require_secure_transport'
31+
value: 'OFF'
32+
}
33+
]
34+
35+
@description('Server parameters forwarded verbatim to the AVM MySQL flexible server configurations array for Radius.Data/mySqlDatabases, using the AVM item shape with name, source, and value fields. Defaults to disabling the `require_secure_transport` server parameter so the Recipe matches the Kubernetes and AWS Recipes for this Resource Type, whose `sslMode` output is always `disabled`. Override to re-enable `require_secure_transport` if your application connects over TLS/SSL.')
36+
param mySqlServerConfigurations array = [
37+
{
38+
name: 'require_secure_transport'
39+
value: 'OFF'
40+
}
41+
]
2942

3043
resource recipes 'Radius.Core/recipePacks@2025-08-01-preview' = {
3144
name: 'azure-avm'
@@ -174,6 +187,7 @@ resource recipes 'Radius.Core/recipePacks@2025-08-01-preview' = {
174187
lock: {
175188
kind: 'None'
176189
}
190+
configurations: mySqlServerConfigurations
177191
}
178192
outputs: {
179193
host: 'fqdn'

0 commit comments

Comments
 (0)