Skip to content

Commit

Permalink
Add support for nsacls. Every acl has to be a sub resource of the net…
Browse files Browse the repository at this point in the history
…scaler_nsacls resource. This way whenever there is a change or update, Terraform will know to call apply on the nsacls after all acl objects have been created/updated/deleted
  • Loading branch information
chiradeep committed May 16, 2018
1 parent 041b26f commit 197f4bb
Show file tree
Hide file tree
Showing 6 changed files with 681 additions and 48 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,33 @@ resource "netscaler_lbmonitor" "foo" {
##### Argument Reference
See <https://docs.citrix.com/en-us/netscaler/11-1/nitro-api/nitro-rest/api-reference/configuration/load-balancing/lbmonitor.html> for possible values for these arguments and for an exhaustive list of arguments.

#### `netscaler_nsacls`

```
resource "netscaler_nsacls" "allacls" {
aclsname = "foo"
"acl" {
aclname = "restrict"
protocol = "TCP"
aclaction = "DENY"
destipval = "192.168.1.20"
srcportval = "49-1024"
priority = 100
}
"acl" {
aclname = "restrictvlan"
aclaction = "DENY"
vlan = "2000"
priority = 130
}
```

##### Argument Reference
You can have only one element of type `netscaler_nsacls`. Encapsulating every `nsacl` inside the `netscaler_nsacls` resource so that Terraform will automatically call `apply` on the `nsacls`.

See <https://developer-docs.citrix.com/projects/netscaler-nitro-api/en/12.0/configuration/ns/nsacl/nsacl/#nsacl> for possible values for these arguments and for an exhaustive list of arguments.

## Building
### Assumption
* You have (some) experience with Terraform, the different provisioners and providers that come out of the box,
Expand Down
2 changes: 1 addition & 1 deletion examples/nsacl/provider.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
provider "netscaler" {
endpoint = "http://localhost:32771/"
endpoint = "http://localhost:32769/"
}
76 changes: 40 additions & 36 deletions examples/nsacl/resources.tf
Original file line number Diff line number Diff line change
@@ -1,41 +1,45 @@

resource "netscaler_nsacl" "acl1" {
aclname = "restrict"
protocol = "TCP"
aclaction = "DENY"
destipval = "192.168.1.20"
srcportval = "49-1024"
}

resource "netscaler_nsacl" "acl2" {
aclname = "restrictudp"
protocol = "UDP"
aclaction = "DENY"
destipval = "192.168.1.2"
srcportval = "45-10024"
}

resource "netscaler_nsacl" "acl3" {
aclname = "restricttcp2"
protocol = "TCP"
aclaction = "ALLOW"
destipval = "192.168.1.40"
srcportval = "149-1024"
}

resource "netscaler_nsacl" "acl4" {
aclname = "restrictudp2"
protocol = "UDP"
aclaction = "ALLOW"
destipval = "192.168.10.2"
srcportval = "490-1024"
}
resource "netscaler_nsacls" "allacls" {
aclsname = "foo"
"acl" {
aclname = "restrict"
protocol = "TCP"
aclaction = "DENY"
destipval = "192.168.1.20"
srcportval = "49-1024"
}

resource "netscaler_nsacl" "acl5" {
aclname = "restrictvlan"
aclaction = "DENY"
vlan = "2000"
}
"acl" {
aclname = "restrictudp"
protocol = "UDP"
aclaction = "DENY"
destipval = "192.168.1.2"
srcportval = "45-10024"
}

"acl" {
aclname = "restricttcp2"
protocol = "TCP"
aclaction = "DENY"
destipval = "192.168.199.52"
srcportval = "149-1524"
}

"acl" {
aclname = "restrictudp2"
protocol = "UDP"
aclaction = "DENY"
destipval = "192.168.45.55"
srcportval = "490-1024"
priority = "100"
}

"acl" {
aclname = "restrictvlan"
aclaction = "DENY"
vlan = "2000"
}

resource "netscaler_nsacls" "allacls" {
}
4 changes: 2 additions & 2 deletions netscaler/resource_nsacl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ func TestAccNsacl_basic(t *testing.T) {
resource.TestCheckResourceAttr(
"netscaler_nsacl.foo", "aclname", "test_acl"),
resource.TestCheckResourceAttr(
"netscaler_nsacl.foo", "destip", "192.168.1.1"),
"netscaler_nsacl.foo", "destipval", "192.168.1.33"),
resource.TestCheckResourceAttr(
"netscaler_nsacl.foo", "protocol", "TCP"),
resource.TestCheckResourceAttr(
"netscaler_nsacl.foo", "srcport", "45-1024"),
"netscaler_nsacl.foo", "srcportval", "45-1024"),
),
},
},
Expand Down
Loading

0 comments on commit 197f4bb

Please sign in to comment.