Skip to content

Commit

Permalink
Add capability to do MAS proxied calls
Browse files Browse the repository at this point in the history
Signed-off-by: George Nikolopoulos <[email protected]>
  • Loading branch information
George Nikolopoulos committed Mar 12, 2019
1 parent 8a99ce9 commit 41a64a6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ The following arguments are supported.
* `password` - This is the password to access to NetScaler. Defaults to `nsroot` unless environment variable `NS_PASSWORD` has been set
* `endpoint` - (Required) Nitro API endpoint in the form `http://<NS_IP>/` or `http://<NS_IP>:<PORT>/`. Can be specified in environment variable `NS_URL`
* `insecure_skip_verify` - (Optional, true/false) Whether to accept the untrusted certificate on the NetScaler when the NetScaler endpoint is `https`
* `proxied_ns` - (Optional, NSIP) The target Netscaler NSIP for MAS proxied calls. When this option is defined, `username`, `password` and `endpoint` must refer to the MAS proxy.

The username, password and endpoint can be provided in environment variables `NS_LOGIN`, `NS_PASSWORD` and `NS_URL`.

Expand Down
6 changes: 6 additions & 0 deletions examples/mas_proxied_calls/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
provider "netscaler" {
endpoint = "http://10.78.60.207"
username = "nsroot"
password = "nsroot"
proxied_ns = "10.78.60.209"
}
7 changes: 7 additions & 0 deletions examples/mas_proxied_calls/resources.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

resource "netscaler_servicegroup" "backend" {
servicegroupname = "test_service_group"
servicetype = "HTTP"
servicegroupmembers = [ "192.168.1.1:80:10" ]
}

7 changes: 7 additions & 0 deletions netscaler/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ func providerSchema() map[string]*schema.Schema {
Description: "Ignore validity of endpoint TLS certificate if true",
Default: false,
},
"proxied_ns": {
Type: schema.TypeString,
Optional: true,
Description: "Target NS ip. When defined username, password and endpoint must refer to MAS.",
DefaultFunc: schema.EnvDefaultFunc("_MPS_API_PROXY_MANAGED_INSTANCE_IP", ""),
},
}
}

Expand Down Expand Up @@ -97,6 +103,7 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
Url: d.Get("endpoint").(string),
Username: d.Get("username").(string),
Password: d.Get("password").(string),
ProxiedNs: d.Get("proxied_ns").(string),
SslVerify: !d.Get("insecure_skip_verify").(bool),
}
client, err := netscaler.NewNitroClientFromParams(params)
Expand Down

0 comments on commit 41a64a6

Please sign in to comment.