Hello,
Is it possible to create ressources in specific order ?
I am using a YAML file with content in list :
cloudlogs_view:
- name: "1_exemple-view"
query: "severity=\"Warning\""
- name: "2_exemple-view"
query: "severity=\"Critical\""
- name: "3_exemple-view"
query: "severity=\"Warning\""
With the Terraform config :
locals {
input_cloudlogs_view = yamldecode(file(var.config_cloudlogs_view)).cloudlogs_view
}
resource "ibm_logs_view" "logs_view_instance_yaml" {
instance_id = var.instance_id
region = var.region
for_each = { for x in local.input_cloudlogs_view : x.name => x }
name = each.value.name
search_query {
query = each.value.query
}
time_selection {
quick_selection {
caption = "Last 24 hours"
seconds = 86400
}
}
}
output "view_created" {
value = [
for k in ibm_logs_view.logs_view_instance_yaml : "${k.name}"
]
}
output "view_yaml" {
value = [
for k in local.input_cloudlogs_view : "${k.name}"
]
}
After executing, we can verify the ressources get from the yaml and in the ressource list “ibm_logs_view.logs_view_instance_yaml”, the are well ingered in the right order
view_created = [
"1_exemple-view",
"2_exemple-view",
"3_exemple-view",
]
view_yaml = [
"1_exemple-view",
"2_exemple-view",
"3_exemple-view",
]
But in reality the order is not respected :
If I understand well, this is due to parallelism execution of Terraform.
But can we force the order ?
Thanks for your help.
Dominique