Skip to content

Commit

Permalink
Merge pull request #133 from maxlaverse/add_support_for_org_collections
Browse files Browse the repository at this point in the history
Add support for org-collections and organizations
  • Loading branch information
maxlaverse authored Apr 20, 2024
2 parents d35ee1e + f83b1d5 commit 0b40bbb
Show file tree
Hide file tree
Showing 55 changed files with 892 additions and 493 deletions.
41 changes: 16 additions & 25 deletions docs/data-sources/attachment.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,35 @@
page_title: "bitwarden_attachment Data Source - terraform-provider-bitwarden"
subcategory: ""
description: |-
(EXPERIMENTAL) Use this data source to get the content of an existing item's attachment.
Use this data source to get the content on an existing item's attachment.
---

# bitwarden_attachment (Data Source)

(EXPERIMENTAL) Use this data source to get the content of an existing item's attachment.
Use this data source to get the content on an existing item's attachment.

## Example Usage

```terraform
# Find the identifier of the resource and its attachment you want to reference:
#
# $ bw list items --search "SSH Credentials" | jq '.[]'
# ? Master password: [hidden]
#
# > {
# > "object": "item",
# > "id": "59575167-4d36-5a58-466e-d9021926df8a",
# > [...]
# > "name": "My Top Secret SSH Credentials",
# > "attachments": [
# > {
# > id": "4d6a41364d6a4dea8ddb1a",
# > "fileName": "ssh_private.key",
# > "size": "1743",
# > "sizeName": "1.74 KB",
# > "url": "https://vault.bitwarden.com/attachments/59575167-4d36-5a58-466e-d9021926df8a/4d6a41364d6a4dea8ddb1a"
# > }
# > ],
# > }
data "bitwarden_item_login" "ssh" {
search = "VPN/Credentials"
}
data "bitwarden_attachment" "ssh_private_key" {
id = "4d6a41364d6a4dea8ddb1a"
item_id = "59575167-4d36-5a58-466e-d9021926df8a"
item_id = data.bitwarden_item_login.ssh.id
}
# Later to be accessed as
# ... = data.bitwarden_attachment.ssh_private_key.content
# Example of usage of the data source:
resource "kubernetes_secret" "ssh_keys" {
metadata {
name = "ssh-keys"
}
data = {
"private.key" = data.bitwarden_attachment.vpn_ssh_private_key.content
}
}
```

<!-- schema generated by tfplugindocs -->
Expand Down
24 changes: 19 additions & 5 deletions docs/data-sources/folder.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,38 @@
page_title: "bitwarden_folder Data Source - terraform-provider-bitwarden"
subcategory: ""
description: |-
Use this data source to get information on an existing Folder.
Use this data source to get information on an existing folder.
---

# bitwarden_folder (Data Source)

Use this data source to get information on an existing Folder.
Use this data source to get information on an existing folder.

## Example Usage

```terraform
data "bitwarden_folder" "terraform" {
search = "Terraform"
}
# Example of usage of the data source:
resource "bitwarden_item_login" "administrative_user" {
name = "Service Administrator"
username = "admin"
folder_id = data.bitwarden_folder.terraform.id
}
```

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

### Optional

- `filter_collection_id` (String) Filter search results by collection ID
- `filter_organization_id` (String) Filter search results by organization ID
- `filter_collection_id` (String) Filter search results by collection ID.
- `filter_organization_id` (String) Filter search results by organization ID.
- `id` (String) Identifier.
- `search` (String) Search items matching the search string. Can be combined with filters to narrow down the search.
- `search` (String) Search items matching the search string.

### Read-Only

Expand Down
53 changes: 20 additions & 33 deletions docs/data-sources/item_login.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,45 @@
page_title: "bitwarden_item_login Data Source - terraform-provider-bitwarden"
subcategory: ""
description: |-
Use this data source to get information on an existing Login.
Use this data source to get information on an existing login item.
---

# bitwarden_item_login (Data Source)

Use this data source to get information on an existing Login.
Use this data source to get information on an existing login item.

## Example Usage

```terraform
# Option 1: Find the identifier of the resource you want to import:
#
# $ bw list items --search "Mysql Root Credentials" | jq '.[] .id'
# ? Master password: [hidden]
#
# > "ec4e447f-9aed-4203-b834-c8f3848828f7"
#
data "bitwarden_item_login" "database_credentials" {
id = "ec4e447f-9aed-4203-b834-c8f3848828f7"
data "bitwarden_item_login" "vpn_credentials" {
search = "VPN/Credentials"
}
# Option 2: Use filters directly in the resource declaration
data "bitwarden_item_secure_note" "ssh_notes" {
search = "SSH Private Key"
}
# Later to be accessed as
# ... = data.bitwarden_item_login.database_credentials.username
# ... = data.bitwarden_item_login.database_credentials.password
#
# or for fields:
# lookup(
# zipmap(
# data.bitwarden_item_login.database_credentials.field.*.name,
# data.bitwarden_item_login.database_credentials.field.*
# ),
# "<name-of-the-field-your-looking-for>"
# )
# Example of usage of the data source:
resource "kubernetes_secret" "vpn_credentials" {
metadata {
name = "vpn-credentials"
}
data = {
"USERNAME" = data.bitwarden_item_secure_note.vpn_credentials.username
"PASSWORD" = data.bitwarden_item_secure_note.vpn_credentials.password
}
}
```

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

