1. Packages
  2. Mongodbatlas Provider
  3. API Docs
  4. getAccessListApiKey
Viewing docs for MongoDB Atlas v4.5.0
published on Thursday, Mar 12, 2026 by Pulumi
mongodbatlas logo
Viewing docs for MongoDB Atlas v4.5.0
published on Thursday, Mar 12, 2026 by Pulumi

    mongodbatlas.AccessListApiKey describes an Access List API Key entry resource. The access list grants access from IPs or CIDRs to clusters within the Project.

    NOTE: Groups and projects are synonymous terms. You may find groupId in the official documentation.

    IMPORTANT: When you remove an entry from the access list, existing connections from the removed address(es) may remain open for a variable amount of time. How much time passes before Atlas closes the connection depends on several factors, including how the connection was established, the particular behavior of the application or driver using the address, and the connection protocol (e.g., TCP or UDP). This is particularly important to consider when changing an existing IP address or CIDR block as they cannot be updated via the Provider, hence a change will force the destruction and recreation of entries.

    IMPORTANT WARNING: Managing Atlas Programmatic API Keys (PAKs) with Terraform will expose sensitive organizational secrets in Terraform’s state. We suggest following Terraform’s best practices. You may also want to consider managing your PAKs via a more secure method, such as the HashiCorp Vault MongoDB Atlas Secrets Engine.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as mongodbatlas from "@pulumi/mongodbatlas";
    
    const testAccessListApiKey = new mongodbatlas.AccessListApiKey("test", {
        orgId: "<ORG_ID>",
        ipAddress: "2.3.4.5",
        apiKeyId: "a29120e123cd",
    });
    const test = mongodbatlas.getAccessListApiKeyOutput({
        orgId: testAccessListApiKey.orgId,
        ipAddress: testAccessListApiKey.ipAddress,
        apiKeyId: testAccessListApiKey.apiKeyId,
    });
    
    import pulumi
    import pulumi_mongodbatlas as mongodbatlas
    
    test_access_list_api_key = mongodbatlas.AccessListApiKey("test",
        org_id="<ORG_ID>",
        ip_address="2.3.4.5",
        api_key_id="a29120e123cd")
    test = mongodbatlas.get_access_list_api_key_output(org_id=test_access_list_api_key.org_id,
        ip_address=test_access_list_api_key.ip_address,
        api_key_id=test_access_list_api_key.api_key_id)
    
    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 {
    		testAccessListApiKey, err := mongodbatlas.NewAccessListApiKey(ctx, "test", &mongodbatlas.AccessListApiKeyArgs{
    			OrgId:     pulumi.String("<ORG_ID>"),
    			IpAddress: pulumi.String("2.3.4.5"),
    			ApiKeyId:  pulumi.String("a29120e123cd"),
    		})
    		if err != nil {
    			return err
    		}
    		_ = mongodbatlas.LookupAccessListApiKeyOutput(ctx, mongodbatlas.GetAccessListApiKeyOutputArgs{
    			OrgId:     testAccessListApiKey.OrgId,
    			IpAddress: testAccessListApiKey.IpAddress,
    			ApiKeyId:  testAccessListApiKey.ApiKeyId,
    		}, nil)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Mongodbatlas = Pulumi.Mongodbatlas;
    
    return await Deployment.RunAsync(() => 
    {
        var testAccessListApiKey = new Mongodbatlas.AccessListApiKey("test", new()
        {
            OrgId = "<ORG_ID>",
            IpAddress = "2.3.4.5",
            ApiKeyId = "a29120e123cd",
        });
    
        var test = Mongodbatlas.GetAccessListApiKey.Invoke(new()
        {
            OrgId = testAccessListApiKey.OrgId,
            IpAddress = testAccessListApiKey.IpAddress,
            ApiKeyId = testAccessListApiKey.ApiKeyId,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.mongodbatlas.AccessListApiKey;
    import com.pulumi.mongodbatlas.AccessListApiKeyArgs;
    import com.pulumi.mongodbatlas.MongodbatlasFunctions;
    import com.pulumi.mongodbatlas.inputs.GetAccessListApiKeyArgs;
    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 testAccessListApiKey = new AccessListApiKey("testAccessListApiKey", AccessListApiKeyArgs.builder()
                .orgId("<ORG_ID>")
                .ipAddress("2.3.4.5")
                .apiKeyId("a29120e123cd")
                .build());
    
            final var test = MongodbatlasFunctions.getAccessListApiKey(GetAccessListApiKeyArgs.builder()
                .orgId(testAccessListApiKey.orgId())
                .ipAddress(testAccessListApiKey.ipAddress())
                .apiKeyId(testAccessListApiKey.apiKeyId())
                .build());
    
        }
    }
    
    resources:
      testAccessListApiKey:
        type: mongodbatlas:AccessListApiKey
        name: test
        properties:
          orgId: <ORG_ID>
          ipAddress: 2.3.4.5
          apiKeyId: a29120e123cd
    variables:
      test:
        fn::invoke:
          function: mongodbatlas:getAccessListApiKey
          arguments:
            orgId: ${testAccessListApiKey.orgId}
            ipAddress: ${testAccessListApiKey.ipAddress}
            apiKeyId: ${testAccessListApiKey.apiKeyId}
    

    Using getAccessListApiKey

    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 getAccessListApiKey(args: GetAccessListApiKeyArgs, opts?: InvokeOptions): Promise<GetAccessListApiKeyResult>
    function getAccessListApiKeyOutput(args: GetAccessListApiKeyOutputArgs, opts?: InvokeOptions): Output<GetAccessListApiKeyResult>
    def get_access_list_api_key(api_key_id: Optional[str] = None,
                                ip_address: Optional[str] = None,
                                org_id: Optional[str] = None,
                                opts: Optional[InvokeOptions] = None) -> GetAccessListApiKeyResult
    def get_access_list_api_key_output(api_key_id: Optional[pulumi.Input[str]] = None,
                                ip_address: Optional[pulumi.Input[str]] = None,
                                org_id: Optional[pulumi.Input[str]] = None,
                                opts: Optional[InvokeOptions] = None) -> Output[GetAccessListApiKeyResult]
    func LookupAccessListApiKey(ctx *Context, args *LookupAccessListApiKeyArgs, opts ...InvokeOption) (*LookupAccessListApiKeyResult, error)
    func LookupAccessListApiKeyOutput(ctx *Context, args *LookupAccessListApiKeyOutputArgs, opts ...InvokeOption) LookupAccessListApiKeyResultOutput

    > Note: This function is named LookupAccessListApiKey in the Go SDK.

    public static class GetAccessListApiKey 
    {
        public static Task<GetAccessListApiKeyResult> InvokeAsync(GetAccessListApiKeyArgs args, InvokeOptions? opts = null)
        public static Output<GetAccessListApiKeyResult> Invoke(GetAccessListApiKeyInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetAccessListApiKeyResult> getAccessListApiKey(GetAccessListApiKeyArgs args, InvokeOptions options)
    public static Output<GetAccessListApiKeyResult> getAccessListApiKey(GetAccessListApiKeyArgs args, InvokeOptions options)
    
    fn::invoke:
      function: mongodbatlas:index/getAccessListApiKey:getAccessListApiKey
      arguments:
        # arguments dictionary

    The following arguments are supported:

    ApiKeyId string
    Unique identifier for the Organization API Key for which you want to retrieve an access list entry.
    IpAddress string
    IP address to retrieve from the access list.
    OrgId string
    Unique 24-hexadecimal digit string that identifies the organization that contains your projects.
    ApiKeyId string
    Unique identifier for the Organization API Key for which you want to retrieve an access list entry.
    IpAddress string
    IP address to retrieve from the access list.
    OrgId string
    Unique 24-hexadecimal digit string that identifies the organization that contains your projects.
    apiKeyId String
    Unique identifier for the Organization API Key for which you want to retrieve an access list entry.
    ipAddress String
    IP address to retrieve from the access list.
    orgId String
    Unique 24-hexadecimal digit string that identifies the organization that contains your projects.
    apiKeyId string
    Unique identifier for the Organization API Key for which you want to retrieve an access list entry.
    ipAddress string
    IP address to retrieve from the access list.
    orgId string
    Unique 24-hexadecimal digit string that identifies the organization that contains your projects.
    api_key_id str
    Unique identifier for the Organization API Key for which you want to retrieve an access list entry.
    ip_address str
    IP address to retrieve from the access list.
    org_id str
    Unique 24-hexadecimal digit string that identifies the organization that contains your projects.
    apiKeyId String
    Unique identifier for the Organization API Key for which you want to retrieve an access list entry.
    ipAddress String
    IP address to retrieve from the access list.
    orgId String
    Unique 24-hexadecimal digit string that identifies the organization that contains your projects.

    getAccessListApiKey Result

    The following output properties are available:

    AccessCount int
    Total number of requests that have originated from this IP address or CIDR block.
    ApiKeyId string
    CidrBlock string
    Range of IP addresses in CIDR notation included in the API Key access list.
    Created string
    Date and time when the access list entry was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    IpAddress string
    LastUsed string
    Date and time when the API key was last used from this IP address or CIDR block.
    LastUsedAddress string
    IP address from which the last API request was made.
    OrgId string
    AccessCount int
    Total number of requests that have originated from this IP address or CIDR block.
    ApiKeyId string
    CidrBlock string
    Range of IP addresses in CIDR notation included in the API Key access list.
    Created string
    Date and time when the access list entry was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    IpAddress string
    LastUsed string
    Date and time when the API key was last used from this IP address or CIDR block.
    LastUsedAddress string
    IP address from which the last API request was made.
    OrgId string
    accessCount Integer
    Total number of requests that have originated from this IP address or CIDR block.
    apiKeyId String
    cidrBlock String
    Range of IP addresses in CIDR notation included in the API Key access list.
    created String
    Date and time when the access list entry was created.
    id String
    The provider-assigned unique ID for this managed resource.
    ipAddress String
    lastUsed String
    Date and time when the API key was last used from this IP address or CIDR block.
    lastUsedAddress String
    IP address from which the last API request was made.
    orgId String
    accessCount number
    Total number of requests that have originated from this IP address or CIDR block.
    apiKeyId string
    cidrBlock string
    Range of IP addresses in CIDR notation included in the API Key access list.
    created string
    Date and time when the access list entry was created.
    id string
    The provider-assigned unique ID for this managed resource.
    ipAddress string
    lastUsed string
    Date and time when the API key was last used from this IP address or CIDR block.
    lastUsedAddress string
    IP address from which the last API request was made.
    orgId string
    access_count int
    Total number of requests that have originated from this IP address or CIDR block.
    api_key_id str
    cidr_block str
    Range of IP addresses in CIDR notation included in the API Key access list.
    created str
    Date and time when the access list entry was created.
    id str
    The provider-assigned unique ID for this managed resource.
    ip_address str
    last_used str
    Date and time when the API key was last used from this IP address or CIDR block.
    last_used_address str
    IP address from which the last API request was made.
    org_id str
    accessCount Number
    Total number of requests that have originated from this IP address or CIDR block.
    apiKeyId String
    cidrBlock String
    Range of IP addresses in CIDR notation included in the API Key access list.
    created String
    Date and time when the access list entry was created.
    id String
    The provider-assigned unique ID for this managed resource.
    ipAddress String
    lastUsed String
    Date and time when the API key was last used from this IP address or CIDR block.
    lastUsedAddress String
    IP address from which the last API request was made.
    orgId String

    Package Details

    Repository
    MongoDB Atlas pulumi/pulumi-mongodbatlas
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the mongodbatlas Terraform Provider.
    mongodbatlas logo
    Viewing docs for MongoDB Atlas v4.5.0
    published on Thursday, Mar 12, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.