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
Copy file name to clipboardExpand all lines: articles/application-gateway/renew-certificates.md
-103Lines changed: 0 additions & 103 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,110 +71,7 @@ az network application-gateway ssl-cert update \
71
71
--cert-password "<password>"
72
72
```
73
73
74
-
### Terraform
75
74
76
-
If you're using Terraform to manage the application gateway, the Azure Terraform Key Vault data source retrieves the complete key vault URI, which includes the version of the secrets. To enable automatic rotation of the certificate to a new version, the secret needs to be without a specific version. In the following Terraform code, the data source **azurerm_key_vault_secret** fetches the Key Vault secret ID and includes the version of the secret in the complete Keyvault URL.
77
-
78
-
```Terraform
79
-
data "azurerm_key_vault_secret" "vault" {
80
-
name = "byte-cloud"
81
-
key_vault_id = "<resource-id-key-vault>"
82
-
}
83
-
```
84
-
85
-
Definitions:
86
-
87
-
| Entry | Description |
88
-
| --- | --- |
89
-
|**data**| Indicates that you are retrieving information from an existing resource rather than creating a new one. |
90
-
|**azurerm_key_vault_secret**| Specifies the type or kind of data source, in this case, it's fetching information about a secret from an Azure Key Vault. |
91
-
|**vault**| The name of this particular instance of the azurerm_key_vault_secret data source. Refer to this name when using the output from this data source in your Terraform configuration. |
92
-
|**name**| The name of the certificate stored in Keyvault. |
93
-
94
-
The data source **azurerm_key_vault_secret** is used within the `**ssl_certificate**` block under the application gateway section.
95
-
96
-
The following Terraform code adds an SSL certificate pointed to the secret version of the certificate:
> * The certificate added to the application gateway is tied to a **secret version**.
134
-
> * Renewing the certificate in **KeyVault** doesn't automatically make the application gateway listener select the updated certificate. To reflect the changes, the certificate in the application gateway must be manually updated.
135
-
136
-
To add versionless keyvault certificates, you can use the Terraform "**replace**" function. By using this function, you can replace the entire KeyVault URL, which includes the secret version, with just the secret name, excluding the version.
137
-
138
-
- Modify the existing "**ssl_certificate**" block under the application gateway block of the Terraform to use the replace function.
- The same data source "**data.azurerm_key_vault_secret.vault.id**" is used here, but the data source is used with the replace function.
164
-
- You can compare the value in the data source “**data.azurerm_key_vault_secret.vault.id**” with regex “/secrets/(.*)/[^/]+/",” and then use /secrets/group1.
165
-
166
-
The Terraform replace function takes three arguments:
167
-
- replace(string, substring, replacement).
168
-
169
-
In this case, **string** is the full URL stored in the data source **data.azurerm_key_vault_secret.vault.id** , substring is **/secrets/(.*)/[^/]+/**, and replacement is **/secrets/$1**.
Add a forward slash “**/**” in Terraform regex, or it will not work. This is because Terraform uses forward slashes as separators in certain syntax constructs to organize resources and data sources hierarchically.
0 commit comments