run "learning_disables_deletion_protection" {
  command = plan

  variables {
    environment         = "learning"
    deletion_protection = false
  }

  assert {
    condition     = output.deletion_protection == false
    error_message = "learning must not enable deletion protection"
  }
}

run "production_enables_deletion_protection" {
  command = plan

  variables {
    environment         = "production"
    deletion_protection = true
  }

  assert {
    condition     = output.deletion_protection == true
    error_message = "production must enable deletion protection"
  }
}

run "production_rejects_disabled_deletion_protection" {
  command = plan

  variables {
    environment         = "production"
    deletion_protection = false
  }

  expect_failures = [terraform_data.environment_contract]
}
