# ionoscloud\_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: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ionos.com/terraform-provider/resources/container_registry_token.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
