# ionoscloud\_s3\_bucket\_policy

Manages **Buckets policies** on IONOS CLOUD.

## Example Usage

```hcl

resource "ionoscloud_s3_bucket" "example" {
  name = "example"
}

resource "ionoscloud_s3_bucket_policy" "example" {
  bucket = ionoscloud_s3_bucket.example.name
  policy = jsonencode({
    Version = "2012-10-17"
    Statement = [
      {
        Sid = "Delegate certain actions to another user"
        Action = [
          "s3:ListBucket",
          "s3:PutObject",
          "s3:GetObject"
        ]
        Effect = "Allow"
        Resource = [
          "arn:aws:s3:::example",
          "arn:aws:s3:::example/*"
        ]
        Condition = {
          IpAddress = [
            "123.123.123.123/32"
          ]
        }
        Principal = [
          "arn:aws:iam:::user/31000000:9acd8251-2857-410e-b1fd-ca86462bdcec"
        ]
      }
    ]
  })
}

```

⚠️ **Note:** For more information about the bucket policy or the policy format, please see the [IONOS CLOUD Object Storage documentation](https://docs.ionos.com/cloud/storage-and-backup/ionos-object-storage/settings/bucket-policy#policy-format).

## Argument Reference

The following arguments are supported:

* `bucket` - (Required)\[string] The name of the bucket where the object will be stored.
* `policy` - (Required)\[string] The policy document. This is a JSON formatted string.

## Import

Resource Policy can be imported using the `bucket name`

```shell
terraform import ionoscloud_s3_bucket_policy.example example
```


---

# 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/s3_bucket_policy.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.
