> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# coreweave_iam_access_policy (Resource)

> **Private beta:** This resource is available only to organizations enrolled in the private beta and may change before general availability. It is gated by an organization-level feature flag. Contact your CoreWeave representative or CoreWeave Support to request access for your organization.

Creates and manages a custom CoreWeave IAM access policy. Rules bind console actions to users, groups, and service accounts.

When changing `access_policy_id` or `organization_id`, the replacement has a different resource name. In that case, configure `lifecycle { create_before_destroy = true }` to avoid an interruption in permissions. To force or taint-replace a policy without changing its ID, temporarily remove `create_before_destroy`, because the API cannot create two policies with the same name.

## Example usage

```terraform theme={"system"}
resource "coreweave_iam_access_policy" "automation" {
  organization_id  = "a1b2c3"
  access_policy_id = "automation-deployers"
  description      = "Permissions used by deployment automation"

  rules = [
    {
      actions = [
        "read_auth",
        "write_auth",
      ]
      service_accounts = [
        "organizations/a1b2c3/serviceAccounts/ci-deployer",
      ]
    }
  ]
}
```

## Schema

### Required

* `access_policy_id` (String) The caller-defined access policy ID used as the final segment of the resource name. It must be unique within the organization.
* `organization_id` (String) The six-character ID of the CoreWeave organization that owns the policy. It must match the organization authenticated by the provider.

### Optional

* `description` (String) An optional description of the policy. Defaults to an empty string.
* `rules` (Attributes Set) Unordered policy rules. Updating this attribute replaces the complete rule set. (see [below for nested schema](#nestedatt--rules))

### Read-Only

* `active` (Boolean) Whether the policy is active.
* `created_at` (String) The RFC 3339 creation timestamp.
* `name` (String) The canonical access policy resource name.
* `policy_type` (String) The API policy classification. Terraform-created policies are `POLICY_TYPE_CUSTOM`.
* `uid` (String) The server-generated access policy UUID.
* `updated_at` (String) The RFC 3339 last-update timestamp, including rule assignment changes.

### Nested Schema for `rules`

Required:

* `actions` (Set of String) The console action identifiers granted by this rule.

Optional:

* `groups` (Set of String) Canonical group resource names assigned directly to this rule.
* `service_accounts` (Set of String) Canonical service account resource names assigned directly to this rule, in `organizations/{organization}/serviceAccounts/{service_account}` format.
* `users` (Set of String) Canonical user resource names assigned directly to this rule.

## Import

Import is supported using the following syntax:

```bash theme={"system"}
terraform import coreweave_iam_access_policy.automation organizations/a1b2c3/accessPolicies/automation-deployers
```
