1. Packages
  2. Mongodbatlas Provider
  3. API Docs
  4. ResourcePolicy
MongoDB Atlas v3.30.0 published on Friday, Mar 21, 2025 by Pulumi

mongodbatlas.ResourcePolicy

Explore with Pulumi AI

Example Usage

Create ResourcePolicy Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ResourcePolicy(name: string, args: ResourcePolicyArgs, opts?: CustomResourceOptions);
@overload
def ResourcePolicy(resource_name: str,
                   args: ResourcePolicyArgs,
                   opts: Optional[ResourceOptions] = None)

@overload
def ResourcePolicy(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   org_id: Optional[str] = None,
                   policies: Optional[Sequence[ResourcePolicyPolicyArgs]] = None,
                   name: Optional[str] = None)
func NewResourcePolicy(ctx *Context, name string, args ResourcePolicyArgs, opts ...ResourceOption) (*ResourcePolicy, error)
public ResourcePolicy(string name, ResourcePolicyArgs args, CustomResourceOptions? opts = null)
public ResourcePolicy(String name, ResourcePolicyArgs args)
public ResourcePolicy(String name, ResourcePolicyArgs args, CustomResourceOptions options)
type: mongodbatlas:ResourcePolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ResourcePolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ResourcePolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ResourcePolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ResourcePolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ResourcePolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var resourcePolicyResource = new Mongodbatlas.ResourcePolicy("resourcePolicyResource", new()
{
    OrgId = "string",
    Policies = new[]
    {
        new Mongodbatlas.Inputs.ResourcePolicyPolicyArgs
        {
            Body = "string",
            Id = "string",
        },
    },
    Name = "string",
});
Copy
example, err := mongodbatlas.NewResourcePolicy(ctx, "resourcePolicyResource", &mongodbatlas.ResourcePolicyArgs{
	OrgId: pulumi.String("string"),
	Policies: mongodbatlas.ResourcePolicyPolicyArray{
		&mongodbatlas.ResourcePolicyPolicyArgs{
			Body: pulumi.String("string"),
			Id:   pulumi.String("string"),
		},
	},
	Name: pulumi.String("string"),
})
Copy
var resourcePolicyResource = new ResourcePolicy("resourcePolicyResource", ResourcePolicyArgs.builder()
    .orgId("string")
    .policies(ResourcePolicyPolicyArgs.builder()
        .body("string")
        .id("string")
        .build())
    .name("string")
    .build());
Copy
resource_policy_resource = mongodbatlas.ResourcePolicy("resourcePolicyResource",
    org_id="string",
    policies=[{
        "body": "string",
        "id": "string",
    }],
    name="string")
Copy
const resourcePolicyResource = new mongodbatlas.ResourcePolicy("resourcePolicyResource", {
    orgId: "string",
    policies: [{
        body: "string",
        id: "string",
    }],
    name: "string",
});
Copy
type: mongodbatlas:ResourcePolicy
properties:
    name: string
    orgId: string
    policies:
        - body: string
          id: string
Copy

ResourcePolicy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ResourcePolicy resource accepts the following input properties:

OrgId This property is required. string
Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
Policies This property is required. List<ResourcePolicyPolicy>
List of policies that make up the Atlas resource policy.
Name string
Human-readable label that describes the Atlas resource policy.
OrgId This property is required. string
Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
Policies This property is required. []ResourcePolicyPolicyArgs
List of policies that make up the Atlas resource policy.
Name string
Human-readable label that describes the Atlas resource policy.
orgId This property is required. String
Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
policies This property is required. List<ResourcePolicyPolicy>
List of policies that make up the Atlas resource policy.
name String
Human-readable label that describes the Atlas resource policy.
orgId This property is required. string
Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
policies This property is required. ResourcePolicyPolicy[]
List of policies that make up the Atlas resource policy.
name string
Human-readable label that describes the Atlas resource policy.
org_id This property is required. str
Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
policies This property is required. Sequence[ResourcePolicyPolicyArgs]
List of policies that make up the Atlas resource policy.
name str
Human-readable label that describes the Atlas resource policy.
orgId This property is required. String
Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
policies This property is required. List<Property Map>
List of policies that make up the Atlas resource policy.
name String
Human-readable label that describes the Atlas resource policy.

Outputs

All input properties are implicitly available as output properties. Additionally, the ResourcePolicy resource produces the following output properties:

