-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f8f8b9
commit 305d687
Showing
10 changed files
with
845 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "wiz_connector_gcp Resource - terraform-provider-wiz" | ||
subcategory: "" | ||
description: |- | ||
Connectors are used to connect GCP resources to Wiz. | ||
--- | ||
|
||
# wiz_connector_gcp (Resource) | ||
|
||
Connectors are used to connect GCP resources to Wiz. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
# Provision a simple GCP connector, organization-wide | ||
resource "wiz_connector_gcp" "example" { | ||
name = "example" | ||
auth_params = jsonencode({ | ||
"isManagedIdentity" : true, | ||
"organization_id" : "o-example" | ||
}) | ||
extra_config = jsonencode( | ||
{ | ||
"projects" : [], | ||
"excludedProjects" : [], | ||
"includedFolders" : [], | ||
"excludedFolders" : [], | ||
"diskAnalyzerInFlightDisabled" : false, | ||
"auditLogMonitorEnabled" : false | ||
} | ||
) | ||
} | ||
# Provision a GCP connector targeting an individual Google project | ||
resource "wiz_connector_gcp" "example" { | ||
name = "example" | ||
auth_params = jsonencode({ | ||
"isManagedIdentity" : true, | ||
"project_id" : "exmaple-project-id" | ||
}) | ||
extra_config = jsonencode( | ||
{ | ||
"projects" : [], | ||
"excludedProjects" : [], | ||
"includedFolders" : [], | ||
"excludedFolders" : [], | ||
"diskAnalyzerInFlightDisabled" : false, | ||
"auditLogMonitorEnabled" : false | ||
} | ||
) | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `auth_params` (String, Sensitive) The authentication parameters. Must be represented in `JSON` format. | ||
- `name` (String) The connector name. | ||
|
||
### Optional | ||
|
||
- `enabled` (Boolean) Whether the connector is enabled. | ||
- Defaults to `true`. | ||
- `extra_config` (String) Extra configuration for the connector. Must be represented in `JSON` format. | ||
|
||
### Read-Only | ||
|
||
- `audit_log_monitor_enabled` (Boolean) Whether audit log monitor is enabled. Note an advanced license is required. | ||
- `disk_analyzer_inflight_disabled` (Boolean) If using Outpost, whether disk analyzer inflight scanning is disabled. | ||
- `events_pub_sub_subscription_id` (String) If using Wiz Cloud Events, the Pub/Sub Subscription ID. | ||
- `events_topic_name` (String) If using Wiz Cloud Events, the Topic Name in format `projects/<project_id>/topics/<topic_id>`. | ||
- `excluded_folders` (List of String) The GCP folders excluded by the connector. | ||
- `excluded_projects` (List of String) The GCP projects excluded by the connector. | ||
- `folder_id` (String) The GCP folder ID. | ||
- `id` (String) Wiz internal identifier for the connector. | ||
- `included_folders` (List of String) The GCP folders included by the connector. | ||
- `is_managed_identity` (String) Is managed identity? | ||
- `organization_id` (String) The GCP organization ID. | ||
- `projects` (List of String) The GCP projects to target with the connector. | ||
|
||
## Import | ||
|
||
Import is supported using the following syntax: | ||
|
||
```shell | ||
# Importing Considerations: | ||
# | ||
# Please note this is considered experimental, exercise caution and consider the following: | ||
# | ||
# - Make sure that the `auth_params` field is set to the same values as set when the resource was created outside of Terraform. | ||
# This is due to the way we need to handle change as under normal diff conditions, `auth_params` requires a resource recreation. | ||
# | ||
# - For `auth_params` include `isManagedIdentity`. If using outposts, also include `outPostId` and `diskAnalyzer` structure. | ||
# | ||
# For more information, refer to the examples in the documentation. | ||
# | ||
terraform import wiz_connector_gcp.import_example "7be792ba-bfd1-46d0-9fba-5f6bc19df4a8" | ||
|
||
# Optional - this is to set auth_params in state. | ||
# | ||
# If not run post-import, the next `terraform apply` will take care of it. | ||
# Note any speculative changes to `auth_params` are for setting state for the one-time import only, any further changes would require a resource recreation as normal. | ||
terraform apply --target=wiz_connector_gcp.import_example | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Importing Considerations: | ||
# | ||
# Please note this is considered experimental, exercise caution and consider the following: | ||
# | ||
# - Make sure that the `auth_params` field is set to the same values as set when the resource was created outside of Terraform. | ||
# This is due to the way we need to handle change as under normal diff conditions, `auth_params` requires a resource recreation. | ||
# | ||
# - For `auth_params` include `isManagedIdentity`. If using outposts, also include `outPostId` and `diskAnalyzer` structure. | ||
# | ||
# For more information, refer to the examples in the documentation. | ||
# | ||
terraform import wiz_connector_gcp.import_example "7be792ba-bfd1-46d0-9fba-5f6bc19df4a8" | ||
|
||
# Optional - this is to set auth_params in state. | ||
# | ||
# If not run post-import, the next `terraform apply` will take care of it. | ||
# Note any speculative changes to `auth_params` are for setting state for the one-time import only, any further changes would require a resource recreation as normal. | ||
terraform apply --target=wiz_connector_gcp.import_example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Provision a simple GCP connector, organization-wide | ||
resource "wiz_connector_gcp" "example" { | ||
name = "example" | ||
auth_params = jsonencode({ | ||
"isManagedIdentity" : true, | ||
"organization_id" : "o-example" | ||
}) | ||
|
||
extra_config = jsonencode( | ||
{ | ||
"projects" : [], | ||
"excludedProjects" : [], | ||
"includedFolders" : [], | ||
"excludedFolders" : [], | ||
"diskAnalyzerInFlightDisabled" : false, | ||
"auditLogMonitorEnabled" : false | ||
} | ||
) | ||
} | ||
|
||
# Provision a GCP connector targeting an individual Google project | ||
resource "wiz_connector_gcp" "example" { | ||
name = "example" | ||
auth_params = jsonencode({ | ||
"isManagedIdentity" : true, | ||
"project_id" : "exmaple-project-id" | ||
}) | ||
|
||
extra_config = jsonencode( | ||
{ | ||
"projects" : [], | ||
"excludedProjects" : [], | ||
"includedFolders" : [], | ||
"excludedFolders" : [], | ||
"diskAnalyzerInFlightDisabled" : false, | ||
"auditLogMonitorEnabled" : false | ||
} | ||
) | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package acceptance | ||
|
||
import ( | ||
"fmt" | ||
"regexp" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-testing/helper/acctest" | ||
"github.com/hashicorp/terraform-plugin-testing/helper/resource" | ||
) | ||
|
||
func TestAccResourceWizConnectorGcp_basic(t *testing.T) { | ||
rName := acctest.RandomWithPrefix(ResourcePrefix) | ||
|
||
resource.UnitTest(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t, TestCase(TcCommon)) }, | ||
ProviderFactories: providerFactories, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testResourceWizConnectorGcpBasic(rName), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttr( | ||
"wiz_connector_gcp.foo", | ||
"name", | ||
rName, | ||
), | ||
resource.TestCheckResourceAttr( | ||
"wiz_connector_gcp.foo", | ||
"folder_id", | ||
"123456", | ||
), | ||
resource.TestCheckResourceAttr( | ||
"wiz_connector_gcp.foo", | ||
"auth_params", | ||
"{\"folder_id\":\"123456\",\"isManagedIdentity\":true}", | ||
), | ||
resource.TestMatchResourceAttr( | ||
"wiz_connector_gcp.foo", | ||
"id", | ||
regexp.MustCompile(UUIDPattern), | ||
), | ||
resource.TestCheckResourceAttr( | ||
"wiz_connector_gcp.foo", | ||
"enabled", | ||
"true", | ||
), | ||
resource.TestCheckResourceAttr( | ||
"wiz_connector_gcp.foo", | ||
"disk_analyzer_inflight_disabled", | ||
"false", | ||
), | ||
resource.TestCheckResourceAttr( | ||
"wiz_connector_gcp.foo", | ||
"extra_config", | ||
"{\"auditLogMonitorEnabled\":false,\"diskAnalyzerInFlightDisabled\":false,\"excludedFolders\":[],\"excludedProjects\":[],\"includedFolders\":[],\"projects\":[]}", | ||
), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testResourceWizConnectorGcpBasic(rName string) string { | ||
return fmt.Sprintf(` | ||
resource "wiz_connector_gcp" "foo" { | ||
name = "%[1]s" | ||
auth_params = jsonencode({ | ||
"isManagedIdentity" : true, | ||
"folder_id" : "123456", | ||
}) | ||
extra_config = jsonencode( | ||
{ | ||
"projects" : [], | ||
"excludedProjects" : [], | ||
"includedFolders" : [], | ||
"excludedFolders" : [], | ||
"diskAnalyzerInFlightDisabled" : false, | ||
"auditLogMonitorEnabled" : false, | ||
} | ||
) | ||
} | ||
`, rName) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.