Skip to content

Commit

Permalink
Update go sdk and general fixes (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
chkp-royl authored Dec 11, 2024
1 parent accc32d commit adc29cb
Show file tree
Hide file tree
Showing 11 changed files with 142 additions and 134 deletions.
1 change: 0 additions & 1 deletion checkpoint/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,6 @@ func Provider() terraform.ResourceProvider {
}

func providerConfigure(data *schema.ResourceData) (interface{}, error) {

server := data.Get("server").(string)
username := data.Get("username").(string)
password := data.Get("password").(string)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1511,14 +1511,20 @@ func createManagementVsxProvisioningTool(d *schema.ResourceData, m interface{})
payload["set-vd-params"] = res
}

VsxProvisioningToolRes, _ := client.ApiCall("vsx-provisioning-tool", payload, client.GetSessionID(), true, false)
if !VsxProvisioningToolRes.Success {
return fmt.Errorf(VsxProvisioningToolRes.ErrorMsg)
vsxProvisioningToolRes, err := client.ApiCall("vsx-provisioning-tool", payload, client.GetSessionID(), true, client.IsProxyUsed())

log.Println("vsx-provisioning-tool result is ", vsxProvisioningToolRes)

if err != nil {
return fmt.Errorf(err.Error())
}

if !vsxProvisioningToolRes.Success {
return fmt.Errorf(vsxProvisioningToolRes.ErrorMsg)
}

d.SetId("vsx-provisioning-tool-" + acctest.RandString(10))
log.Println("result is ", VsxProvisioningToolRes)
_ = d.Set("task_id", resolveTaskId(VsxProvisioningToolRes.GetData()))
_ = d.Set("task_id", resolveTaskId(vsxProvisioningToolRes.GetData()))
return readManagementVsxProvisioningTool(d, m)
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/CheckPointSW/terraform-provider-checkpoint

require (
github.com/CheckPointSW/cp-mgmt-api-go-sdk v1.7.2
github.com/CheckPointSW/cp-mgmt-api-go-sdk v1.8.0
github.com/hashicorp/terraform-plugin-sdk v1.17.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/CheckPointSW/cp-mgmt-api-go-sdk v1.7.2 h1:D6nyYm1N1IxjL9ZgSp7p4UAlIAAGZVmMRs7XDyRMGIo=
github.com/CheckPointSW/cp-mgmt-api-go-sdk v1.7.2/go.mod h1:3NU+v6M7/Er4fECsNh7SlDwdsCYImVVqp14A01xBmU4=
github.com/CheckPointSW/cp-mgmt-api-go-sdk v1.8.0 h1:Ptp9byIc8/v1jP+migEpt39/0x4JqTi48V36yBuhChk=
github.com/CheckPointSW/cp-mgmt-api-go-sdk v1.8.0/go.mod h1:3NU+v6M7/Er4fECsNh7SlDwdsCYImVVqp14A01xBmU4=
github.com/Masterminds/goutils v1.1.0 h1:zukEsf/1JZwCMgHiK3GZftabmxiCw4apj3a28RPBiVg=
github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cloud.google.com/go/internal/trace
cloud.google.com/go/internal/version
# cloud.google.com/go/storage v1.10.0
cloud.google.com/go/storage
# github.com/CheckPointSW/cp-mgmt-api-go-sdk v1.7.2
# github.com/CheckPointSW/cp-mgmt-api-go-sdk v1.8.0
github.com/CheckPointSW/cp-mgmt-api-go-sdk/APIFiles
# github.com/Masterminds/goutils v1.1.0
github.com/Masterminds/goutils
Expand Down
62 changes: 23 additions & 39 deletions website/docs/index.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,6 @@ DevSecOps workflows.
## Examples of usage
To use Check Point provider, copy and paste this code into your Terraform configuration, update provider configuration and run `terraform init`.

### Terraform 0.12 and earlier:
```hcl
# Configure Check Point Provider for Management API
provider "checkpoint" {
server = "192.0.2.1"
username = "aa"
password = "aaaa"
context = "web_api"
session_name = "Terraform Session"
}
# Create network object
resource "checkpoint_management_network" "network" {
name = "My network"
subnet4 = "192.0.2.0"
mask_length4 = "24"
# ...
}
```
### Terraform 0.13 and later:
```hcl
terraform {
required_providers {
Expand All @@ -54,7 +34,7 @@ provider "checkpoint" {
username = "aa"
password = "aaaa"
context = "web_api"
session_name = "Terraform Session"
session_name = "Terraform session"
}
# Create network object
Expand Down Expand Up @@ -365,6 +345,26 @@ $ mv verify_policy $GOPATH/src/github.com/terraform-providers/terraform-provider
$ terraform apply && verify_policy -policy-package <package name>
```

## Compatibility with Management
Check Point Provider supports Management server from version R80 and above.
However, some Terraform resources or specific fields in Terraform resource might not be available because they are not supported in your Management API version.
<br>You can check the Management API [versions list](https://sc1.checkpoint.com/documents/latest/APIs/index.html#api_versions) to see what is supported by your Management server.

## Compatibility with CME
Check Point Provider supports configuring objects in CME configuration file starting from Security Management/Multi-Domain Security Management Server version R81.10 and higher.

The table below shows the compatibility between the Terraform Release version and the CME API version:

| Terraform Release version | CME API version | CME Take |
|---------------------------|-----------------|----------------|
| v2.9.0 | v1.2.2 | 289 and higher |
| v2.8.0 | v1.2 | 279 and higher |
| v2.7.0 | v1.1 | 255 and higher |
<br>
-> **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.

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).

## Import Resources

In order to import resource, use the `terraform import` command with object unique identifier.
Expand All @@ -391,23 +391,6 @@ $ terraform import checkpoint_management_host.host 9423d36f-2d66-4754-b9e2-e7f44
For more information about `terraform import` command, please
refer [here](https://www.terraform.io/docs/import/usage.html).

## Compatibility with CME
Check Point Provider supports configuring objects in CME configuration file starting from Security Management/Multi-Domain Security Management Server version R81.10 and higher.

The table below shows the compatibility between the Terraform Release version and the CME API version:

| Terraform Release version | CME API version | CME Take |
|---------------------------|-----------------|----------------|
| v2.9.0 | v1.2.2 | 289 and higher |
| v2.8.0 | v1.2 | 279 and higher |
| v2.7.0 | v1.1 | 255 and higher |


-> **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.


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).

## Tips & Best Practices

This section describes best practices for working with the Check Point provider.
Expand All @@ -416,4 +399,5 @@ This section describes best practices for working with the Check Point provider.
* Keep on object name uniqueness in your environment.
* Use object name when reference to an object (avoid use of object UID).
* Use post apply scripts (e.g. publish, install policy, logout) to run actions after apply your changes. Terraform runs in parallel and because of that we can't predict the order of when changes will execute, running post apply scripts will ensure to run last after all changes submitted successfully.
* Create implicit / explicit dependencies between resources or modules. Terraform uses this dependency information to determine the correct order in which to create the different resources. To do so, it creates a dependency graph of all of the resources defined by the configuration. For more information, please refer [here](https://developer.hashicorp.com/terraform/tutorials/configuration-language/dependencies#dependencies).
* Create implicit / explicit dependencies between resources or modules. Terraform uses this dependency information to determine the correct order in which to create the different resources. To do so, it creates a dependency graph of all of the resources defined by the configuration. For more information, please refer [here](https://developer.hashicorp.com/terraform/tutorials/configuration-language/dependencies#dependencies).
* When configure the provider [context](https://registry.terraform.io/providers/CheckPointSW/checkpoint/latest/docs#context-1) to `gaia_api` you can run only GAIA resources. Management resources will not be supported.
Loading

0 comments on commit adc29cb

Please sign in to comment.