MongoDB Atlas v4.2.0 published on Friday, Jan 23, 2026 by Pulumi
MongoDB Atlas v4.2.0 published on Friday, Jan 23, 2026 by Pulumi
Example Usage
S
import * as pulumi from "@pulumi/pulumi";
import * as mongodbatlas from "@pulumi/mongodbatlas";
const thisProjectServiceAccount = new mongodbatlas.ProjectServiceAccount("this", {
projectId: projectId,
name: "example-project-service-account",
description: "Example Project Service Account",
roles: ["GROUP_READ_ONLY"],
secretExpiresAfterHours: 2160,
});
// Add IP Access List Entry to Project Service Account using CIDR Block
const cidr = new mongodbatlas.ProjectServiceAccountAccessListEntry("cidr", {
projectId: projectId,
clientId: thisProjectServiceAccount.clientId,
cidrBlock: "1.2.3.4/32",
});
// Add IP Access List Entry to Project Service Account using IP Address
const ip = new mongodbatlas.ProjectServiceAccountAccessListEntry("ip", {
projectId: projectId,
clientId: thisProjectServiceAccount.clientId,
ipAddress: "2.3.4.5",
});
// Data source to read a single Access List entry for the Project Service Account
const _this = mongodbatlas.getProjectServiceAccountAccessListEntryOutput({
projectId: cidr.projectId,
clientId: cidr.clientId,
cidrBlock: cidr.cidrBlock,
});
export const accessListEntryCidrBlock = _this.apply(_this => _this.cidrBlock);
// Data source to read all Access List entries for the Project Service Account
const thisGetProjectServiceAccountAccessListEntries = mongodbatlas.getProjectServiceAccountAccessListEntriesOutput({
projectId: thisProjectServiceAccount.projectId,
clientId: thisProjectServiceAccount.clientId,
});
export const allAccessListEntries = thisGetProjectServiceAccountAccessListEntries.apply(thisGetProjectServiceAccountAccessListEntries => thisGetProjectServiceAccountAccessListEntries.results);
import pulumi
import pulumi_mongodbatlas as mongodbatlas
this_project_service_account = mongodbatlas.ProjectServiceAccount("this",
project_id=project_id,
name="example-project-service-account",
description="Example Project Service Account",
roles=["GROUP_READ_ONLY"],
secret_expires_after_hours=2160)
# Add IP Access List Entry to Project Service Account using CIDR Block
cidr = mongodbatlas.ProjectServiceAccountAccessListEntry("cidr",
project_id=project_id,
client_id=this_project_service_account.client_id,
cidr_block="1.2.3.4/32")
# Add IP Access List Entry to Project Service Account using IP Address
ip = mongodbatlas.ProjectServiceAccountAccessListEntry("ip",
project_id=project_id,
client_id=this_project_service_account.client_id,
ip_address="2.3.4.5")
# Data source to read a single Access List entry for the Project Service Account
this = mongodbatlas.get_project_service_account_access_list_entry_output(project_id=cidr.project_id,
client_id=cidr.client_id,
cidr_block=cidr.cidr_block)
pulumi.export("accessListEntryCidrBlock", this.cidr_block)
# Data source to read all Access List entries for the Project Service Account
this_get_project_service_account_access_list_entries = mongodbatlas.get_project_service_account_access_list_entries_output(project_id=this_project_service_account.project_id,
client_id=this_project_service_account.client_id)
pulumi.export("allAccessListEntries", this_get_project_service_account_access_list_entries.results)
package main
import (
"github.com/pulumi/pulumi-mongodbatlas/sdk/v4/go/mongodbatlas"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
thisProjectServiceAccount, err := mongodbatlas.NewProjectServiceAccount(ctx, "this", &mongodbatlas.ProjectServiceAccountArgs{
ProjectId: pulumi.Any(projectId),
Name: pulumi.String("example-project-service-account"),
Description: pulumi.String("Example Project Service Account"),
Roles: pulumi.StringArray{
pulumi.String("GROUP_READ_ONLY"),
},
SecretExpiresAfterHours: pulumi.Int(2160),
})
if err != nil {
return err
}
// Add IP Access List Entry to Project Service Account using CIDR Block
cidr, err := mongodbatlas.NewProjectServiceAccountAccessListEntry(ctx, "cidr", &mongodbatlas.ProjectServiceAccountAccessListEntryArgs{
ProjectId: pulumi.Any(projectId),
ClientId: thisProjectServiceAccount.ClientId,
CidrBlock: pulumi.String("1.2.3.4/32"),
})
if err != nil {
return err
}
// Add IP Access List Entry to Project Service Account using IP Address
_, err = mongodbatlas.NewProjectServiceAccountAccessListEntry(ctx, "ip", &mongodbatlas.ProjectServiceAccountAccessListEntryArgs{
ProjectId: pulumi.Any(projectId),
ClientId: thisProjectServiceAccount.ClientId,
IpAddress: pulumi.String("2.3.4.5"),
})
if err != nil {
return err
}
// Data source to read a single Access List entry for the Project Service Account
this := mongodbatlas.LookupProjectServiceAccountAccessListEntryOutput(ctx, mongodbatlas.GetProjectServiceAccountAccessListEntryOutputArgs{
ProjectId: cidr.ProjectId,
ClientId: cidr.ClientId,
CidrBlock: cidr.CidrBlock,
}, nil)
ctx.Export("accessListEntryCidrBlock", this.ApplyT(func(this mongodbatlas.GetProjectServiceAccountAccessListEntryResult) (*string, error) {
return &this.CidrBlock, nil
}).(pulumi.StringPtrOutput))
// Data source to read all Access List entries for the Project Service Account
thisGetProjectServiceAccountAccessListEntries := mongodbatlas.LookupProjectServiceAccountAccessListEntriesOutput(ctx, mongodbatlas.GetProjectServiceAccountAccessListEntriesOutputArgs{
ProjectId: thisProjectServiceAccount.ProjectId,
ClientId: thisProjectServiceAccount.ClientId,
}, nil)
ctx.Export("allAccessListEntries", thisGetProjectServiceAccountAccessListEntries.ApplyT(func(thisGetProjectServiceAccountAccessListEntries mongodbatlas.GetProjectServiceAccountAccessListEntriesResult) ([]mongodbatlas.GetProjectServiceAccountAccessListEntriesResult, error) {
return []mongodbatlas.GetProjectServiceAccountAccessListEntriesResult(thisGetProjectServiceAccountAccessListEntries.Results), nil
}).([]mongodbatlas.GetProjectServiceAccountAccessListEntriesResultOutput))
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;
return await Deployment.RunAsync(() =>
{
var thisProjectServiceAccount = new Mongodbatlas.ProjectServiceAccount("this", new()
{
ProjectId = projectId,
Name = "example-project-service-account",
Description = "Example Project Service Account",
Roles = new[]
{
"GROUP_READ_ONLY",
},
SecretExpiresAfterHours = 2160,
});
// Add IP Access List Entry to Project Service Account using CIDR Block
var cidr = new Mongodbatlas.ProjectServiceAccountAccessListEntry("cidr", new()
{
ProjectId = projectId,
ClientId = thisProjectServiceAccount.ClientId,
CidrBlock = "1.2.3.4/32",
});
// Add IP Access List Entry to Project Service Account using IP Address
var ip = new Mongodbatlas.ProjectServiceAccountAccessListEntry("ip", new()
{
ProjectId = projectId,
ClientId = thisProjectServiceAccount.ClientId,
IpAddress = "2.3.4.5",
});
// Data source to read a single Access List entry for the Project Service Account
var @this = Mongodbatlas.GetProjectServiceAccountAccessListEntry.Invoke(new()
{
ProjectId = cidr.ProjectId,
ClientId = cidr.ClientId,
CidrBlock = cidr.CidrBlock,
});
// Data source to read all Access List entries for the Project Service Account
var thisGetProjectServiceAccountAccessListEntries = Mongodbatlas.GetProjectServiceAccountAccessListEntries.Invoke(new()
{
ProjectId = thisProjectServiceAccount.ProjectId,
ClientId = thisProjectServiceAccount.ClientId,
});
return new Dictionary<string, object?>
{
["accessListEntryCidrBlock"] = @this.Apply(@this => @this.Apply(getProjectServiceAccountAccessListEntryResult => getProjectServiceAccountAccessListEntryResult.CidrBlock)),
["allAccessListEntries"] = thisGetProjectServiceAccountAccessListEntries.Apply(getProjectServiceAccountAccessListEntriesResult => getProjectServiceAccountAccessListEntriesResult.Results),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.mongodbatlas.ProjectServiceAccount;
import com.pulumi.mongodbatlas.ProjectServiceAccountArgs;
import com.pulumi.mongodbatlas.ProjectServiceAccountAccessListEntry;
import com.pulumi.mongodbatlas.ProjectServiceAccountAccessListEntryArgs;
import com.pulumi.mongodbatlas.MongodbatlasFunctions;
import com.pulumi.mongodbatlas.inputs.GetProjectServiceAccountAccessListEntryArgs;
import com.pulumi.mongodbatlas.inputs.GetProjectServiceAccountAccessListEntriesArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var thisProjectServiceAccount = new ProjectServiceAccount("thisProjectServiceAccount", ProjectServiceAccountArgs.builder()
.projectId(projectId)
.name("example-project-service-account")
.description("Example Project Service Account")
.roles("GROUP_READ_ONLY")
.secretExpiresAfterHours(2160)
.build());
// Add IP Access List Entry to Project Service Account using CIDR Block
var cidr = new ProjectServiceAccountAccessListEntry("cidr", ProjectServiceAccountAccessListEntryArgs.builder()
.projectId(projectId)
.clientId(thisProjectServiceAccount.clientId())
.cidrBlock("1.2.3.4/32")
.build());
// Add IP Access List Entry to Project Service Account using IP Address
var ip = new ProjectServiceAccountAccessListEntry("ip", ProjectServiceAccountAccessListEntryArgs.builder()
.projectId(projectId)
.clientId(thisProjectServiceAccount.clientId())
.ipAddress("2.3.4.5")
.build());
// Data source to read a single Access List entry for the Project Service Account
final var this = MongodbatlasFunctions.getProjectServiceAccountAccessListEntry(GetProjectServiceAccountAccessListEntryArgs.builder()
.projectId(cidr.projectId())
.clientId(cidr.clientId())
.cidrBlock(cidr.cidrBlock())
.build());
ctx.export("accessListEntryCidrBlock", this_.applyValue(_this_ -> _this_.cidrBlock()));
// Data source to read all Access List entries for the Project Service Account
final var thisGetProjectServiceAccountAccessListEntries = MongodbatlasFunctions.getProjectServiceAccountAccessListEntries(GetProjectServiceAccountAccessListEntriesArgs.builder()
.projectId(thisProjectServiceAccount.projectId())
.clientId(thisProjectServiceAccount.clientId())
.build());
ctx.export("allAccessListEntries", thisGetProjectServiceAccountAccessListEntries.applyValue(_thisGetProjectServiceAccountAccessListEntries -> _thisGetProjectServiceAccountAccessListEntries.results()));
}
}
resources:
thisProjectServiceAccount:
type: mongodbatlas:ProjectServiceAccount
name: this
properties:
projectId: ${projectId}
name: example-project-service-account
description: Example Project Service Account
roles:
- GROUP_READ_ONLY
secretExpiresAfterHours: 2160 # 90 days
# Add IP Access List Entry to Project Service Account using CIDR Block
cidr:
type: mongodbatlas:ProjectServiceAccountAccessListEntry
properties:
projectId: ${projectId}
clientId: ${thisProjectServiceAccount.clientId}
cidrBlock: 1.2.3.4/32
# Add IP Access List Entry to Project Service Account using IP Address
ip:
type: mongodbatlas:ProjectServiceAccountAccessListEntry
properties:
projectId: ${projectId}
clientId: ${thisProjectServiceAccount.clientId}
ipAddress: 2.3.4.5
variables:
# Data source to read a single Access List entry for the Project Service Account
this:
fn::invoke:
function: mongodbatlas:getProjectServiceAccountAccessListEntry
arguments:
projectId: ${cidr.projectId}
clientId: ${cidr.clientId}
cidrBlock: ${cidr.cidrBlock}
# Data source to read all Access List entries for the Project Service Account
thisGetProjectServiceAccountAccessListEntries:
fn::invoke:
function: mongodbatlas:getProjectServiceAccountAccessListEntries
arguments:
projectId: ${thisProjectServiceAccount.projectId}
clientId: ${thisProjectServiceAccount.clientId}
outputs:
accessListEntryCidrBlock: ${this.cidrBlock}
allAccessListEntries: ${thisGetProjectServiceAccountAccessListEntries.results}
Using getProjectServiceAccountAccessListEntries
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getProjectServiceAccountAccessListEntries(args: GetProjectServiceAccountAccessListEntriesArgs, opts?: InvokeOptions): Promise<GetProjectServiceAccountAccessListEntriesResult>
function getProjectServiceAccountAccessListEntriesOutput(args: GetProjectServiceAccountAccessListEntriesOutputArgs, opts?: InvokeOptions): Output<GetProjectServiceAccountAccessListEntriesResult>def get_project_service_account_access_list_entries(client_id: Optional[str] = None,
project_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetProjectServiceAccountAccessListEntriesResult
def get_project_service_account_access_list_entries_output(client_id: Optional[pulumi.Input[str]] = None,
project_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetProjectServiceAccountAccessListEntriesResult]func LookupProjectServiceAccountAccessListEntries(ctx *Context, args *LookupProjectServiceAccountAccessListEntriesArgs, opts ...InvokeOption) (*LookupProjectServiceAccountAccessListEntriesResult, error)
func LookupProjectServiceAccountAccessListEntriesOutput(ctx *Context, args *LookupProjectServiceAccountAccessListEntriesOutputArgs, opts ...InvokeOption) LookupProjectServiceAccountAccessListEntriesResultOutput> Note: This function is named LookupProjectServiceAccountAccessListEntries in the Go SDK.
public static class GetProjectServiceAccountAccessListEntries
{
public static Task<GetProjectServiceAccountAccessListEntriesResult> InvokeAsync(GetProjectServiceAccountAccessListEntriesArgs args, InvokeOptions? opts = null)
public static Output<GetProjectServiceAccountAccessListEntriesResult> Invoke(GetProjectServiceAccountAccessListEntriesInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetProjectServiceAccountAccessListEntriesResult> getProjectServiceAccountAccessListEntries(GetProjectServiceAccountAccessListEntriesArgs args, InvokeOptions options)
public static Output<GetProjectServiceAccountAccessListEntriesResult> getProjectServiceAccountAccessListEntries(GetProjectServiceAccountAccessListEntriesArgs args, InvokeOptions options)
fn::invoke:
function: mongodbatlas:index/getProjectServiceAccountAccessListEntries:getProjectServiceAccountAccessListEntries
arguments:
# arguments dictionaryThe following arguments are supported:
- client_
id str - The Client ID of the Service Account.
- project_
id str - Unique 24-hexadecimal digit string that identifies the project.
getProjectServiceAccountAccessListEntries Result
The following output properties are available:
- Client
Id string - The Client ID of the Service Account.
- Id string
- The provider-assigned unique ID for this managed resource.
- Project
Id string - Unique 24-hexadecimal digit string that identifies the project.
- Results
List<Get
Project Service Account Access List Entries Result> - List of documents that MongoDB Cloud returns for this request.
- Client
Id string - The Client ID of the Service Account.
- Id string
- The provider-assigned unique ID for this managed resource.
- Project
Id string - Unique 24-hexadecimal digit string that identifies the project.
- Results
[]Get
Project Service Account Access List Entries Result - List of documents that MongoDB Cloud returns for this request.
- client
Id String - The Client ID of the Service Account.
- id String
- The provider-assigned unique ID for this managed resource.
- project
Id String - Unique 24-hexadecimal digit string that identifies the project.
- results
List<Get
Project Service Account Access List Entries Result> - List of documents that MongoDB Cloud returns for this request.
- client
Id string - The Client ID of the Service Account.
- id string
- The provider-assigned unique ID for this managed resource.
- project
Id string - Unique 24-hexadecimal digit string that identifies the project.
- results
Get
Project Service Account Access List Entries Result[] - List of documents that MongoDB Cloud returns for this request.
- client_
id str - The Client ID of the Service Account.
- id str
- The provider-assigned unique ID for this managed resource.
- project_
id str - Unique 24-hexadecimal digit string that identifies the project.
- results
Sequence[Get
Project Service Account Access List Entries Result] - List of documents that MongoDB Cloud returns for this request.
- client
Id String - The Client ID of the Service Account.
- id String
- The provider-assigned unique ID for this managed resource.
- project
Id String - Unique 24-hexadecimal digit string that identifies the project.
- results List<Property Map>
- List of documents that MongoDB Cloud returns for this request.
Supporting Types
GetProjectServiceAccountAccessListEntriesResult
- Cidr
Block string - Range of IP addresses in CIDR notation to be added to the access list. You can set a value for this parameter or ip_address, but not for both.
- Client
Id string - The Client ID of the Service Account.
- Created
At string - Date the entry was added to the access list. This attribute expresses its value in the ISO 8601 timestamp format in UTC.
- Ip
Address string - IP address to be added to the access list. You can set a value for this parameter or cidr_block, but not for both.
- Last
Used stringAddress - Network address that issued the most recent request to the API.
- Last
Used stringAt - Date when the API received the most recent request that originated from this network address.
- Project
Id string - Unique 24-hexadecimal digit string that identifies the project.
- Request
Count int - The number of requests that has originated from this network address.
- Cidr
Block string - Range of IP addresses in CIDR notation to be added to the access list. You can set a value for this parameter or ip_address, but not for both.
- Client
Id string - The Client ID of the Service Account.
- Created
At string - Date the entry was added to the access list. This attribute expresses its value in the ISO 8601 timestamp format in UTC.
- Ip
Address string - IP address to be added to the access list. You can set a value for this parameter or cidr_block, but not for both.
- Last
Used stringAddress - Network address that issued the most recent request to the API.
- Last
Used stringAt - Date when the API received the most recent request that originated from this network address.
- Project
Id string - Unique 24-hexadecimal digit string that identifies the project.
- Request
Count int - The number of requests that has originated from this network address.
- cidr
Block String - Range of IP addresses in CIDR notation to be added to the access list. You can set a value for this parameter or ip_address, but not for both.
- client
Id String - The Client ID of the Service Account.
- created
At String - Date the entry was added to the access list. This attribute expresses its value in the ISO 8601 timestamp format in UTC.
- ip
Address String - IP address to be added to the access list. You can set a value for this parameter or cidr_block, but not for both.
- last
Used StringAddress - Network address that issued the most recent request to the API.
- last
Used StringAt - Date when the API received the most recent request that originated from this network address.
- project
Id String - Unique 24-hexadecimal digit string that identifies the project.
- request
Count Integer - The number of requests that has originated from this network address.
- cidr
Block string - Range of IP addresses in CIDR notation to be added to the access list. You can set a value for this parameter or ip_address, but not for both.
- client
Id string - The Client ID of the Service Account.
- created
At string - Date the entry was added to the access list. This attribute expresses its value in the ISO 8601 timestamp format in UTC.
- ip
Address string - IP address to be added to the access list. You can set a value for this parameter or cidr_block, but not for both.
- last
Used stringAddress - Network address that issued the most recent request to the API.
- last
Used stringAt - Date when the API received the most recent request that originated from this network address.
- project
Id string - Unique 24-hexadecimal digit string that identifies the project.
- request
Count number - The number of requests that has originated from this network address.
- cidr_
block str - Range of IP addresses in CIDR notation to be added to the access list. You can set a value for this parameter or ip_address, but not for both.
- client_
id str - The Client ID of the Service Account.
- created_
at str - Date the entry was added to the access list. This attribute expresses its value in the ISO 8601 timestamp format in UTC.
- ip_
address str - IP address to be added to the access list. You can set a value for this parameter or cidr_block, but not for both.
- last_
used_ straddress - Network address that issued the most recent request to the API.
- last_
used_ strat - Date when the API received the most recent request that originated from this network address.
- project_
id str - Unique 24-hexadecimal digit string that identifies the project.
- request_
count int - The number of requests that has originated from this network address.
- cidr
Block String - Range of IP addresses in CIDR notation to be added to the access list. You can set a value for this parameter or ip_address, but not for both.
- client
Id String - The Client ID of the Service Account.
- created
At String - Date the entry was added to the access list. This attribute expresses its value in the ISO 8601 timestamp format in UTC.
- ip
Address String - IP address to be added to the access list. You can set a value for this parameter or cidr_block, but not for both.
- last
Used StringAddress - Network address that issued the most recent request to the API.
- last
Used StringAt - Date when the API received the most recent request that originated from this network address.
- project
Id String - Unique 24-hexadecimal digit string that identifies the project.
- request
Count Number - The number of requests that has originated from this network address.
Package Details
- Repository
- MongoDB Atlas pulumi/pulumi-mongodbatlas
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
mongodbatlasTerraform Provider.
MongoDB Atlas v4.2.0 published on Friday, Jan 23, 2026 by Pulumi