CreatedByUser ResourcePolicyCreatedByUser
The user that last updated the Atlas resource policy.
CreatedDate string
Date and time in UTC when the Atlas resource policy was created.
Id string
The provider-assigned unique ID for this managed resource.
LastUpdatedByUser ResourcePolicyLastUpdatedByUser
The user that last updated the Atlas resource policy.
LastUpdatedDate 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.
CreatedByUser ResourcePolicyCreatedByUser
The user that last updated the Atlas resource policy.
CreatedDate string
Date and time in UTC when the Atlas resource policy was created.
Id string
The provider-assigned unique ID for this managed resource.
LastUpdatedByUser ResourcePolicyLastUpdatedByUser
The user that last updated the Atlas resource policy.
LastUpdatedDate 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.
createdByUser ResourcePolicyCreatedByUser
The user that last updated the Atlas resource policy.
createdDate String
Date and time in UTC when the Atlas resource policy was created.
id String
The provider-assigned unique ID for this managed resource.
lastUpdatedByUser ResourcePolicyLastUpdatedByUser
The user that last updated the Atlas resource policy.
lastUpdatedDate 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.
createdByUser ResourcePolicyCreatedByUser
The user that last updated the Atlas resource policy.
createdDate string
Date and time in UTC when the Atlas resource policy was created.
id string
The provider-assigned unique ID for this managed resource.
lastUpdatedByUser ResourcePolicyLastUpdatedByUser
The user that last updated the Atlas resource policy.
lastUpdatedDate 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.
created_by_user ResourcePolicyCreatedByUser
The user that last updated the Atlas resource policy.
created_date str
Date and time in UTC when the Atlas resource policy was created.
id str
The provider-assigned unique ID for this managed resource.
last_updated_by_user ResourcePolicyLastUpdatedByUser
The user that last updated the Atlas resource policy.
last_updated_date str
Date and time in UTC when the Atlas resource policy was last updated.
version str
A string that identifies the version of the Atlas resource policy.
createdByUser Property Map
The user that last updated the Atlas resource policy.
createdDate String
Date and time in UTC when the Atlas resource policy was created.
id String
The provider-assigned unique ID for this managed resource.
lastUpdatedByUser Property Map
The user that last updated the Atlas resource policy.
lastUpdatedDate 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.

Look up Existing ResourcePolicy Resource

Get an existing ResourcePolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ResourcePolicyState, opts?: CustomResourceOptions): ResourcePolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        created_by_user: Optional[ResourcePolicyCreatedByUserArgs] = None,
        created_date: Optional[str] = None,
        last_updated_by_user: Optional[ResourcePolicyLastUpdatedByUserArgs] = None,
        last_updated_date: Optional[str] = None,
        name: Optional[str] = None,
        org_id: Optional[str] = None,
        policies: Optional[Sequence[ResourcePolicyPolicyArgs]] = None,
        version: Optional[str] = None) -> ResourcePolicy
func GetResourcePolicy(ctx *Context, name string, id IDInput, state *ResourcePolicyState, opts ...ResourceOption) (*ResourcePolicy, error)
public static ResourcePolicy Get(string name, Input<string> id, ResourcePolicyState? state, CustomResourceOptions? opts = null)
public static ResourcePolicy get(String name, Output<String> id, ResourcePolicyState state, CustomResourceOptions options)
resources:  _:    type: mongodbatlas:ResourcePolicy    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
CreatedByUser ResourcePolicyCreatedByUser
The user that last updated the Atlas resource policy.
CreatedDate string
Date and time in UTC when the Atlas resource policy was created.
LastUpdatedByUser ResourcePolicyLastUpdatedByUser
The user that last updated the Atlas resource policy.
LastUpdatedDate string
Date and time in UTC when the Atlas resource policy was last updated.
Name string
Human-readable label that describes the Atlas resource policy.
OrgId string
Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
Policies List<ResourcePolicyPolicy>
List of policies that make up the Atlas resource policy.
Version string
A string that identifies the version of the Atlas resource policy.
CreatedByUser ResourcePolicyCreatedByUserArgs
The user that last updated the Atlas resource policy.
CreatedDate string
Date and time in UTC when the Atlas resource policy was created.
LastUpdatedByUser ResourcePolicyLastUpdatedByUserArgs
The user that last updated the Atlas resource policy.
LastUpdatedDate string
Date and time in UTC when the Atlas resource policy was last updated.
Name string
Human-readable label that describes the Atlas resource policy.
OrgId string
Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
Policies []ResourcePolicyPolicyArgs
List of policies that make up the Atlas resource policy.
Version string
A string that identifies the version of the Atlas resource policy.
createdByUser ResourcePolicyCreatedByUser
The user that last updated the Atlas resource policy.
createdDate String
Date and time in UTC when the Atlas resource policy was created.
lastUpdatedByUser ResourcePolicyLastUpdatedByUser
The user that last updated the Atlas resource policy.
lastUpdatedDate String
Date and time in UTC when the Atlas resource policy was last updated.
name String
Human-readable label that describes the Atlas resource policy.
orgId String
Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
policies List<ResourcePolicyPolicy>
List of policies that make up the Atlas resource policy.
version String
A string that identifies the version of the Atlas resource policy.
createdByUser ResourcePolicyCreatedByUser
The user that last updated the Atlas resource policy.
createdDate string
Date and time in UTC when the Atlas resource policy was created.
lastUpdatedByUser ResourcePolicyLastUpdatedByUser
The user that last updated the Atlas resource policy.
lastUpdatedDate string
Date and time in UTC when the Atlas resource policy was last updated.
name string
Human-readable label that describes the Atlas resource policy.
orgId string
Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
policies ResourcePolicyPolicy[]
List of policies that make up the Atlas resource policy.
version string
A string that identifies the version of the Atlas resource policy.
created_by_user ResourcePolicyCreatedByUserArgs
The user that last updated the Atlas resource policy.
created_date str
Date and time in UTC when the Atlas resource policy was created.
last_updated_by_user ResourcePolicyLastUpdatedByUserArgs
The user that last updated the Atlas resource policy.
last_updated_date str
Date and time in UTC when the Atlas resource policy was last updated.
name str
Human-readable label that describes the Atlas resource policy.
org_id str
Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
policies Sequence[ResourcePolicyPolicyArgs]
List of policies that make up the Atlas resource policy.
version str
A string that identifies the version of the Atlas resource policy.
createdByUser Property Map
The user that last updated the Atlas resource policy.
createdDate String
Date and time in UTC when the Atlas resource policy was created.
lastUpdatedByUser Property Map
The user that last updated the Atlas resource policy.
lastUpdatedDate String
Date and time in UTC when the Atlas resource policy was last updated.
name String
Human-readable label that describes the Atlas resource policy.
orgId String
Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
policies List<Property Map>
List of policies that make up the Atlas resource policy.
version String
A string that identifies the version of the Atlas resource policy.

