Skip to content

Commit

Permalink
Update integration test TF file to use latest version of azurerm prov…
Browse files Browse the repository at this point in the history
…ider closes #504 (#505)
  • Loading branch information
ParthaI authored Jul 19, 2022
1 parent caf997b commit a412af8
Show file tree
Hide file tree
Showing 105 changed files with 167 additions and 204 deletions.
2 changes: 1 addition & 1 deletion azure-test/tests/azure_api_management/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ terraform {

provider "azurerm" {
# Cannot be passed as a variable
features {}
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

resource "azurerm_resource_group" "named_test_resource" {
Expand Down
2 changes: 1 addition & 1 deletion azure-test/tests/azure_app_configuration/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ terraform {

provider "azurerm" {
# Cannot be passed as a variable
features {}
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

resource "azurerm_resource_group" "named_test_resource" {
Expand Down
3 changes: 1 addition & 2 deletions azure-test/tests/azure_app_service_environment/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ variable "azure_subscription" {

provider "azurerm" {
# Cannot be passed as a variable
version = "=2.41.0"
features {}
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

data "azurerm_client_config" "current" {}
Expand Down
3 changes: 1 addition & 2 deletions azure-test/tests/azure_app_service_function_app/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ variable "azure_subscription" {

provider "azurerm" {
# Cannot be passed as a variable
version = "=2.41.0"
features {}
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

data "azurerm_client_config" "current" {}
Expand Down
3 changes: 1 addition & 2 deletions azure-test/tests/azure_app_service_plan/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ variable "azure_subscription" {

provider "azurerm" {
# Cannot be passed as a variable
version = "=2.41.0"
features {}
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

data "azurerm_client_config" "current" {}
Expand Down
3 changes: 1 addition & 2 deletions azure-test/tests/azure_app_service_web_app/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ variable "azure_subscription" {

provider "azurerm" {
# Cannot be passed as a variable
version = "=2.41.0"
features {}
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

data "azurerm_client_config" "current" {}
Expand Down
2 changes: 1 addition & 1 deletion azure-test/tests/azure_application_gateway/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ terraform {

provider "azurerm" {
# Cannot be passed as a variable
features {}
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

resource "azurerm_resource_group" "named_test_resource" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ variable "azure_subscription" {

provider "azurerm" {
# Cannot be passed as a variable
version = "=1.36.0"
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

data "azuread_client_config" "current" {}
Expand Down
2 changes: 1 addition & 1 deletion azure-test/tests/azure_batch_account/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ variable "azure_subscription" {

provider "azurerm" {
# Cannot be passed as a variable
version = "=1.36.0"
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

data "azurerm_client_config" "current" {}
Expand Down
2 changes: 1 addition & 1 deletion azure-test/tests/azure_cognitive_account/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ terraform {

# Configure the Microsoft Azure Provider
provider "azurerm" {
features {}
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

resource "azurerm_resource_group" "named_test_resource" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"platform_update_domain_count": 5,
"region": "eastus",
"resource_group": "{{resourceName}}",
"sku_name": "Classic",
"subscription_id": "{{ output.subscription_id.value }}",
"type": "Microsoft.Compute/availabilitySets"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
select name, id, type, platform_update_domain_count, platform_fault_domain_count, sku_name, region, resource_group, subscription_id
select name, id, type, platform_update_domain_count, platform_fault_domain_count, region, resource_group, subscription_id
from azure.azure_compute_availability_set
where name = '{{resourceName}}' and resource_group = '{{resourceName}}'
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"platform_update_domain_count": 5,
"region": "eastus",
"resource_group": "{{resourceName}}",
"sku_name": "Classic",
"subscription_id": "{{ output.subscription_id.value }}",
"type": "Microsoft.Compute/availabilitySets"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
select name, id, type, platform_update_domain_count, platform_fault_domain_count, sku_name, region, resource_group, subscription_id
select name, id, type, platform_update_domain_count, platform_fault_domain_count, region, resource_group, subscription_id
from azure.azure_compute_availability_set
where name = '{{resourceName}}' and resource_group = '{{resourceName}}'
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ variable "azure_subscription" {

provider "azurerm" {
# Cannot be passed as a variable
version = "=1.36.0"
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

data "azurerm_client_config" "current" {}
Expand Down
2 changes: 1 addition & 1 deletion azure-test/tests/azure_compute_disk/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ variable "azure_subscription" {

provider "azurerm" {
# Cannot be passed as a variable
version = "=1.36.0"
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

data "azurerm_client_config" "current" {}
Expand Down
2 changes: 1 addition & 1 deletion azure-test/tests/azure_compute_disk_access/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ variable "azure_subscription" {

provider "azurerm" {
# Cannot be passed as a variable
version = "=1.36.0"
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

data "azurerm_client_config" "current" {}
Expand Down
60 changes: 36 additions & 24 deletions azure-test/tests/azure_compute_disk_encryption_set/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ variable "azure_subscription" {

provider "azurerm" {
# Cannot be passed as a variable
version = "=2.41.0"
features {}
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

data "azurerm_client_config" "current" {}
Expand All @@ -43,11 +42,10 @@ resource "azurerm_key_vault" "named_test_resource" {
location = azurerm_resource_group.named_test_resource.location
resource_group_name = azurerm_resource_group.named_test_resource.name
tenant_id = data.azurerm_client_config.current.tenant_id
sku_name = "premium"
enabled_for_disk_encryption = true
soft_delete_enabled = true
soft_delete_retention_days = 7
purge_protection_enabled = true
sku_name = "standard"
soft_delete_retention_days = 7
}

resource "azurerm_key_vault_key" "named_test_resource" {
Expand All @@ -57,8 +55,9 @@ resource "azurerm_key_vault_key" "named_test_resource" {
key_size = 2048

depends_on = [
azurerm_key_vault_access_policy.local_user,
azurerm_key_vault_access_policy.named_test_resource
]

key_opts = [
"decrypt",
"encrypt",
Expand All @@ -69,33 +68,46 @@ resource "azurerm_key_vault_key" "named_test_resource" {
]
}

resource "azurerm_key_vault_access_policy" "local_user" {
key_vault_id = azurerm_key_vault.named_test_resource.id
tenant_id = data.azurerm_client_config.current.tenant_id
object_id = data.azurerm_client_config.current.object_id
key_permissions = [
"create",
"get",
"list",
"delete",
]
}

resource "azurerm_disk_encryption_set" "named_test_resource" {
name = var.resource_name
location = azurerm_resource_group.named_test_resource.location
name = var.resource_name
resource_group_name = azurerm_resource_group.named_test_resource.name
key_vault_key_id = azurerm_key_vault_key.named_test_resource.id

location = azurerm_resource_group.named_test_resource.location
key_vault_key_id = azurerm_key_vault_key.named_test_resource.id

identity {
type = "SystemAssigned"
}

tags = {
name = var.resource_name
"name" = var.resource_name
}
}

resource "azurerm_key_vault_access_policy" "named_test_resource" {
key_vault_id = azurerm_key_vault.named_test_resource.id

tenant_id = data.azurerm_client_config.current.tenant_id
object_id = data.azurerm_client_config.current.object_id

key_permissions = [
"Create",
"Delete",
"Get",
"Purge",
"Recover",
"Update",
"List",
"Decrypt",
"Sign"
]
}

resource "azurerm_role_assignment" "example-disk" {
scope = azurerm_key_vault.named_test_resource.id
role_definition_name = "Key Vault Crypto Service Encryption User"
principal_id = azurerm_disk_encryption_set.named_test_resource.identity.0.principal_id
}

output "resource_aka" {
value = "azure://${azurerm_disk_encryption_set.named_test_resource.id}"
}
Expand Down
2 changes: 1 addition & 1 deletion azure-test/tests/azure_compute_snapshot/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ variable "azure_subscription" {

provider "azurerm" {
# Cannot be passed as a variable
version = "=1.36.0"
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

data "azurerm_client_config" "current" {}
Expand Down
4 changes: 2 additions & 2 deletions azure-test/tests/azure_compute_virtual_machine/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ variable "azure_subscription" {

provider "azurerm" {
# Cannot be passed as a variable
version = "=1.36.0"
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

data "azurerm_client_config" "current" {}
Expand All @@ -48,7 +48,7 @@ resource "azurerm_subnet" "named_test_resource" {
name = var.resource_name
resource_group_name = azurerm_resource_group.named_test_resource.name
virtual_network_name = azurerm_virtual_network.named_test_resource.name
address_prefix = "10.0.2.0/24"
address_prefixes = ["10.0.2.0/24"]
}

resource "azurerm_network_interface" "named_test_resource" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ variable "azure_subscription" {

provider "azurerm" {
# Cannot be passed as a variable
version = "=1.36.0"
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

data "azurerm_client_config" "current" {}
Expand Down
2 changes: 1 addition & 1 deletion azure-test/tests/azure_container_registry/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ variable "azure_subscription" {

provider "azurerm" {
# Cannot be passed as a variable
version = "=1.36.0"
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

data "azurerm_client_config" "current" {}
Expand Down
3 changes: 1 addition & 2 deletions azure-test/tests/azure_cosmosdb_account/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ variable "azure_subscription" {

provider "azurerm" {
# Cannot be passed as a variable
version = "=1.36.0"
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

data "azurerm_client_config" "current" {}
Expand Down Expand Up @@ -52,7 +52,6 @@ resource "azurerm_cosmosdb_account" "named_test_resource" {
}

geo_location {
prefix = "turbot-cosmos-db"
location = azurerm_resource_group.named_test_resource.location
failover_priority = 0
}
Expand Down
3 changes: 1 addition & 2 deletions azure-test/tests/azure_cosmosdb_mongo_database/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ variable "azure_subscription" {

provider "azurerm" {
# Cannot be passed as a variable
version = "=2.41.0"
features {}
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

data "azurerm_client_config" "current" {}
Expand Down
3 changes: 1 addition & 2 deletions azure-test/tests/azure_cosmosdb_sql_database/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ variable "azure_subscription" {

provider "azurerm" {
# Cannot be passed as a variable
version = "=2.41.0"
features {}
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

data "azurerm_client_config" "current" {}
Expand Down
2 changes: 1 addition & 1 deletion azure-test/tests/azure_data_factory/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ variable "azure_subscription" {

provider "azurerm" {
# Cannot be passed as a variable
version = "=1.36.0"
environment = var.azure_environment
subscription_id = var.azure_subscription
features {}
}

data "azurerm_client_config" "current" {}
Expand Down
Loading

0 comments on commit a412af8

Please sign in to comment.