Requirements
- Connect server
- Service account
- 1Password app
Get started
- Connect server
- Service account
- 1Password app
To use the 1Password Terraform provider with a Connect server:
-
Specify the Connect server token.
You can set this value with the
OP_CONNECT_TOKENenvironment variable or with theconnect_tokenfield in the provider configuration. -
Specify the Connect server hostname, URL, or IP address.
You can set this value with the
OP_CONNECT_HOSTenvironment variable or with theconnect_urlfield in the provider configuration.
Reference
The following sections contain reference information for the 1Password Terraform provider:Configuration
The 1Password Terraform provider has fields you must set before you can use it with a 1Password Connect server, service account, or the 1Password desktop app. The following table describes each field.
You can use the following environment variables to specify configuration values.
Configuration examples
The following code blocks show configuration examples.- Connect server
- Service account
- 1Password app
The following example shows a provider configuration using a Connect server:
connect-example.tf
Resources
The 1Password Terraform provider has the following resources:Item resource
Theonepassword_item resource represents a 1Password item. You can import a onepassword_item with the following syntax:
Schema
The following tables describe theonepassword_item resource schema.
password_recipe
The nested schema for the password_recipe field:
section
The nested schema for the section field:
section_map
The nested schema for the section_map field:
section.field
The nested schema for the section.field field:
field_map
The nested schema for the field_map field:
section.field.password_recipe
The nested schema for the section.field.password_recipe field:
Example
The following code block shows an example usage of theonepassword_item resource.
resource.tf
Data sources
The 1Password Terraform provider has the following data sources:Item data source
Use theonepassword_item data source to get details of a 1Password item. You can identify an item by its vault UUID and either the item’s title or UUID.
Schema
The following tables describe theonepassword_item resource schema.
section
The nested schema for the section field:
section.field
The nested schema for the section.field field:
Example
The following example shows how to use theonepassword_item data source.
data-source.tf
Vault data source
Use theonepassword_vault data source to get details of a vault. You can identify a vault with the vault name or UUID.
Schema
The following tables describe theonepassword_vault resource schema.
Environment data source
Use theonepassword_environment data source to read variables from a 1Password Environment. Identify an environment by its ID.
Schema
The following tables describe theonepassword_environment resource schema.
metadata
The nested schema for the metadata field:
Example
The following example shows how to use theonepassword_environment data source.
data-source.tf
Ephemeral resources
The 1Password Terraform provider has the following ephemeral resources:Item ephemeral resource
Theonepassword_item ephemeral resource represents a 1Password item. Use it to retrieve item values without storing them in Terraform state. This is useful for providing sensitive values to write-only arguments or other ephemeral contexts.