From e25cfce131145d07bcc8ed59d2410a196aefa468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Kurzyniec?= Date: Wed, 8 Mar 2023 11:22:46 +0100 Subject: [PATCH 1/2] fixed index.md --- docs/index.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/index.md b/docs/index.md index 26fcad0..b88ae3d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -11,7 +11,9 @@ The provider can be used to configure objects in Microsoft SQL Server and Azure ## Authentication methods ### SQL auth + Provider username and password, using `sql_auth` field: + ```terraform provider "mssql" { hostname = "localhost" @@ -25,11 +27,13 @@ provider "mssql" { ``` ### Azure AD + In case of Azure SQL connections, Azure Active Directory auth tokens can be used to authenticate. -
#### Service Principal + Provide client ID (a.k.a. application ID), secret and tenant ID, using `azure_auth` field: + ```terraform provider "mssql" { hostname = "example.database.windows.net" @@ -43,20 +47,22 @@ provider "mssql" { } ``` -
#### Default chained credentials + When `azure_auth` value is set to empty object (`{}`), the provider uses chained credentials built from `EnvironmentCredential` -> `ManagedIdentityCredential` -> `AzureCLICredential`. + See [DefaultAzureCredential docs](https://github.com/Azure/azure-sdk-for-go/wiki/Set-up-Your-Environment-for-Authentication#configure-defaultazurecredential) for details. -
#### Environment variables + When `azure_auth` value is set to empty object (`{}`) and following environment variables are set, the env variable values will be used for authentication, taking precedence over `DefaultAzureCredential`. + - `ARM_CLIENT_ID` - `ARM_CLIENT_SECRET` - `ARM_TENANT_ID` -
Example: + ```terraform provider "mssql" { hostname = "example.database.windows.net" @@ -66,6 +72,7 @@ provider "mssql" { ``` ## Computed connection provider configuration + Provider can be used, with certain limitations, with computed provider configuration. For example, provider's `hostname` can be sourced from `azurerm_mssql_server.fully_qualified_domain_name`. As shown in this [Azure SQL example](https://github.com/PGSSoft/terraform-provider-mssql/tree/main/examples/provider/azure_sql.tf) ~> **Warning** When connection details are computed and not known during plan execution (e.g. SQL Server resource returning FQDN is planned to be recreated), the state cannot contain any previously created `mssql_*` resources. In such case error will be reported, as the provider does not have enough information to generate correct plan. From 03496bd61c2cde846e80989e6f86dfb0f4dfa537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Kurzyniec?= Date: Fri, 10 Mar 2023 16:36:55 +0100 Subject: [PATCH 2/2] adjusted index.md.tmpl --- docs/index.md | 2 +- templates/index.md.tmpl | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/docs/index.md b/docs/index.md index b88ae3d..1e68459 100644 --- a/docs/index.md +++ b/docs/index.md @@ -103,4 +103,4 @@ Optional: Required: - `password` (String, Sensitive) Password for SQL authentication. -- `username` (String) User name for SQL authentication. \ No newline at end of file +- `username` (String) User name for SQL authentication. diff --git a/templates/index.md.tmpl b/templates/index.md.tmpl index 3ffb866..754be84 100644 --- a/templates/index.md.tmpl +++ b/templates/index.md.tmpl @@ -11,36 +11,43 @@ The provider can be used to configure objects in Microsoft SQL Server and Azure ## Authentication methods ### SQL auth + Provider username and password, using `sql_auth` field: + {{tffile "examples/provider/sql.tf"}} ### Azure AD + In case of Azure SQL connections, Azure Active Directory auth tokens can be used to authenticate. -
#### Service Principal + Provide client ID (a.k.a. application ID), secret and tenant ID, using `azure_auth` field: + {{tffile "examples/provider/aad_sp.tf"}} -
#### Default chained credentials + When `azure_auth` value is set to empty object (`{}`), the provider uses chained credentials built from `EnvironmentCredential` -> `ManagedIdentityCredential` -> `AzureCLICredential`. + See [DefaultAzureCredential docs](https://github.com/Azure/azure-sdk-for-go/wiki/Set-up-Your-Environment-for-Authentication#configure-defaultazurecredential) for details. -
#### Environment variables + When `azure_auth` value is set to empty object (`{}`) and following environment variables are set, the env variable values will be used for authentication, taking precedence over `DefaultAzureCredential`. + - `ARM_CLIENT_ID` - `ARM_CLIENT_SECRET` - `ARM_TENANT_ID` -
Example: + {{tffile "examples/provider/aad_default.tf"}} ## Computed connection provider configuration + Provider can be used, with certain limitations, with computed provider configuration. For example, provider's `hostname` can be sourced from `azurerm_mssql_server.fully_qualified_domain_name`. As shown in this [Azure SQL example](https://github.com/PGSSoft/terraform-provider-mssql/tree/main/examples/provider/azure_sql.tf) ~> **Warning** When connection details are computed and not known during plan execution (e.g. SQL Server resource returning FQDN is planned to be recreated), the state cannot contain any previously created `mssql_*` resources. In such case error will be reported, as the provider does not have enough information to generate correct plan. -{{ .SchemaMarkdown | trimspace }} \ No newline at end of file +{{ .SchemaMarkdown | trimspace }}