--- subcategory: "Resource Policies" --- # Resource: mongodbatlas_resource_policy `mongodbatlas_resource_policy` provides a Resource Policy resource. The resource lets you create, edit and delete resource policies to prevent misconfigurations and reduce the need for corrective interventions in your organization. The [Official MongoDB Atlas Organization Module](https://registry.terraform.io/modules/terraform-mongodbatlas-modules/organization/mongodbatlas/latest) makes use of this resource and simplifies resource policy management. ## Example Usages ```terraform resource "mongodbatlas_resource_policy" "project_ip_access_list" { org_id = var.org_id name = "forbid-access-from-anywhere" description = "Forbids access from anywhere" policies = [ { body = < policy.id } } ``` ### Further Examples - [Atlas Resource Policy](https://github.com/mongodb/terraform-provider-mongodbatlas/tree/v2.22.0/examples/mongodbatlas_resource_policy) ## Schema ### Required - `name` (String) Human-readable label that describes the Atlas resource policy. - `org_id` (String) Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-listorganizations) endpoint to retrieve all organizations to which the authenticated user has access. - `policies` (Attributes List) List of policies that make up the Atlas resource policy. (see [below for nested schema](#nestedatt--policies)) ### Optional - `description` (String) Description of the Atlas resource policy. ### Read-Only - `created_by_user` (Attributes) The user that last updated the Atlas resource policy. (see [below for nested schema](#nestedatt--created_by_user)) - `created_date` (String) Date and time in UTC when the Atlas resource policy was created. - `id` (String) Unique 24-hexadecimal digit string that identifies an Atlas resource policy. - `last_updated_by_user` (Attributes) The user that last updated the Atlas resource policy. (see [below for nested schema](#nestedatt--last_updated_by_user)) - `last_updated_date` (String) Date and time in UTC when the Atlas resource policy was last updated. - `version` (String) A string that identifies the version of the Atlas resource policy. ### Nested Schema for `policies` Required: - `body` (String) A string that defines the permissions for the policy. The syntax used is the Cedar Policy language. Read-Only: - `id` (String) Unique 24-hexadecimal character string that identifies the policy. ### Nested Schema for `created_by_user` Read-Only: - `id` (String) Unique 24-hexadecimal character string that identifies a user. - `name` (String) Human-readable label that describes a user. ### Nested Schema for `last_updated_by_user` Read-Only: - `id` (String) Unique 24-hexadecimal character string that identifies a user. - `name` (String) Human-readable label that describes a user. ## Import Resource Policy resource can be imported using the org ID and policy ID, in the format `{ORG_ID}-{POLICY_ID}`, e.g. ``` terraform import mongodbatlas_resource_policy.cloud_region 65def6ce0f722a1507105aa5-66f1c018dba9c04e7dcfaf36 ``` For more information see: [MongoDB Atlas API - Resource Policies](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/group/endpoint-resource-policies) Documentation.