Module resource block
resource “azurerm_traffic_manager_profile” “tm_profile” {
for_each = var.traffic_manager_profiles
name = each.value[“name”]
}
Pointed code -
module “TM” {
source = “xyzurl”
location = var.location
traffic_manager_profiles = var.traffic_manager_profiles
}
traffic_manager_profiles = {
tmp1 = {
name = “example-tm”
routing_method = “Priority”
}
I have tried multiple commands, not sure what is the error. I am having difficulties understanding the syntaxes.
terraform import ‘module.TM.azurerm_traffic_manager_profile.tm_profile[“tmp1”]’ “xyzResourceID”
╷
│ Error: Index value required
│
│ on line 1:
│ 1: module.TM.azurerm_traffic_manager_profile.tm_profile[tmp1]
│
│ Index brackets must contain either a literal number or a literal string.
terraform import ‘module.TM.azurerm_traffic_manager_profile.tm_profile.tmp1[“app501-tps-qa-web-cmh-apsvc-tm”]’ “resourceID”
╷
│ Error: Index value required
│
│ on line 1:
│ 1: module.TM.azurerm_traffic_manager_azure_endpoint.tm_endpoint[example-tm]
│
│ Index brackets must contain either a literal number or a literal string.