CiscoDevNet / terraform-provider-tetration

Terraform Provider for managing Cisco Secure Workload (Tetration) resources.
MIT License
0 stars 4 forks source link

Workspace set to primary fails : conflicts with other workspace #7

Open verriaa opened 2 years ago

verriaa commented 2 years ago

While using the following code (please note the primary = true) :

resource "tetration_application" "socially_distant_application" { app_scope_id = "626ff715497d4f5fdfa94d01" name = "Product Service" description = "A socially distant application" alternate_query_mode = true strict_validation = true primary = true

/ cluster { id = "ClusterA" name = "ClusterA" description = "A Cluster." node { name = "ClusterA Node1" ip_address = "30.0.0.1" } consistent_uuid = "ClusterA" } cluster { id = "ClusterB" name = "ClusterB" description = "B Cluster." node { name = "ClusterB Node1" ip_address = "30.10.0.1" } node { name = "ClusterB Node2" ip_address = "30.10.0.2" } consistent_uuid = "ClusterB" } /

absolute_policy { consumer_filter_id = tetration_filter.filterA.id provider_filter_id = tetration_filter.filterB.id action = "ALLOW" layer_4_network_policy { port_range = [80, 80] protocol = 6 } } absolute_policy { consumer_filter_id = tetration_filter.filterA.id provider_filter_id = tetration_filter.filterB.id action = "ALLOW" layer_4_network_policy { port_range = [443, 443] protocol = 6 } } default_policy { consumer_filter_id = tetration_filter.filterA.id provider_filter_id = tetration_filter.filterB.id action = "DENY" layer_4_network_policy { port_range = [8080, 8080] protocol = 6 } } default_policy { consumer_filter_id = tetration_filter.filterA.id provider_filter_id = tetration_filter.filterB.id action = "DENY" layer_4_network_policy { port_range = [8000, 8000] protocol = 6 } }

catch_all_action = "DENY" }

I get the following error :

etration_filter.filterB: Creating... tetration_scope.scope_A: Creating... tetration_filter.filterA: Creating... tetration_filter.filterB: Creation complete after 1s [id=62bf0dc6755f025b49f0398e] tetration_filter.filterA: Creation complete after 1s [id=62bf0dc6497d4f01f05e6997] tetration_scope.scope_A: Creation complete after 1s [id=62bf0dc6755f0239baf03983] tetration_application.socially_distant_application: Creating... ╷ │ Error: Existing application Tetration_itself exists for scope 59e4b74a497d4f36417521cc that is marked as primary. Please demote the workspace to secondary before continuing. │ │ with tetration_application.socially_distant_application, │ on main.tf line 46, in resource "tetration_application" "socially_distant_application": │ 46: resource "tetration_application" "socially_distant_application" { │

The scope 59e4b74a497d4f36417521cc has nothing to do with the root scope used to create this workspace, it is even in a different tenant/VRF. My root scope id is 626ff715497d4f5fdfa94d01.

However my workspace gets created correctly. When setting primary = false no error is thrown and the workspace is also created.

kadadhic commented 9 months ago

Thanks for raising this issue. It's fixed with PR https://github.com/CiscoDevNet/terraform-provider-tetration/pull/9.