theangrytech-git / ChaosStudioLab

Lab to use with Chaos Studio
0 stars 0 forks source link

Chaos Studio Resources Timeout #1

Open theangrytech-git opened 2 months ago

theangrytech-git commented 2 months ago

Terraform Version 1.9.5

AzureRM Provider Version 3.116.0

Affected Resource(s)/Data Source(s) azurerm_chaos_studio_target, azurerm_chaos_studio_capability

Terraform Configuration Files `


                  CHAOS STUDIO SECTION

              REGISTER AZURE CHAOS PROVIDER

resource "null_resource" "register_chaos_provider" { provisioner "local-exec" { command = "az provider register --namespace Microsoft.Chaos" }

/ Ensure this runs only once by using a trigger/ triggers = { always_run = "${timestamp()}" } }

                        CREATE SERVICE PRINCIPAL

resource "azuread_application" "cs_app" { display_name = "chaos-studio-sp" }

resource "azuread_service_principal" "cs_sp" { client_id = azuread_application.cs_app.client_id use_existing = true }

resource "azuread_service_principal_password" "cs_sp_pw" { service_principal_id = azuread_service_principal.cs_sp.id end_date = local.expiration_date }

output "client_id" { value = azuread_service_principal.cs_sp.client_id } output "client_secret" { value = azuread_service_principal_password.cs_sp_pw.value sensitive = true }

                       SERVICE PRINCIPAL ROLES

resource "azurerm_role_assignment" "chaos_contributor_sp" { principal_id = azuread_service_principal.cs_sp.id role_definition_name = "Chaos Contributor" scope = azurerm_resource_group.uks.id

scope = data.azurerm_subscription.primary.id

}

             ADD AGENT-BASED TARGETS TO CHAOS STUDIO

resource "azurerm_chaos_studio_target" "tgt-uks_vmsa" { count = var.servercounta location = azurerm_resource_group.uks.location target_resource_id = azurerm_windows_virtual_machine.uks-vmsa[count.index].id target_type = "Microsoft-Agent" }

             ADD SERVICE-BASED TARGETS TO CHAOS STUDIO

resource "azurerm_chaos_studio_target" "tgt-key_vault_target" { location = azurerm_resource_group.uks.location target_resource_id = azurerm_key_vault.kv1.id target_type = "Microsoft-Service" }

resource "azurerm_chaos_studio_target" "tgt-app_service_target" { location = azurerm_resource_group.uks.location target_resource_id = azurerm_service_plan.uks-asp.id target_type = "Microsoft-Service" }

                 ADD CHAOS STUDIO CAPABILITIES

resource "azurerm_chaos_studio_capability" "cap_net_disconnect" { count = var.servercounta capability_type = "NetworkDisconnect-1.1" chaos_studio_target_id = azurerm_chaos_studio_target.tgt-uks_vmsa[count.index].id }

resource "azurerm_chaos_studio_capability" "cap_cpupressure" { count = var.servercounta capability_type = "CPUPressure-1.0" chaos_studio_target_id = azurerm_chaos_studio_target.tgt-uks_vmsa[count.index].id }


`

Debug Output `Error: retrieving list of chaos target types: loading results: Get "": context deadline exceeded

with azurerm_chaos_studio_target.tgt-uks_vmsa[0], on main.tf line 1453, in resource "azurerm_chaos_studio_target" "tgt-uks_vmsa": 1453: resource "azurerm_chaos_studio_target" "tgt-uks_vmsa" {

retrieving list of chaos target types: loading results: Get "": context deadline exceeded

Error: retrieving list of chaos target types: loading results: Get "": context deadline exceeded

with azurerm_chaos_studio_target.tgt-key_vault_target, on main.tf line 1475, in resource "azurerm_chaos_studio_target" "tgt-key_vault_target": 1475: resource "azurerm_chaos_studio_target" "tgt-key_vault_target" {

retrieving list of chaos target types: loading results: Get "": context deadline exceeded

Error: retrieving list of chaos target types: loading results: Get "": context deadline exceeded

with azurerm_chaos_studio_target.tgt-app_service_target, on main.tf line 1481, in resource "azurerm_chaos_studio_target" "tgt-app_service_target": 1481: resource "azurerm_chaos_studio_target" "tgt-app_service_target" {

retrieving list of chaos target types: loading results: Get "": context deadline exceeded`

Expected Behaviour The Chaos Studio target and capability azurerm resources should be created as the Microsoft.Chaos resource provider is registered in the target subscription and the same resources can be created with the same configuration through azapi provider.

Actual Behaviour Terraform apply timeouts after 30 minutes saying it couldn't get the list of chaos capability types/target types.

Steps to Reproduce terraform apply

Important Factoids No response

References I've attached a tfapplyCS2.txt file to show the apply. tfapplyCS2.txt

theangrytech-git commented 2 months ago

https://github.com/hashicorp/terraform-provider-azurerm/issues/27452

theangrytech-git commented 2 months ago

Currently being looked at here: https://github.com/hashicorp/terraform-provider-azurerm/issues/27452#issue-2539200798

Keeping open until this is resolved.