> For the complete documentation index, see [llms.txt](https://docs.ionos.com/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionos.com/cloud/tools-terraform/docs/resources/container_registry_token.md).

# ionoscloud\_container\_registry\_token

Creates and manages IONOS CLOUD Container Registry Token.

Manages an [Container Registry Token](https://docs.ionos.com/cloud/containers/private-container-registry/overview) on IONOS CLOUD.

## Example Usage

```hcl
resource "ionoscloud_container_registry" "example" {
  garbage_collection_schedule {
    days             = ["Monday", "Tuesday"]
    time             = "05:19:00+00:00"
  }
  location           = "de/fra"
  name               = "container-registry-example"
}

resource "ionoscloud_container_registry_token" "example" {
  expiry_date           = "2023-01-13 16:27:42Z"
  name                  = "container-registry-token-example"
  scopes  {
    actions             = ["push"]
    name                = "Scope1"
    type                = "repository"
  }
  status                = "enabled"
  registry_id           = ionoscloud_container_registry.example.id
  save_password_to_file = "pass.txt"
}
```

## Argument Reference

The following arguments are supported:

* `registry_id` - (Required)\[string] The ID of the container registry
* `name` - (Required)\[string] The name of the container registry token. Immutable, update forces re-creation of the resource.
* `expiry-date` - (Optional)\[string] The value must be supplied as ISO 8601 timestamp
* `credentials` - (Computed)\[map]
  * `username` - (Computed)\[string] The username of the container registry token
  * `password` - (Computed)\[string] The password/token of the container registry token which will also be saved to a file if `save_password_to_file` is set
* `scopes` - (Optional)(Computed) \[map]
  * `actions` - (Required)\[string] Example: \["pull", "push", "delete"]
  * `name` - (Required)\[string]
  * `type` - (Required)\[string]
* `status` - (Optional)\[string] Must have one of the values: `enabled`, `disabled`
* `save_password_to_file` - (Optional)\[string] Saves token password to file. Only works on create. Takes as argument a file name, or a file path

> **⚠ WARNING** `save_password_to_file` must be used with caution. It will save the password(token) returned on create to a file. This is the only way to get the token.

## Import

Resource Container Registry Token can be imported using the `container registry id` and `resource id`, e.g.

```shell
terraform import ionoscloud_container_registry_token.mycrtoken container_registry uuid/container_registry_token uuid
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ionos.com/cloud/tools-terraform/docs/resources/container_registry_token.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
