Skip to content

Commit

Permalink
[Fix] Terraform - Updates for azurerm v4 (#159)
Browse files Browse the repository at this point in the history
* fix: update deprecated route table input

* fix: add sub id as input to azurerm provider

* fix: remove sub_id and add env variable instructions to deployment guide
  • Loading branch information
ibersanoMS authored Nov 13, 2024
1 parent 1407ca0 commit 775b8cf
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 5 deletions.
9 changes: 7 additions & 2 deletions scenarios/aca-internal/terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ az storage container-rm create --storage-account $STORAGE_ACCOUNT_NAME --name $C

As you configured the backend remote state with your live Azure infrastructure resource values, you must also provide them for your deployment.

The table below summurizes the avaialble parameters and the possible values that can be set.
The table below summarizes the available parameters and the possible values that can be set.

| Name | Description | Default | Example(s) |
| :---- | :---------- | :------ | :--------- |
Expand Down Expand Up @@ -148,13 +148,18 @@ Before deploying, you need to decide how you would like to deploy the solution w

### 1. Standalone deployment guide

You can deploy the complete landing zone in a single subscription, by using the [main.tf](main.tf) template file and the accompanying [terraform.tfvars](terraform.tfvars) parameter file. You need first to check and customize the parameter file (parameters are described below) and then decide whether you intend to deploy the simple [Hello World App](modules/05-hello-world-sample-app/README.md) or the more comprehensive, Dapr-enabled [Fine Collection Sample App](sample-apps/java-fine-collection-service/docs/02-container-apps.md). If you intend to deploy the [Fine Collection Sample App](sample-apps/java-fine-collection-service/docs/02-container-apps.md), we reccomend that you set the variable `deployHelloWorldSample` to `false`.
You can deploy the complete landing zone in a single subscription, by using the [main.tf](main.tf) template file and the accompanying [terraform.tfvars](terraform.tfvars) parameter file. You need first to check and customize the parameter file (parameters are described below) and then decide whether you intend to deploy the simple [Hello World App](modules/05-hello-world-sample-app/README.md) or the more comprehensive, Dapr-enabled [Fine Collection Sample App](sample-apps/java-fine-collection-service/docs/02-container-apps.md). If you intend to deploy the [Fine Collection Sample App](sample-apps/java-fine-collection-service/docs/02-container-apps.md), we recommend that you set the variable `deployHelloWorldSample` to `false`.

#### Provide parameters required for deployment
1. Review the available variables with their descriptions and default values in the [variables.tf](./variables.tf) file.
2. Provide any custom values to the defined variables by creating a `terraform.tfvars` file in this [directory](terraform.tfvars)
* [TF Docs: Variable Definitions (.tfvars) Files](https://www.terraform.io/language/values/variables#variable-definitions-tfvars-files)

> [!NOTE]
> If you are using Azure CLI authentication that is not a service principal or OIDC, the [AzureRM provider](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/4.0-upgrade-guide) now requires setting the `subscription_id` in the provider. Running the following command in your Bash terminal before moving on to the next commands.
>
> `export ARM_SUBSCRIPTION_ID=00000000-xxxx-xxxx-xxxx-xxxxxxxxxxxx`
#### Bash shell (i.e. inside WSL2 for windows 11, or any linux-based OS)
``` bash
terraform init `
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

variable "workloadName" {
type = string
validation {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

variable "workloadName" {
type = string
validation {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// ------------------
// PARAMETERS
// ------------------

variable "workloadName" {
type = string
validation {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// ------------------
// PARAMETERS
// ------------------

variable "workloadName" {
type = string
validation {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

variable "tags" {}

variable "helloWorldContainerAppName" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

variable "appGatewayCertificateKeyName" {}

variable "location" {}
Expand Down
1 change: 0 additions & 1 deletion scenarios/aca-internal/terraform/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ terraform {
}
required_version = ">= 1.3.4"

# uncomment if you want to save state file into remote storae account
backend "azurerm" {
}
}
Expand Down
3 changes: 2 additions & 1 deletion scenarios/aca-internal/terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

variable "workloadName" {
type = string
validation {
Expand Down Expand Up @@ -52,7 +53,7 @@ variable "vmAdminPassword" {
variable "vmLinuxSshAuthorizedKeys" {}

variable "vmLinuxAuthenticationType" {
type = string
type = string
default = "password"
validation {
condition = anytrue([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ resource "azurerm_route_table" "rt" {
name = var.routeTableName
resource_group_name = var.resourceGroupName
location = var.location
disable_bgp_route_propagation = true
bgp_route_propagation_enabled = false
tags = var.tags
}

Expand Down

0 comments on commit 775b8cf

Please sign in to comment.