### Optional

- `filter_collection_id` (String) Filter search results by collection ID
- `filter_folder_id` (String) Filter search results by folder ID
- `filter_organization_id` (String) Filter search results by organization ID
- `filter_url` (String) Filter search results by URL
- `filter_collection_id` (String) Filter search results by collection ID.
- `filter_folder_id` (String) Filter search results by folder ID.
- `filter_organization_id` (String) Filter search results by organization ID.
- `filter_url` (String) Filter search results by URL.
- `id` (String) Identifier.
- `search` (String) Search items matching the search string. Can be combined with filters to narrow down the search.
- `search` (String) Search items matching the search string.

### Read-Only

Expand Down
49 changes: 18 additions & 31 deletions docs/data-sources/item_secure_note.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,43 @@
page_title: "bitwarden_item_secure_note Data Source - terraform-provider-bitwarden"
subcategory: ""
description: |-
Use this data source to get information on an existing Secure Note.
Use this data source to get information on an existing secure note item.
---

# bitwarden_item_secure_note (Data Source)

Use this data source to get information on an existing Secure Note.
Use this data source to get information on an existing secure note item.

## Example Usage

```terraform
# Option 1: Find the identifier of the resource you want to import:
#
# $ bw list items --search "SSH Private Key" | jq '.[] .id'
# ? Master password: [hidden]
#
# > "a9e19f26-1b8c-4568-bc09-191e2cf56ed6"
#
data "bitwarden_item_secure_note" "ssh_notes" {
id = "a9e19f26-1b8c-4568-bc09-191e2cf56ed6"
data "bitwarden_item_secure_note" "vpn_preshared_key" {
search = "VPN/Pre-sharedSecret"
}
# Option 2: Use filters directly in the resource declaration
data "bitwarden_item_secure_note" "ssh_notes" {
search = "SSH Private Key"
}
# Later to be accessed as
# ... = data.bitwarden_item_secure_note.ssh_notes.notes
#
# or for fields:
# lookup(
# zipmap(
# data.bitwarden_item_secure_note.ssh_notes.field.*.name,
# data.bitwarden_item_secure_note.ssh_notes.field.*
# ),
# "<name-of-the-field-your-looking-for>"
# )
# Example of usage of the data source:
resource "kubernetes_secret" "preshared_key" {
metadata {
name = "vpn-preshared-key"
}
data = {
"private.key" = data.bitwarden_item_secure_note.vpn_preshared_key.notes
}
}
```

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

### Optional

- `filter_collection_id` (String) Filter search results by collection ID
- `filter_folder_id` (String) Filter search results by folder ID
- `filter_organization_id` (String) Filter search results by organization ID
- `filter_collection_id` (String) Filter search results by collection ID.
- `filter_folder_id` (String) Filter search results by folder ID.
- `filter_organization_id` (String) Filter search results by organization ID.
- `id` (String) Identifier.
- `search` (String) Search items matching the search string. Can be combined with filters to narrow down the search.
- `search` (String) Search items matching the search string.

### Read-Only

Expand Down
50 changes: 50 additions & 0 deletions docs/data-sources/org_collection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "bitwarden_org_collection Data Source - terraform-provider-bitwarden"
subcategory: ""
description: |-
Use this data source to get information on an existing organization collection.
---

# bitwarden_org_collection (Data Source)

Use this data source to get information on an existing organization collection.

## Example Usage

```terraform
data "bitwarden_organization" "terraform" {
search = "Terraform"
}
data "bitwarden_org_collection" "engineering" {
search = "Engineering"
organization_id = data.bitwarden_organization.terraform.id
}
# Example of usage of the data source:
resource "bitwarden_item_login" "administrative_user" {
name = "Service Administrator"
username = "admin"
password = "<sensitive>"
organization_id = data.bitwarden_organization.terraform.id
collection_ids = [data.bitwarden_org_collection.terraform.id]
}
```

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

### Required

- `organization_id` (String) Identifier of the organization.

### Optional

- `id` (String) Identifier.
- `search` (String) Search items matching the search string.

### Read-Only

- `name` (String) Name.
40 changes: 40 additions & 0 deletions docs/data-sources/organization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "bitwarden_organization Data Source - terraform-provider-bitwarden"
subcategory: ""
description: |-
Use this data source to get information on an existing organization.
---

# bitwarden_organization (Data Source)

Use this data source to get information on an existing organization.

## Example Usage

```terraform
data "bitwarden_organization" "terraform" {
search = "Terraform"
}
# Example of usage of the data source:
resource "bitwarden_item_login" "administrative_user" {
name = "Service Administrator"
username = "admin"
password = "<sensitive>"
organization_id = data.bitwarden_organization.terraform.id
}
```

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

### Optional

- `id` (String) Identifier.
- `search` (String) Search items matching the search string.

### Read-Only

- `name` (String) Name.
Loading

0 comments on commit 0b40bbb

Please sign in to comment.