Skip to content

Commit

Permalink
Add policy assignment resource and data source (netascode#91) applyin…
Browse files Browse the repository at this point in the history
…g change requests
  • Loading branch information
wojciech-bainhelixpe committed Nov 8, 2024
1 parent 20c463d commit 9c70dfb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 299 deletions.
6 changes: 5 additions & 1 deletion gen/definitions/policyassignments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ no_delete: true
no_data_source: true
no_import: true
doc_category: Policy Assignments
test_tags: [TF_VAR_target_id]
attributes:
- model_name: type
type: String
Expand Down Expand Up @@ -43,6 +44,7 @@ attributes:
id: true
mandatory: true
example: "9862719c-8d5f-11ef-99a6-aef0794da1c1"
test_value: var.target_id
- model_name: type
type: String
enum_values: [Device,DeviceHAPair,DeviceGroup]
Expand All @@ -65,4 +67,6 @@ test_prerequisites: |-
default_action_send_syslog = false
name = "policy-example-test"
rules = []
}
}
variable "target_id" { default = null } // tests will set $TF_VAR_target_id
193 changes: 0 additions & 193 deletions internal/provider/data_source_fmc_policy_assignments.go

This file was deleted.

102 changes: 0 additions & 102 deletions internal/provider/data_source_fmc_policy_assignments_test.go

This file was deleted.

10 changes: 7 additions & 3 deletions internal/provider/resource_fmc_policy_assignments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ import (
// Section below is generated&owned by "gen/generator.go". //template:begin testAcc

func TestAccFmcPolicyAssignments(t *testing.T) {
if os.Getenv("TF_VAR_target_id") == "" {
t.Skip("skipping test, set environment variable TF_VAR_target_id")
}
var checks []resource.TestCheckFunc
checks = append(checks, resource.TestCheckResourceAttr("fmc_policy_assignments.test", "targets.0.id", "9862719c-8d5f-11ef-99a6-aef0794da1c1"))
checks = append(checks, resource.TestCheckResourceAttr("fmc_policy_assignments.test", "targets.0.type", "DeviceGroup"))

var steps []resource.TestStep
Expand Down Expand Up @@ -67,6 +69,8 @@ resource "fmc_access_control_policy" "example" {
name = "policy-example-test"
rules = []
}
variable "target_id" { default = null } // tests will set $TF_VAR_target_id
`

// End of section. //template:end testPrerequisites
Expand All @@ -77,7 +81,7 @@ func testAccFmcPolicyAssignmentsConfig_minimum() string {
config := `resource "fmc_policy_assignments" "test" {` + "\n"
config += ` policy_id = fmc_access_control_policy.example.id` + "\n"
config += ` targets = [{` + "\n"
config += ` id = "9862719c-8d5f-11ef-99a6-aef0794da1c1"` + "\n"
config += ` id = var.target_id` + "\n"
config += ` type = "DeviceGroup"` + "\n"
config += ` }]` + "\n"
config += `}` + "\n"
Expand All @@ -92,7 +96,7 @@ func testAccFmcPolicyAssignmentsConfig_all() string {
config := `resource "fmc_policy_assignments" "test" {` + "\n"
config += ` policy_id = fmc_access_control_policy.example.id` + "\n"
config += ` targets = [{` + "\n"
config += ` id = "9862719c-8d5f-11ef-99a6-aef0794da1c1"` + "\n"
config += ` id = var.target_id` + "\n"
config += ` type = "DeviceGroup"` + "\n"
config += ` }]` + "\n"
config += `}` + "\n"
Expand Down

0 comments on commit 9c70dfb

Please sign in to comment.