> 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/share.md).

# ionoscloud\_share

Creates and manages share objects.

Manages **Shares** and list shares permissions granted to the group members for each shared resource.

## Example Usage

### Share a Datacenter with a Group

```hcl
resource "ionoscloud_datacenter" "example" {
  name                = "Datacenter Example"
  location            = "us/las"
  description         = "Datacenter Description"
  sec_auth_protection = false
}

resource "ionoscloud_group" "example" {
  name                   = "Group Example"
  create_datacenter      = true
  create_snapshot        = true
  reserve_ip             = true
  access_activity_log    = true
  create_pcc             = true
  s3_privilege           = true
  create_backup_unit     = true
  create_internet_access = true
  create_k8s_cluster     = true
}

resource "ionoscloud_share" "example" {
  group_id        = ionoscloud_group.example.id
  resource_id     = ionoscloud_datacenter.example.id
  edit_privilege  = true
  share_privilege = false
}
```

### Share a Kubernetes Cluster with Multiple Groups

```hcl
resource "ionoscloud_k8s_cluster" "example" {
  name = "k8s-example"
}

resource "ionoscloud_group" "group1" {
  name               = "Group 1"
  create_k8s_cluster = true
}

resource "ionoscloud_group" "group2" {
  name               = "Group 2"
  create_k8s_cluster = true
}

resource "ionoscloud_share" "k8s_share_group1" {
  group_id        = ionoscloud_group.group1.id
  resource_id     = ionoscloud_k8s_cluster.example.id
  edit_privilege  = true
  share_privilege = false
}

resource "ionoscloud_share" "k8s_share_group2" {
  group_id        = ionoscloud_group.group2.id
  resource_id     = ionoscloud_k8s_cluster.example.id
  edit_privilege  = true
  share_privilege = true

  depends_on = [ionoscloud_share.k8s_share_group1]
}
```

## Argument reference

* `edit_privilege` - (Optional)\[Boolean] The group has permission to edit privileges on this resource.
* `group_id` - (Required)\[string] The ID of the specific group containing the resource to update.
* `resource_id` - (Required)\[string] The ID of the specific resource to update.
* `share_privilege` - (Optional)\[Boolean] The group has permission to share this resource.

⚠️ **Note:** There is a limitation due to which the creation of several shares at the same time leads to an error. To avoid this, `parallelism=1` can be used when running `terraform apply` command in order to create the resources in a sequential manner. Another solution involves the usage of `depends_on` attributes inside the `ionoscloud_share` resource to enforce the sequential creation of the shares.

## Import

Resource Share can be imported using the `resource id`, e.g.

```shell
terraform import ionoscloud_share.myshare group uuid/resource 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/share.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.
