How to run separate conditions for apply and destroy stages on terraform
data “aws_identity_policies” “existing_policies” { region = var.region } locals { policy_name = “{var.service_name}-aws-policy” policy_names_list = [for policy in data.aws_identity_policies.existing_policies.policies : policy.name] repeated_policy_list = [for policy_name in local.policy_names_list : policy_name if policy_name == local.policy_name] policy_already_exists = length(local.repeated_policy_list) > 1 ? true : false policy_already_exists_message = “Error: ${local.policy_name} already exists” } In the above code i want […]
A couple questions about State locking and “http” backend
I am new to Terraform and wanted to ask a couple of questions related to state locking. I was reading “http” backend documentation (https://developer.hashicorp.com/terraform/language/settings/backends/http#unlock_method) and have a couple of questions.