### Provider Initialization Example Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Example of how to serve the provider using the New function. Ensure the context and version are correctly provided. ```go providerServer.Serve(context.Background(), provider.New(version), opts) ``` -------------------------------- ### Provider Server Integration Example Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/provider.md Example demonstrating how to use the `New` factory function with `providerserver.Serve` in your main application file. ```go // In main.go err := providerserver.Serve(context.Background(), provider.New(version), opts) ``` -------------------------------- ### ExecuteCommand Examples Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/cli.md Provides examples of using ExecuteCommand to perform various operations like getting, creating, listing, editing, and deleting secrets and projects. ```go cli := cli.NewCli(token, serverURL) // Get a secret by ID stdout, err := cli.ExecuteCommand("secret", "get", "secret-id-123") if err != nil { // handle error } var secret types.JSONSecret json.Unmarshal(stdout, &secret) ``` ```go // Create a secret stdout, err := cli.ExecuteCommand("secret", "create", "--note", "My note", "secret-key", "secret-value", "project-id") ``` ```go // List secrets stdout, err := cli.ExecuteCommand("list", "secrets") ``` ```go // Get a project stdout, err := cli.ExecuteCommand("project", "get", "project-id-123") ``` ```go // Create a project stdout, err := cli.ExecuteCommand("project", "create", "My Project") ``` ```go // Edit a secret stdout, err := cli.ExecuteCommand("secret", "edit", "--key", "new-key", "--value", "new-value", "--note", "updated note", "secret-id-123") ``` ```go // Delete a secret stdout, err := cli.ExecuteCommand("secret", "delete", "secret-id-123") ``` -------------------------------- ### Cli Constructor Usage Examples Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/cli.md Demonstrates how to instantiate the Cli wrapper with and without a custom server URL. ```go // From provider configuration cli := cli.NewCli("your_access_token", "https://your-server.com") ``` ```go // From provider configuration (no custom server URL) cli := cli.NewCli("your_access_token", "") ``` -------------------------------- ### Terraform HCL Example: Creating a Bitwarden Project Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/MANIFEST.txt This example demonstrates how to create a new project in Bitwarden using the `bitwarden-secrets_project` resource. It requires the project's name. ```hcl resource "bitwarden-secrets_project" "example" { name = "my-new-project" } ``` -------------------------------- ### Terraform Provider Configuration Example Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/provider.md Example of how to configure the bitwarden-secrets provider in your Terraform configuration, specifying the source, version, and authentication details. ```terraform terraform { required_providers { bitwarden-secrets = { source = "bitwarden-secrets" version = ">= 0.1.0" } } } provider "bitwarden-secrets" { access_token = "your_access_token_here" server_url = "https://your-bitwarden-server.com" # Optional } ``` -------------------------------- ### Terraform HCL Example: Importing a Bitwarden Project Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/MANIFEST.txt This example shows how to import an existing Bitwarden project into Terraform management. You need to provide the project's ID from Bitwarden. ```hcl resource "bitwarden-secrets_project" "example" { # ... other configuration ... } # To import, run: terraform import bitwarden-secrets_project.example ``` -------------------------------- ### Full Configuration Example with Projects and Secrets Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/resources.md Demonstrates a complete Terraform configuration defining two projects ('staging' and 'production') and associated secrets for each. This showcases resource dependencies. ```terraform resource "bitwarden-secrets_project" "staging" { name = "Staging Environment" } resource "bitwarden-secrets_project" "production" { name = "Production Environment" } resource "bitwarden-secrets_secret" "staging_db" { project_id = bitwarden-secrets_project.staging.id key = "database_url" value = "postgresql://staging.db.example.com/app" } resource "bitwarden-secrets_secret" "prod_db" { project_id = bitwarden-secrets_project.production.id key = "database_url" value = "postgresql://prod.db.example.com/app" } ``` -------------------------------- ### Go Example: Creating a CLI Command Execution Wrapper Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/MANIFEST.txt This Go code demonstrates how to create a wrapper for executing Bitwarden CLI commands using the `NewCli()` function. It shows how to initialize the CLI wrapper with a configuration that includes the server URL and access token. ```go import ( "github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/bitwarden" ) func NewCliWrapper() (*bitwarden.Cli, error) { // Assuming configuration is available, e.g., from environment variables or flags config := &bitwarden.CliConfig{ ServerURL: "https://your.bitwarden.instance.com", AccessToken: "your_access_token", } cli := bitwarden.NewCli(config) return cli, nil } ``` -------------------------------- ### bitwarden-secrets_project_list Data Source Example Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/docs/data-sources/project_list.md This is a basic example of how to use the bitwarden-secrets_project_list data source to retrieve a list of projects. No specific configuration is required. ```terraform data "bitwarden-secrets_project_list" "example" { } ``` -------------------------------- ### Terraform HCL Example: Reading All Bitwarden Projects Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/MANIFEST.txt This example demonstrates how to read all Bitwarden projects using the `bitwarden-secrets_project_list` data source. It returns a list of projects, each with its ID and name. ```hcl data "bitwarden-secrets_project_list" "all" { } output "all_projects" { description = "A map of all projects" value = { for project in data.bitwarden-secrets_project_list.all.projects : project.name => project.id } } ``` -------------------------------- ### Go Example: Constructing a Project Resource Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/MANIFEST.txt This Go code demonstrates how to construct a `bitwarden-secrets_project` resource using the `NewProjectResource()` function. This is typically used within the Terraform provider's resource implementation. ```go import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func NewProjectResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { Type: schema.TypeString, Required: true, Description: "The name of the project.", }, "id": { Type: schema.TypeString, Computed: true, Description: "The unique identifier of the project.", }, }, // ... Create, Read, Update, Delete methods would be defined here ... } } ``` -------------------------------- ### Go Example: Creating a Bitwarden Secrets Provider Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/MANIFEST.txt This Go code demonstrates how to instantiate the Bitwarden Secrets Terraform provider using the `New()` function. It shows how to configure the provider with an access token and server URL. ```go import ( "github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/bitwarden" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func ProviderConfigure(d *schema.ResourceData) (interface{}, diag.Diagnostics) { // ... retrieve access_token and server_url from schema ... client, err := bitwarden.New( &bitwarden.Config{ AccessToken: d.Get("access_token").(string), ServerURL: d.Get("server_url").(string), }, ) if err != nil { return nil, diag.Errorf("failed to create Bitwarden client: %s", err) } return client, nil } ``` -------------------------------- ### Verify Bitwarden CLI Installation Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/configuration.md Verify that the Bitwarden Secrets Manager CLI is installed and accessible in your system's PATH. Ensure you are using v0.5.0 or later. ```bash # Download and install from Bitwarden # See: https://bitwarden.com/help/secrets-manager-cli/ # Verify installation bws --help ``` -------------------------------- ### Build Terraform Provider Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/README.md Builds the Terraform provider using the Go install command. Ensure the Secrets Manager CLI is in your PATH. ```shell go install ``` -------------------------------- ### Go Example: Constructing a Project Data Source Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/MANIFEST.txt This Go code demonstrates how to construct a `bitwarden-secrets_project` data source using the `NewProjectDataSource()` function. This is used to read project information within Terraform configurations. ```go import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func NewProjectDataSource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { Type: schema.TypeString, Required: true, Description: "The name of the project.", }, "id": { Type: schema.TypeString, Computed: true, Description: "The unique identifier of the project.", }, }, // ... Read method would be defined here ... } } ``` -------------------------------- ### Provider Configuration with Variables Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/configuration.md This example demonstrates configuring the provider using Terraform variables for both the access token and the server URL. This is useful for managing sensitive information and environment-specific settings. ```terraform variable "bitwarden_token" { description = "Bitwarden Secrets Manager access token" type = string sensitive = true } variable "bitwarden_server" { description = "Bitwarden server URL (optional)" type = string default = "" } provider "bitwarden-secrets" { access_token = var.bitwarden_token server_url = var.bitwarden_server } ``` -------------------------------- ### Resource Read Method Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Retrieves the resource ID from the state, executes the CLI get command, parses the response, and updates the state. ```go func (r *ResourceType) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) ``` -------------------------------- ### Terraform HCL Example: Reading a Single Bitwarden Project Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/MANIFEST.txt This example demonstrates how to read a single Bitwarden project using the `bitwarden-secrets_project` data source. It requires the project's name. ```hcl data "bitwarden-secrets_project" "example" { name = "my-project-name" } output "project_id" { description = "The ID of the project" value = data.bitwarden-secrets_project.example.id } ``` -------------------------------- ### Go Example: Constructing a Projects List Data Source Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/MANIFEST.txt This Go code demonstrates how to construct a `bitwarden-secrets_project_list` data source using the `NewProjectsDataSource()` function. This is used to read multiple project information within Terraform configurations. ```go import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func NewProjectsDataSource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ "projects": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": { Type: schema.TypeString, Computed: true, Description: "The unique identifier of the project.", }, "name": { Type: schema.TypeString, Computed: true, Description: "The name of the project.", }, } }, Description: "List of projects.", }, }, // ... Read method would be defined here ... } } ``` -------------------------------- ### JSON to Go to Terraform Type Mapping Example Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/schemas.md Illustrates the transformation of a JSON response into Go structs and then into Terraform state, showing how plain Go strings are converted to Terraform framework types. ```text JSON Response (CLI) ↓ json.Unmarshal → JSONSecret / JSONProject (plain Go strings) ↓ Parse() method → SecretModel / ProjectModel (types.String) ↓ Terraform Plugin Framework (state, plan, config) ``` ```text {"id": "abc123"} ↓ JSONSecret{ID: "abc123"} ↓ SecretModel{ID: types.StringValue("abc123")} ↓ Terraform state: "id" = "abc123" ``` -------------------------------- ### Terraform HCL Example: Reading All Bitwarden Secrets in a Project Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/MANIFEST.txt This example demonstrates how to read all secrets within a specific Bitwarden project using the `bitwarden-secrets_secret_list` data source. It returns a list of secrets, each with its name and value. ```hcl data "bitwarden-secrets_secret_list" "all" { projectid = "my-project-id" } output "all_secrets" { description = "A map of all secrets in the project" value = { for secret in data.bitwarden-secrets_secret_list.all.secrets : secret.name => secret.value } sensitive = true } ``` -------------------------------- ### Terraform HCL Example: Importing a Bitwarden Secret Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/MANIFEST.txt This example shows how to import an existing Bitwarden secret into Terraform management. You need to provide the secret's ID from Bitwarden. ```hcl resource "bitwarden-secrets_secret" "example" { # ... other configuration ... # Import existing secret by its Bitwarden ID lifecycle { create_before_destroy = false ignore_changes = [ value ] } } # To import, run: terraform import bitwarden-secrets_secret.example ``` -------------------------------- ### Terraform HCL Example: Creating a Bitwarden Secret Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/MANIFEST.txt This example demonstrates how to create a new secret in Bitwarden using the `bitwarden-secrets_secret` resource. It requires the secret's name, value, and the project ID it belongs to. The secret value is marked as sensitive. ```hcl resource "bitwarden-secrets_secret" "example" { name = "my-secret-name" value = "my-secret-value" projectid = "my-project-id" notes = "Optional notes for the secret" tags = ["tag1", "tag2"] # The secret value is sensitive and will be hidden in Terraform output lifecycle { prevent_destroy = true } } ``` -------------------------------- ### Terraform Configuration for Creating a Project Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/resources.md Example Terraform configuration to create a Bitwarden project named 'Production Secrets'. Ensure the `name` field is provided. ```terraform resource "bitwarden-secrets_project" "example" { name = "Production Secrets" } ``` -------------------------------- ### Go Example: Constructing a Secret Data Source Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/MANIFEST.txt This Go code demonstrates how to construct a `bitwarden-secrets_secret` data source using the `NewSecretDataSource()` function. This is used to read secret information within Terraform configurations. ```go import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func NewSecretDataSource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { Type: schema.TypeString, Required: true, Description: "The name of the secret.", }, "value": { Type: schema.TypeString, Computed: true, Sensitive: true, Description: "The value of the secret.", }, "projectid": { Type: schema.TypeString, Required: true, Description: "The ID of the project the secret belongs to.", }, "notes": { Type: schema.TypeString, Computed: true, Description: "Optional notes for the secret.", }, "tags": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, Description: "Tags associated with the secret.", }, }, // ... Read method would be defined here ... } } ``` -------------------------------- ### Import bitwarden-secrets_project into Terraform Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/schemas.md Usage example for importing an existing Bitwarden project into Terraform state management. ```bash terraform import bitwarden-secrets_project.example project-id-456 ``` -------------------------------- ### Create Secret Terraform Configuration Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/resources.md Example Terraform configuration for creating a new Bitwarden secret. ```terraform resource "bitwarden-secrets_secret" "example" { project_id = bitwarden-secrets_project.example.id key = "db_password" value = "secure_password_123" note = "Database connection password" } ``` -------------------------------- ### Go Example: Constructing a Secret Resource Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/MANIFEST.txt This Go code demonstrates how to construct a `bitwarden-secrets_secret` resource using the `NewSecretResource()` function. This is typically used within the Terraform provider's resource implementation. ```go import ( "github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/bitwarden" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func NewSecretResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { Type: schema.TypeString, Required: true, Description: "The name of the secret.", }, "value": { Type: schema.TypeString, Required: true, Sensitive: true, Description: "The value of the secret.", }, "projectid": { Type: schema.TypeString, Required: true, Description: "The ID of the project the secret belongs to.", }, "notes": { Type: schema.TypeString, Optional: true, Description: "Optional notes for the secret.", }, "tags": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Description: "Tags associated with the secret.", }, }, // ... Create, Read, Update, Delete methods would be defined here ... } } ``` -------------------------------- ### Terraform HCL Example: Reading a Single Bitwarden Secret Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/MANIFEST.txt This example demonstrates how to read a single secret from Bitwarden using the `bitwarden-secrets_secret` data source. It requires the secret's name and the project ID. ```hcl data "bitwarden-secrets_secret" "example" { name = "my-secret-name" projectid = "my-project-id" } output "secret_value" { description = "The value of the secret" value = data.bitwarden-secrets_secret.example.value sensitive = true } ``` -------------------------------- ### Terraform Configuration for Updating a Project Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/resources.md Example Terraform configuration demonstrating how to update the name of an existing Bitwarden project. Only the `name` field is updateable. ```terraform resource "bitwarden-secrets_project" "example" { name = "Production Secrets - Updated" # Changed } ``` -------------------------------- ### Project and Secret Resource Configuration Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/resources.md Example Terraform configuration for creating a project and then defining two secrets within that project. ```terraform resource "bitwarden-secrets_project" "main" { name = "My Project" } resource "bitwarden-secrets_secret" "db_password" { project_id = bitwarden-secrets_project.main.id key = "database_password" value = "super_secret_123" note = "Production database password" } resource "bitwarden-secrets_secret" "api_key" { project_id = bitwarden-secrets_project.main.id key = "api_key" value = "sk_live_abc123def456" note = "External API key" } ``` -------------------------------- ### Go Example: Constructing a Secrets List Data Source Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/MANIFEST.txt This Go code demonstrates how to construct a `bitwarden-secrets_secret_list` data source using the `NewSecretsDataSource()` function. This is used to read multiple secret information within Terraform configurations. ```go import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func NewSecretsDataSource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ "projectid": { Type: schema.TypeString, Required: true, Description: "The ID of the project to list secrets from.", }, "secrets": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { Type: schema.TypeString, Computed: true, Description: "The name of the secret.", }, "value": { Type: schema.TypeString, Computed: true, Sensitive: true, Description: "The value of the secret.", }, "notes": { Type: schema.TypeString, Computed: true, Description: "Optional notes for the secret.", }, "tags": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, Description: "Tags associated with the secret.", }, } }, Description: "List of secrets in the project.", }, }, // ... Read method would be defined here ... } } ``` -------------------------------- ### Terraform Configuration to Use Project Metadata in Resources Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/data_sources.md Example Terraform configuration showing how to use project metadata, such as name and organization ID, retrieved by the data source within other resources. This allows for dynamic configuration based on Bitwarden project details. ```terraform # Use project metadata in resources data "bitwarden-secrets_project" "main" { id = "project-id-xyz789" } resource "local_file" "project_info" { content = "Project: ${data.bitwarden-secrets_project.main.name}\nOrg: ${data.bitwarden-secrets_project.main.organization_id}" filename = "/tmp/project_info.txt" } ``` -------------------------------- ### Import Secret State Command Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/resources.md Example bash command for importing an existing Bitwarden secret into Terraform state. ```bash terraform import bitwarden-secrets_secret.example secret-id-123 ``` -------------------------------- ### Create a Bitwarden Secret Resource Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/configuration.md Example of creating a secret resource using the Bitwarden Secrets provider. This resource automatically uses the configured CLI instance. ```terraform resource "bitwarden-secrets_secret" "example" { project_id = "project-id-123" key = "api_key" value = "sk_live_abcd1234" note = "API key for external service" } ``` -------------------------------- ### Import Project State Command Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/resources.md Example bash command to import an existing Bitwarden project into Terraform state using its project ID. The import ID format is 'project-id-'. ```bash terraform import bitwarden-secrets_project.example project-id-123 ``` -------------------------------- ### Terraform: Find Project by Name Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/data_sources.md This example demonstrates how to filter the list of all projects to find a specific project by its name, "Production". The `prod_project_id` output will display the ID of the found project. ```terraform # Find project by name data "bitwarden-secrets_project_list" "all" {} locals { prod_project = [ for p in data.bitwarden-secrets_project_list.all.projects : p if p.name == "Production" ][0] } output "prod_project_id" { value = local.prod_project.id } ``` -------------------------------- ### Terraform Configuration to Read a Project Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/data_sources.md Example Terraform configuration to read a specific project using its ID. This snippet demonstrates how to declare the data source and specify the required 'id' attribute. ```terraform # Read a specific project data "bitwarden-secrets_project" "main" { id = "project-id-xyz789" } output "project_name" { value = data.bitwarden-secrets_project.main.name } ``` -------------------------------- ### Resource Create Method Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Parses the plan, validates input, executes the CLI create command, parses the response, and updates the state. ```go func (r *ResourceType) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) ``` -------------------------------- ### Resource Configure Method Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Extracts the CLI instance from provider data and stores it in the receiver. ```go func (r *ResourceType) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) ``` -------------------------------- ### Data Source Implementation Pattern Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Illustrates the typical sequence of methods for implementing a data source in the provider. ```go Type → Metadata() → Schema() → Configure() → Read() ``` -------------------------------- ### CLI Not Found Error Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/configuration.md This error indicates that the Bitwarden Secrets Manager CLI is not installed or not accessible in the system's PATH. Ensure the CLI is installed and correctly configured. ```bash error: bws: command not found ``` -------------------------------- ### NewCli Constructor Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/cli.md Creates a new Cli instance. Use this to initialize the CLI wrapper with your Bitwarden access token and optionally a custom server URL. ```go func NewCli(token string, server_url string) *Cli ``` -------------------------------- ### Create New CLI Instance Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Instantiates a new Cli struct for interacting with the Bitwarden CLI. Use an empty string for server_url to use the default server. ```go cli := cli.NewCli("my_token_123", "https://bitwarden.company.com") cli2 := cli.NewCli("my_token_456", "") // Use default server ``` -------------------------------- ### Read Method Signature Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Parses configuration, executes CLI commands, processes the response, and sets the state. ```go func (d *DataSourceType) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) ``` -------------------------------- ### Provider Configuration Integration Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/cli.md Shows how the Cli instance is created during provider configuration and passed to resources and data sources. ```go // In BitwardenSecretsProvider.Configure() cli := cli.NewCli(data.AccessToken.ValueString(), data.ServerURL.ValueString()) resp.DataSourceData = cli resp.ResourceData = cli ``` ```go // In resource/data source Configure() cli, ok := req.ProviderData.(*cli.Cli) if !ok { // Error handling } ``` -------------------------------- ### BitwardenSecretsProvider.Configure Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Configures the provider by parsing user-provided configuration and initializing the necessary client. ```APIDOC ## Method: BitwardenSecretsProvider.Configure ### Description Configures the provider by parsing the configuration block provided by the user. It initializes the internal client using the provided access token and server URL, and sets up the necessary data for subsequent operations. ### Receiver `*BitwardenSecretsProvider` ### Signature ```go func (p *BitwardenSecretsProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) ``` ### Parameters - `ctx` (`context.Context`) - Context for the request. - `req` (`provider.ConfigureRequest`) - The configure request object containing the provider's configuration. - `resp` (`*provider.ConfigureResponse`) - The response object, which will be modified in-place. ### Behavior 1. Parses provider configuration into `ScaffoldingProviderModel`. 2. Creates `Cli` instance with access token and server URL. 3. Sets response `DataSourceData` and `ResourceData` to CLI instance. 4. Adds diagnostic errors if parsing fails. ``` -------------------------------- ### Update Secret Terraform Configuration Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/resources.md Example Terraform configuration showing an updated value for an existing secret. ```terraform resource "bitwarden-secrets_secret" "example" { # ... existing configuration ... value = "new_password_456" # Updated } ``` -------------------------------- ### Create Project Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/resources.md Creates a new project in Bitwarden. Requires a project name. ```APIDOC ## Create Project ### Description Creates a new project in Bitwarden. Requires a project name. ### Method Create ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **name** (string) - Required - The name of the project. ### Request Example ```terraform resource "bitwarden-secrets_project" "example" { name = "Production Secrets" } ``` ### Response #### Success Response (200) - **id** (string) - Unique identifier for the project - **organization_id** (string) - Organization ID associated with the project - **name** (string) - Project name - **creation_date** (string) - ISO 8601 creation timestamp - **revision_date** (string) - ISO 8601 last revision timestamp #### Response Example (Terraform state will reflect the created project details) ``` -------------------------------- ### List All Projects via CLI Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/schemas.md This CLI command lists all projects accessible within the current context. No parameters are needed. ```bash bws list projects ``` -------------------------------- ### BitwardenSecretsProvider Configure Method Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/provider.md Parses provider configuration and initializes the Bitwarden Secrets CLI client. Handles error diagnostics for configuration parsing failures. ```go func (p *BitwardenSecretsProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) ``` -------------------------------- ### CLI Integration ExecuteCommand Flow Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/README.md Illustrates the process of executing commands through the provider's `Cli` instance. It shows how arguments are prepared, including authentication and server URL, before being passed to the `bws` binary and how output is captured. ```text ExecuteCommand(args...) ↓ Prepend: [--access-token ] ↓ Optionally append: [--server-url ] ↓ Execute: bws ↓ Capture stdout (JSON) / stderr (errors) ↓ Return []byte (stdout) or error (stderr) ``` -------------------------------- ### Configure Method Signature Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Extracts provider data, such as the CLI instance, and stores it in the receiver. ```go func (d *DataSourceType) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) ``` -------------------------------- ### Bitwarden Secrets Provider Configuration Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/resources.md Example Terraform configuration block for setting up the Bitwarden Secrets provider, including required providers and access token. ```terraform terraform { required_providers { bitwarden-secrets = { source = "bitwarden-secrets" version = ">= 0.1.0" } } } provider "bitwarden-secrets" { access_token = var.bitwarden_token } ``` -------------------------------- ### Retrieve a Bitwarden Secret Data Source Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/configuration.md Example of using a data source to retrieve an existing secret. The secret's value can then be outputted, marked as sensitive. ```terraform data "bitwarden-secrets_secret" "existing" { id = "secret-id-xyz789" } output "secret_value" { value = data.bitwarden-secrets_secret.existing.value sensitive = true } ``` -------------------------------- ### BitwardenSecretsProvider.Resources Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Returns a list of resource constructors that the provider supports. ```APIDOC ## Method: BitwardenSecretsProvider.Resources ### Description Returns an array of constructor functions for the resources supported by this provider. These constructors are used by Terraform to instantiate and manage resources. ### Receiver `*BitwardenSecretsProvider` ### Signature ```go func (p *BitwardenSecretsProvider) Resources(ctx context.Context) []func() resource.Resource ``` ### Parameters - `ctx` (`context.Context`) - Context for the request. ### Returns - `[]func() resource.Resource` - An array of resource constructors. ### Behavior Returns constructor functions for: - `NewSecretResource` - `NewProjectResource` ``` -------------------------------- ### Resource Update Method Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Parses the plan, validates input, executes the CLI edit command, parses the response, and updates the state. ```go func (r *ResourceType) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) ``` -------------------------------- ### Get Bitwarden Project by ID Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/docs/data-sources/project.md Use this data source to retrieve details of a Bitwarden project by its unique identifier. Ensure you have the project's ID available. ```terraform data "bitwarden-secrets_project" "example" { id = "some-id" } ``` -------------------------------- ### Read a Specific Secret by ID Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/data_sources.md Example of how to read a specific secret using its ID with the `bitwarden-secrets_secret` data source. The secret's value can then be outputted or used in other resources. ```terraform # Read a specific secret by ID data "bitwarden-secrets_secret" "api_key" { id = "secret-id-abc123" } output "api_key_value" { value = data.bitwarden-secrets_secret.api_key.value sensitive = true } # Use secret in a resource resource "aws_secretsmanager_secret" "api_key" { name = "external-api-key" } resource "aws_secretsmanager_secret_version" "api_key" { secret_id = aws_secretsmanager_secret.api_key.id secret_string = data.bitwarden-secrets_secret.api_key.value } ``` -------------------------------- ### Create a project managed by Terraform Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/docs/resources/project.md Use this resource to create a new project in Bitwarden that can be managed by Terraform. Ensure the `name` attribute is set. ```terraform # Create a project managed by Terraform resource "bitwarden-secrets_secret" "example" { name = "example" } ``` -------------------------------- ### Run Acceptance Tests Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/README.md Executes the full suite of acceptance tests for the provider. Note that these tests create real resources and may incur costs. ```shell make testacc ``` -------------------------------- ### ExecuteCommand Method Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/cli.md Executes a command against the Bitwarden Secrets Manager CLI. It automatically injects the access token and server URL before running the command. ```go func (c *Cli) ExecuteCommand(args ...string) ([]byte, error) ``` -------------------------------- ### BitwardenSecretsProvider Resources Method Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/provider.md Returns constructor functions for managed resources like secrets and projects. ```go func (p *BitwardenSecretsProvider) Resources(ctx context.Context) []func() resource.Resource ``` -------------------------------- ### BitwardenSecretsProvider.Functions Method Signature Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Returns constructor functions for any provider-level functions. Currently returns nil as no functions are defined. ```go func (p *BitwardenSecretsProvider) Functions(ctx context.Context) []func() function.Function ``` -------------------------------- ### Terraform: Retrieve All Projects Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/data_sources.md Use this snippet to fetch a list of all available projects from Bitwarden. The output `project_names` will contain a list of project names. ```terraform # Retrieve all projects data "bitwarden-secrets_project_list" "all" {} output "project_names" { value = [for p in data.bitwarden-secrets_project_list.all.projects : p.name] } ``` -------------------------------- ### NewProjectResource Constructor Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Constructs a new ProjectResource instance. This function is part of the internal provider package. ```go func NewProjectResource() resource.Resource ``` -------------------------------- ### Resource Constructors Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Constructors for creating new resource instances. ```APIDOC ## Function: NewSecretResource ### Description Creates a new instance of the Secret resource. ### Signature ```go func NewSecretResource() resource.Resource ``` ### Returns `resource.Resource` — new SecretResource instance ``` ```APIDOC ## Function: NewProjectResource ### Description Creates a new instance of the Project resource. ### Signature ```go func NewProjectResource() resource.Resource ``` ### Returns `resource.Resource` — new ProjectResource instance ``` -------------------------------- ### Read Project Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/resources.md Reads the current state of a project from Bitwarden. ```APIDOC ## Read Project ### Description Reads the current state of a project from Bitwarden. This operation is automatically called by Terraform to refresh resource state. ### Method Read ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **id** (string) - Unique identifier for the project - **organization_id** (string) - Organization ID associated with the project - **name** (string) - Project name - **creation_date** (string) - ISO 8601 creation timestamp - **revision_date** (string) - ISO 8601 last revision timestamp #### Response Example (Terraform state will reflect the current project details) ``` -------------------------------- ### BitwardenSecretsProvider.DataSources Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Returns a list of data source constructors that the provider supports. ```APIDOC ## Method: BitwardenSecretsProvider.DataSources ### Description Returns an array of constructor functions for the data sources supported by this provider. These constructors are used by Terraform to instantiate and query data sources. ### Receiver `*BitwardenSecretsProvider` ### Signature ```go func (p *BitwardenSecretsProvider) DataSources(ctx context.Context) []func() datasource.DataSource ``` ### Parameters - `ctx` (`context.Context`) - Context for the request. ### Returns - `[]func() datasource.DataSource` - An array of data source constructors. ### Behavior Returns constructor functions for: - `NewSecretDataSource` - `NewProjectDataSource` - `NewSecretsDataSource` (secret list) - `NewProjectsDataSource` (project list) ``` -------------------------------- ### BitwardenSecretsProvider DataSources Method Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/provider.md Returns constructor functions for data sources to read or list secrets and projects. ```go func (p *BitwardenSecretsProvider) DataSources(ctx context.Context) []func() datasource.DataSource ``` -------------------------------- ### BitwardenSecretsProvider.Functions Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Returns a list of function constructors that the provider supports. Currently, no functions are defined. ```APIDOC ## Method: BitwardenSecretsProvider.Functions ### Description Returns an array of constructor functions for the functions supported by this provider. Currently, this provider does not define any functions. ### Receiver `*BitwardenSecretsProvider` ### Signature ```go func (p *BitwardenSecretsProvider) Functions(ctx context.Context) []func() function.Function ``` ### Parameters - `ctx` (`context.Context`) - Context for the request. ### Returns - `[]func() function.Function` - An array of function constructors (currently empty). ### Behavior Currently returns `nil` (no provider functions defined). ``` -------------------------------- ### Resource Schema Method Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Defines the resource schema, specifying its attributes. ```go func (r *ResourceType) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) ``` -------------------------------- ### Resource Implementation Methods Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Common methods implemented by resources for managing their lifecycle. ```APIDOC ## Method: Metadata ### Description Sets the resource type name. ### Signature ```go func (r *ResourceType) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) ``` ### Usage Sets `resp.TypeName` to provider type + resource name (e.g., `"bitwarden-secrets_secret"`). ``` ```APIDOC ## Method: Schema ### Description Defines the resource schema with attributes. ### Signature ```go func (r *ResourceType) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) ``` ``` ```APIDOC ## Method: Configure ### Description Extracts CLI instance from provider data and stores it in the receiver. ### Signature ```go func (r *ResourceType) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) ``` ``` ```APIDOC ## Method: Create ### Description Handles the creation of a resource. ### Signature ```go func (r *ResourceType) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) ``` ### Usage Parses plan, validates, executes CLI create command, parses response, updates state. ``` ```APIDOC ## Method: Read ### Description Handles reading the state of a resource. ### Signature ```go func (r *ResourceType) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) ``` ### Usage Gets ID from state, executes CLI get command, parses response, updates state. ``` ```APIDOC ## Method: Update ### Description Handles updating an existing resource. ### Signature ```go func (r *ResourceType) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) ``` ### Usage Parses plan, validates, executes CLI edit command, parses response, updates state. ``` ```APIDOC ## Method: Delete ### Description Handles deleting a resource. ### Signature ```go func (r *ResourceType) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) ``` ### Usage Gets ID from state, executes CLI delete command. ``` ```APIDOC ## Method: ImportState ### Description Handles importing an existing resource into Terraform state. ### Signature ```go func (r *ResourceType) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) ``` ### Usage Passes through the import ID to be read as the resource ID. ``` -------------------------------- ### NewProjectDataSource Constructor Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Constructs a new ProjectDataSource instance. This function is part of the internal provider package. ```go func NewProjectDataSource() datasource.DataSource ``` -------------------------------- ### Create Project Operation Signature Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/resources.md Signature for the `Create` method of the `ProjectResource`, responsible for creating a new Bitwarden project. ```go func (r *ProjectResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) ``` -------------------------------- ### Data Source Constructors Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Constructors for creating new data source instances. ```APIDOC ## Function: NewSecretDataSource ### Description Creates a new instance of the Secret data source. ### Signature ```go func NewSecretDataSource() datasource.DataSource ``` ### Returns `datasource.DataSource` — new SecretDataSource instance ``` ```APIDOC ## Function: NewSecretsDataSource ### Description Creates a new instance of the Secrets data source. ### Signature ```go func NewSecretsDataSource() datasource.DataSource ``` ### Returns `datasource.DataSource` — new SecretsDataSource instance ``` ```APIDOC ## Function: NewProjectDataSource ### Description Creates a new instance of the Project data source. ### Signature ```go func NewProjectDataSource() datasource.DataSource ``` ### Returns `datasource.DataSource` — new ProjectDataSource instance ``` ```APIDOC ## Function: NewProjectsDataSource ### Description Creates a new instance of the Projects data source. ### Signature ```go func NewProjectsDataSource() datasource.DataSource ``` ### Returns `datasource.DataSource` — new ProjectsDataSource instance ``` -------------------------------- ### Create bitwarden-secrets_project via CLI Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/schemas.md Command to create a new project using the Bitwarden CLI. The project name is a required parameter. ```bash bws project create ``` -------------------------------- ### NewProjectsDataSource Constructor Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Constructs a new ProjectsDataSource instance. This function is part of the internal provider package. ```go func NewProjectsDataSource() datasource.DataSource ``` -------------------------------- ### BitwardenSecretsProvider Metadata Method Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/provider.md Provides the provider type name and version string for Terraform. ```go func (p *BitwardenSecretsProvider) Metadata(ctx context.Context, req provider.MetadataRequest, resp *provider.MetadataResponse) ``` -------------------------------- ### Execute Bitwarden CLI Command Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Executes a Bitwarden CLI command with provided arguments. Captures stdout and stderr, returning JSON output on success or an error on failure. ```go // Get a secret stdout, err := cli.ExecuteCommand("secret", "get", "secret-id-123") if err != nil { log.Fatal("Failed to get secret:", err) } ``` ```go // Create a secret stdout, err := cli.ExecuteCommand("secret", "create", "--note", "My note", "key", "value", "project-id") ``` ```go // List secrets stdout, err := cli.ExecuteCommand("list", "secrets") ``` ```go // Delete a project stdout, err := cli.ExecuteCommand("project", "delete", "project-id-456") ``` -------------------------------- ### Project Resource Constructor Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/MANIFEST.txt Provides the constructor for the `bitwarden-secrets_project` resource. ```APIDOC ## NewProjectResource() ### Description Constructor for the `bitwarden-secrets_project` Terraform resource. ### Signature `NewProjectResource() (*ProjectResource, error)` ### Returns - `*ProjectResource`: A pointer to the newly created project resource instance. - `error`: An error if the resource could not be created. ``` -------------------------------- ### Read a Single Project via CLI Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/schemas.md This CLI command retrieves a specific project using its ID. Ensure you provide the correct project ID. ```bash bws project get ``` -------------------------------- ### Implement Data Source Read Function Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/data_sources.md Implements the Read function for the Secrets Data Source, responsible for fetching secrets from Bitwarden. ```go func (d *SecretsDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) ``` -------------------------------- ### BitwardenSecretsProvider Type Definition Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/provider.md Defines the main provider struct which holds the version information. ```go type BitwardenSecretsProvider struct { version string } ``` -------------------------------- ### Metadata Method Signature Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/api-reference.md Sets the data source type name, combining the provider type with the data source name. ```go func (d *DataSourceType) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) ``` -------------------------------- ### Project Data Source Constructor Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/MANIFEST.txt Provides the constructor for the `bitwarden-secrets_project` data source. ```APIDOC ## NewProjectDataSource() ### Description Constructor for the `bitwarden-secrets_project` Terraform data source (read single). ### Signature `NewProjectDataSource() (*ProjectDataSource, error)` ### Returns - `*ProjectDataSource`: A pointer to the newly created project data source instance. - `error`: An error if the data source could not be created. ``` -------------------------------- ### Projects List Data Source Constructor Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/MANIFEST.txt Provides the constructor for the `bitwarden-secrets_project_list` data source. ```APIDOC ## NewProjectsDataSource() ### Description Constructor for the `bitwarden-secrets_project_list` Terraform data source (read all). ### Signature `NewProjectsDataSource() (*ProjectsDataSource, error)` ### Returns - `*ProjectsDataSource`: A pointer to the newly created projects list data source instance. - `error`: An error if the data source could not be created. ``` -------------------------------- ### List All Secrets via CLI Source: https://github.com/sebastiaan-dev/terraform-provider-bitwarden-secrets/blob/main/_autodocs/schemas.md This CLI command lists all secrets accessible within the current context. No parameters are required. ```bash bws list secrets ```