Skip to content

Switch to using a Service Principal for Terraform deployments #498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@ No resources.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_azure_client_id"></a> [azure\_client\_id](#input\_azure\_client\_id) | Service Principal Client ID | `string` | n/a | yes |
| <a name="input_azure_client_secret"></a> [azure\_client\_secret](#input\_azure\_client\_secret) | Service Principal Client Secret | `string` | n/a | yes |
| <a name="input_azure_location"></a> [azure\_location](#input\_azure\_location) | Azure location in which to launch resources. | `string` | n/a | yes |
| <a name="input_azure_subscription_id"></a> [azure\_subscription\_id](#input\_azure\_subscription\_id) | Service Principal Subscription ID | `string` | n/a | yes |
| <a name="input_azure_tenant_id"></a> [azure\_tenant\_id](#input\_azure\_tenant\_id) | Service Principal Tenant ID | `string` | n/a | yes |
| <a name="input_cdn_frontdoor_custom_domains"></a> [cdn\_frontdoor\_custom\_domains](#input\_cdn\_frontdoor\_custom\_domains) | Azure CDN Front Door custom domains. If they are within the DNS zone (optionally created), the Validation TXT records and ALIAS/CNAME records will be created | `list(string)` | n/a | yes |
| <a name="input_cdn_frontdoor_enable_rate_limiting"></a> [cdn\_frontdoor\_enable\_rate\_limiting](#input\_cdn\_frontdoor\_enable\_rate\_limiting) | Enable CDN Front Door Rate Limiting. This will create a WAF policy, and CDN security policy. For pricing reasons, there will only be one WAF policy created. | `bool` | n/a | yes |
| <a name="input_cdn_frontdoor_forwarding_protocol"></a> [cdn\_frontdoor\_forwarding\_protocol](#input\_cdn\_frontdoor\_forwarding\_protocol) | Azure CDN Front Door forwarding protocol | `string` | `"HttpsOnly"` | no |
Expand Down
4 changes: 3 additions & 1 deletion terraform/backend.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
terraform {
backend "azurerm" {}
backend "azurerm" {
use_azuread_auth = true
}
}
5 changes: 5 additions & 0 deletions terraform/providers.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
provider "azurerm" {
features {}
skip_provider_registration = true
storage_use_azuread = true
client_id = var.azure_client_id
client_secret = var.azure_client_secret
tenant_id = var.azure_tenant_id
subscription_id = var.azure_subscription_id
}

provider "azapi" {
Expand Down
21 changes: 21 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
variable "azure_client_id" {
description = "Service Principal Client ID"
type = string
}

variable "azure_client_secret" {
description = "Service Principal Client Secret"
type = string
sensitive = true
}

variable "azure_tenant_id" {
description = "Service Principal Tenant ID"
type = string
}

variable "azure_subscription_id" {
description = "Service Principal Subscription ID"
type = string
}

variable "environment" {
description = "Environment name. Will be used along with `project_name` as a prefix for all resources."
type = string
Expand Down