Supporting Types

ResourcePolicyCreatedByUser
, ResourcePolicyCreatedByUserArgs

Id string
Unique 24-hexadecimal character string that identifies a user.
Name string
Human-readable label that describes a user.
Id string
Unique 24-hexadecimal character string that identifies a user.
Name string
Human-readable label that describes a user.
id String
Unique 24-hexadecimal character string that identifies a user.
name String
Human-readable label that describes a user.
id string
Unique 24-hexadecimal character string that identifies a user.
name string
Human-readable label that describes a user.
id str
Unique 24-hexadecimal character string that identifies a user.
name str
Human-readable label that describes a user.
id String
Unique 24-hexadecimal character string that identifies a user.
name String
Human-readable label that describes a user.

ResourcePolicyLastUpdatedByUser
, ResourcePolicyLastUpdatedByUserArgs

Id string
Unique 24-hexadecimal character string that identifies a user.
Name string
Human-readable label that describes a user.
Id string
Unique 24-hexadecimal character string that identifies a user.
Name string
Human-readable label that describes a user.
id String
Unique 24-hexadecimal character string that identifies a user.
name String
Human-readable label that describes a user.
id string
Unique 24-hexadecimal character string that identifies a user.
name string
Human-readable label that describes a user.
id str
Unique 24-hexadecimal character string that identifies a user.
name str
Human-readable label that describes a user.
id String
Unique 24-hexadecimal character string that identifies a user.
name String
Human-readable label that describes a user.

ResourcePolicyPolicy
, ResourcePolicyPolicyArgs

Body This property is required. string
A string that defines the permissions for the policy. The syntax used is the Cedar Policy language.
Id string
Unique 24-hexadecimal character string that identifies the policy.
Body This property is required. string
A string that defines the permissions for the policy. The syntax used is the Cedar Policy language.
Id string
Unique 24-hexadecimal character string that identifies the policy.
body This property is required. String
A string that defines the permissions for the policy. The syntax used is the Cedar Policy language.
id String
Unique 24-hexadecimal character string that identifies the policy.
body This property is required. string
A string that defines the permissions for the policy. The syntax used is the Cedar Policy language.
id string
Unique 24-hexadecimal character string that identifies the policy.
body This property is required. str
A string that defines the permissions for the policy. The syntax used is the Cedar Policy language.
id str
Unique 24-hexadecimal character string that identifies the policy.
body This property is required. String
A string that defines the permissions for the policy. The syntax used is the Cedar Policy language.
id String
Unique 24-hexadecimal character string that identifies the policy.

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 Documentation.

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
MongoDB Atlas pulumi/pulumi-mongodbatlas
License
Apache-2.0
Notes
This Pulumi package is based on the mongodbatlas Terraform Provider.