Skip to content

Commit e4853ca

Browse files
authored
Add timeout to run script and some general fixes (#233)
1 parent 8995bec commit e4853ca

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

checkpoint/resource_checkpoint_management_access_rule.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ func updateManagementAccessRule(d *schema.ResourceData, m interface{}) error {
897897
}
898898

899899
if d.HasChange("content") {
900-
if v, ok := d.GetOkExists("content"); ok {
900+
if v, ok := d.GetOk("content"); ok {
901901
accessRule["content"] = v.(*schema.Set).List()
902902
}
903903
//else {
@@ -965,7 +965,7 @@ func updateManagementAccessRule(d *schema.ResourceData, m interface{}) error {
965965
}
966966

967967
if d.HasChange("install_on") {
968-
if v, ok := d.GetOkExists("install_on"); ok {
968+
if v, ok := d.GetOk("install_on"); ok {
969969
accessRule["install-on"] = v.(*schema.Set).List()
970970
}
971971
//else {
@@ -975,7 +975,7 @@ func updateManagementAccessRule(d *schema.ResourceData, m interface{}) error {
975975
}
976976

977977
if d.HasChange("service") {
978-
if v, ok := d.GetOkExists("service"); ok {
978+
if v, ok := d.GetOk("service"); ok {
979979
accessRule["service"] = v.(*schema.Set).List()
980980
}
981981
//else {
@@ -991,7 +991,7 @@ func updateManagementAccessRule(d *schema.ResourceData, m interface{}) error {
991991
}
992992

993993
if d.HasChange("source") {
994-
if v, ok := d.GetOkExists("source"); ok {
994+
if v, ok := d.GetOk("source"); ok {
995995
accessRule["source"] = v.(*schema.Set).List()
996996
}
997997
//else {
@@ -1007,7 +1007,7 @@ func updateManagementAccessRule(d *schema.ResourceData, m interface{}) error {
10071007
}
10081008

10091009
if d.HasChange("time") {
1010-
if v, ok := d.GetOkExists("time"); ok {
1010+
if v, ok := d.GetOk("time"); ok {
10111011
accessRule["time"] = v.(*schema.Set).List()
10121012
}
10131013
//else {
@@ -1080,7 +1080,7 @@ func updateManagementAccessRule(d *schema.ResourceData, m interface{}) error {
10801080
}
10811081

10821082
if d.HasChange("vpn_communities") {
1083-
if v, ok := d.GetOkExists("vpn_communities"); ok {
1083+
if v, ok := d.GetOk("vpn_communities"); ok {
10841084
accessRule["vpn"] = v.(*schema.Set).List()
10851085
}
10861086
}

checkpoint/resource_checkpoint_management_command_run_script.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ func resourceManagementRunScript() *schema.Resource {
4747
ForceNew: true,
4848
Description: "Comments string.",
4949
},
50+
"timeout": {
51+
Type: schema.TypeInt,
52+
Optional: true,
53+
ForceNew: true,
54+
Description: "Script timeout in seconds.",
55+
},
5056
"tasks": {
5157
Type: schema.TypeSet,
5258
Computed: true,
@@ -88,6 +94,10 @@ func createManagementRunScript(d *schema.ResourceData, m interface{}) error {
8894
payload["comments"] = v.(string)
8995
}
9096

97+
if v, ok := d.GetOk("timeout"); ok {
98+
payload["timeout"] = v
99+
}
100+
91101
runScriptRes, err := client.ApiCall("run-script", payload, client.GetSessionID(), true, client.IsProxyUsed())
92102
if err != nil {
93103
return fmt.Errorf(err.Error())

website/docs/index.html.markdown

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ The table below shows the compatibility between the Terraform Release version an
396396
| v2.7.0 | v1.1 | 255 and higher |
397397

398398
<br>
399-
-> **Note:** When you install or upgrade the Terraform Release version, make sure to also upgrade CME to the corresponding CME Take to properly configure CME resources.
399+
**Note:** When you install or upgrade the Terraform Release version, make sure to also upgrade CME to the corresponding CME Take to properly configure CME resources.
400400

401401
For details about upgrading CME, please refer to the documentation [here](https://sc1.checkpoint.com/documents/IaaS/WebAdminGuides/EN/CP_CME/Content/Topics-CME/Installing_and_Updating_CME.htm?tocpath=_____4).
402402

@@ -444,6 +444,7 @@ This section describes best practices for working with the Check Point provider.
444444

445445
#### Trigger field
446446
From version 1.2 the provider was enhanced where a `triggers` field for resource `install-policy`, `publish` and `logout` was added for re-execution if there are any changes in the configuration files.
447+
447448
```hcl
448449
# Put the Check Point configuration in a sub folder and refer to is as a module
449450
module "chkp_policy" {
@@ -461,6 +462,7 @@ resource "checkpoint_management_publish" "publish" {
461462
triggers = local.publish_triggers
462463
}
463464
```
465+
<br>
464466

465467
#### Avoid large bulk publishes
466468
From version 2.5.0 the provider was enhanced with support to auto publish mode using `auto_publish_batch_size` or via the `CHECKPOINT_AUTO_PUBLISH_BATCH_SIZE` environment variable to configure the number of batch size to automatically run publish.
@@ -474,6 +476,7 @@ provider "checkpoint" {
474476
auto_publish_batch_size = "100"
475477
}
476478
```
479+
<br>
477480

478481
#### Control publish post destroy
479482
From version 2.6.0 the provider was enhanced where a new flag was added `run_publish_on_destroy` to `checkpoint_management_publish` which indicates whether to run publish on destroy.

website/docs/r/checkpoint_management_run_script.html.markdown

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ The following arguments are supported:
2929
* `script` - (Required) Script body.
3030
* `targets` - (Required) On what targets to execute this command. Targets may be identified by their name, or object unique identifier.targets blocks are documented below.
3131
* `args` - (Optional) Script arguments.
32-
* `comments` - (Optional) Comments string.
32+
* `comments` - (Optional) Comments string.
33+
* `timeout` - (Optional) Script timeout in seconds.
3334
* `tasks` - (Computed) Collection of asynchronous task unique identifiers.
3435
* `response` - Response message in JSON format.
3536

0 commit comments

Comments
 (0)