Skip to content

Commit

Permalink
New Data Source: wiz_cloud_accounts (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
gramsa49 authored Oct 13, 2022
1 parent 2724ebc commit cd821b0
Show file tree
Hide file tree
Showing 10 changed files with 704 additions and 16 deletions.
89 changes: 89 additions & 0 deletions docs/data-sources/cloud_accounts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "wiz_cloud_accounts Data Source - terraform-provider-wiz"
subcategory: ""
description: |-
Query cloud accounts (subscriptions).
---

# wiz_cloud_accounts (Data Source)

Query cloud accounts (subscriptions).

## Example Usage

```terraform
# retrieve account by aws account id
data "wiz_cloud_accounts" "accounts_by_id" {
search = [
"012345678912",
"987654321098",
]
}
# retrieve one account by wiz internal identifier
data "wiz_cloud_accounts" "accounts_by_wiz_id" {
ids = [
"d33a2072-4b95-481b-8153-c0b9089992aa",
]
}
# retrieve all ccounts with multiple source connectors
data "wiz_cloud_accounts" "multiple_connectors" {
has_multiple_connector_sources = true
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Optional

- `assigned_to_project` (Boolean) QueryQuery cloud accounts by project assignment state.
- `cloud_provider` (List of String) Query cloud accounts of specific cloud provider.
- Allowed values:
- GCP
- AWS
- Azure
- OCI
- Alibaba
- vSphere
- OpenShift
- Kubernetes
- `connector_id` (List of String) Query cloud accounts by specific connector ID.
- `connector_issue_id` (List of String) Query cloud accounts by specific connector issue ID.
- `first` (Number) How many results to return
- Defaults to `500`.
- `has_multiple_connector_sources` (Boolean) QueryQuery cloud accounts by project assignment state.
- `ids` (List of String) Get specific Cloud Accounts by their IDs.
- `project_id` (String) Query cloud accounts of a specific linked project, given its id.
- `search` (List of String) Free text search on cloud account name or tags or external-id.
- `status` (List of String) Query cloud accounts by status.
- Allowed values:
- CONNECTED
- ERROR
- DISABLED
- INITIAL_SCANNING
- PARTIALLY_CONNECTED
- DISCONNECTED
- DISCOVERED

### Read-Only

- `cloud_accounts` (Set of Object) The returned cloud accounts. (see [below for nested schema](#nestedatt--cloud_accounts))
- `id` (String) Internal identifier for the data.

<a id="nestedatt--cloud_accounts"></a>
### Nested Schema for `cloud_accounts`

Read-Only:

- `cloud_provider` (String)
- `external_id` (String)
- `id` (String)
- `linked_project_ids` (List of String)
- `name` (String)
- `source_connector_ids` (List of String)
- `status` (String)


2 changes: 1 addition & 1 deletion docs/resources/host_config_rule_associations.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ resource "wiz_host_config_rule_associations" "test" {
"2e5bc0d5-835b-4b4c-99cf-b1c6ace90a52",
"708ec4a1-1a5c-4cb3-9c52-511229c5bb35",
]
cloud_config_rule_ids = [
host_config_rule_ids = [
"301e5fd0-6a1a-42a7-99f5-3b0436d55a7f",
"a5fbd955-ed78-445a-827a-06d6cbe5aab2",
]
Expand Down
19 changes: 19 additions & 0 deletions examples/data-sources/wiz_cloud_accounts/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# retrieve account by aws account id
data "wiz_cloud_accounts" "accounts_by_id" {
search = [
"012345678912",
"987654321098",
]
}

# retrieve one account by wiz internal identifier
data "wiz_cloud_accounts" "accounts_by_wiz_id" {
ids = [
"d33a2072-4b95-481b-8153-c0b9089992aa",
]
}

# retrieve all ccounts with multiple source connectors
data "wiz_cloud_accounts" "multiple_connectors" {
has_multiple_connector_sources = true
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ resource "wiz_host_config_rule_associations" "test" {
"2e5bc0d5-835b-4b4c-99cf-b1c6ace90a52",
"708ec4a1-1a5c-4cb3-9c52-511229c5bb35",
]
cloud_config_rule_ids = [
host_config_rule_ids = [
"301e5fd0-6a1a-42a7-99f5-3b0436d55a7f",
"a5fbd955-ed78-445a-827a-06d6cbe5aab2",
]
Expand Down
7 changes: 4 additions & 3 deletions internal/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package internal

// QueryVariables struct
type QueryVariables struct {
ID string `json:"id,omitempty"`
FilterBy FilterBy `json:"filterBy,omitempty"`
First int `json:"first,omitempty"`
ID string `json:"id,omitempty"`
FilterBy interface{} `json:"filterBy,omitempty"`
After string `json:"after,omitempty"`
First int `json:"first,omitempty"`
}

// FilterBy struct
Expand Down
Loading

0 comments on commit cd821b0

Please sign in to comment.