|
| 1 | +--- |
| 2 | +# generated by https://github.com/hashicorp/terraform-plugin-docs |
| 3 | +page_title: "docker_org_access_token Data Source - docker" |
| 4 | +subcategory: "" |
| 5 | +description: |- |
| 6 | + Reads metadata for an existing organization access token. |
| 7 | + Provide either id for a direct lookup or a filter block to resolve exactly one token by metadata. The filter block follows the common Terraform name/value pattern and currently supports label only. |
| 8 | + -> Note: This data source is only available when authenticated with a username and password as an owner of the org. |
| 9 | + -> Note: This data source returns metadata only. Docker Hub only returns the secret token value during creation, so token is intentionally not exposed here. |
| 10 | + -> Note: Filter-based lookups scan all organization access token pages to guarantee unique matching, even if the provider max_page_results setting is lower. |
| 11 | + Example Usage |
| 12 | + |
| 13 | + data "docker_org_access_token" "by_id" { |
| 14 | + org_name = "my-organization" |
| 15 | + id = "a7a5ef25-8889-43a0-8cc7-f2a94268e861" |
| 16 | + } |
| 17 | + |
| 18 | + data "docker_org_access_token" "by_label" { |
| 19 | + org_name = "my-organization" |
| 20 | + |
| 21 | + filter { |
| 22 | + name = "label" |
| 23 | + values = ["ci-token"] |
| 24 | + } |
| 25 | + } |
| 26 | +--- |
| 27 | + |
| 28 | +# docker_org_access_token (Data Source) |
| 29 | + |
| 30 | +Reads metadata for an existing organization access token. |
| 31 | + |
| 32 | +Provide either `id` for a direct lookup or a `filter` block to resolve exactly one token by metadata. The `filter` block follows the common Terraform name/value pattern and currently supports `label` only. |
| 33 | + |
| 34 | +-> **Note**: This data source is only available when authenticated with a username and password as an owner of the org. |
| 35 | + |
| 36 | +-> **Note**: This data source returns metadata only. Docker Hub only returns the secret token value during creation, so `token` is intentionally not exposed here. |
| 37 | + |
| 38 | +-> **Note**: Filter-based lookups scan all organization access token pages to guarantee unique matching, even if the provider `max_page_results` setting is lower. |
| 39 | + |
| 40 | +## Example Usage |
| 41 | + |
| 42 | +```hcl |
| 43 | +data "docker_org_access_token" "by_id" { |
| 44 | + org_name = "my-organization" |
| 45 | + id = "a7a5ef25-8889-43a0-8cc7-f2a94268e861" |
| 46 | +} |
| 47 | +
|
| 48 | +data "docker_org_access_token" "by_label" { |
| 49 | + org_name = "my-organization" |
| 50 | +
|
| 51 | + filter { |
| 52 | + name = "label" |
| 53 | + values = ["ci-token"] |
| 54 | + } |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | +<!-- schema generated by tfplugindocs --> |
| 61 | +## Schema |
| 62 | + |
| 63 | +### Required |
| 64 | + |
| 65 | +- `org_name` (String) The organization namespace. |
| 66 | + |
| 67 | +### Optional |
| 68 | + |
| 69 | +- `filter` (Attributes List) One or more name/value filter blocks. Exactly one of `id` or `filter` must be set. Filters are applied with OR semantics within `values` and AND semantics across blocks. Only `label` is supported in v1. (see [below for nested schema](#nestedatt--filter)) |
| 70 | +- `id` (String) The ID of the organization access token. Set this for a direct lookup, or omit it when using `filter`. |
| 71 | + |
| 72 | +### Read-Only |
| 73 | + |
| 74 | +- `created_at` (String) The creation timestamp of the access token. |
| 75 | +- `created_by` (String) The user that created the access token. |
| 76 | +- `description` (String) The description of the access token. |
| 77 | +- `expires_at` (String) The expiration timestamp of the access token, if set. |
| 78 | +- `is_active` (Boolean) Whether the access token is active. |
| 79 | +- `label` (String) The label of the access token. |
| 80 | +- `last_used_at` (String) The last time the access token was used, if available. |
| 81 | +- `resources` (Attributes List) Resources this token has access to. (see [below for nested schema](#nestedatt--resources)) |
| 82 | + |
| 83 | +<a id="nestedatt--filter"></a> |
| 84 | +### Nested Schema for `filter` |
| 85 | + |
| 86 | +Required: |
| 87 | + |
| 88 | +- `name` (String) Name of the field to filter by. Only `label` is supported. |
| 89 | +- `values` (List of String) Accepted values for the given filter name. |
| 90 | + |
| 91 | + |
| 92 | +<a id="nestedatt--resources"></a> |
| 93 | +### Nested Schema for `resources` |
| 94 | + |
| 95 | +Read-Only: |
| 96 | + |
| 97 | +- `path` (String) The path of the resource. |
| 98 | +- `scopes` (List of String) The scopes this token has access to. |
| 99 | +- `type` (String) The type of resource. |
0 commit comments