mongodbatlas.getProjectIpAccessList
Explore with Pulumi AI
# Data Source: mongodbatlas.ProjectIpAccessList
mongodbatlas.ProjectIpAccessList
describes an IP Access List entry resource. The access list grants access from IPs, CIDRs or AWS Security Groups (if VPC Peering is enabled) 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 (comments can however), hence a change will force the destruction and recreation of entries.
Example Usage
Using CIDR Block
import * as pulumi from "@pulumi/pulumi";
import * as mongodbatlas from "@pulumi/mongodbatlas";
const testProjectIpAccessList = new mongodbatlas.ProjectIpAccessList("test", {
projectId: "<PROJECT-ID>",
cidrBlock: "1.2.3.4/32",
comment: "cidr block for tf acc testing",
});
const test = mongodbatlas.getProjectIpAccessListOutput({
projectId: testProjectIpAccessList.projectId,
cidrBlock: testProjectIpAccessList.cidrBlock,
});
import pulumi
import pulumi_mongodbatlas as mongodbatlas
test_project_ip_access_list = mongodbatlas.ProjectIpAccessList("test",
project_id="<PROJECT-ID>",
cidr_block="1.2.3.4/32",
comment="cidr block for tf acc testing")
test = mongodbatlas.get_project_ip_access_list_output(project_id=test_project_ip_access_list.project_id,
cidr_block=test_project_ip_access_list.cidr_block)
package main
import (
"github.com/pulumi/pulumi-mongodbatlas/sdk/v3/go/mongodbatlas"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
testProjectIpAccessList, err := mongodbatlas.NewProjectIpAccessList(ctx, "test", &mongodbatlas.ProjectIpAccessListArgs{
ProjectId: pulumi.String("<PROJECT-ID>"),
CidrBlock: pulumi.String("1.2.3.4/32"),
Comment: pulumi.String("cidr block for tf acc testing"),
})
if err != nil {
return err
}
_ = mongodbatlas.LookupProjectIpAccessListOutput(ctx, mongodbatlas.GetProjectIpAccessListOutputArgs{
ProjectId: testProjectIpAccessList.ProjectId,
CidrBlock: testProjectIpAccessList.CidrBlock,
}, nil)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;
return await Deployment.RunAsync(() =>
{
var testProjectIpAccessList = new Mongodbatlas.ProjectIpAccessList("test", new()
{
ProjectId = "<PROJECT-ID>",
CidrBlock = "1.2.3.4/32",
Comment = "cidr block for tf acc testing",
});
var test = Mongodbatlas.GetProjectIpAccessList.Invoke(new()
{
ProjectId = testProjectIpAccessList.ProjectId,
CidrBlock = testProjectIpAccessList.CidrBlock,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.mongodbatlas.ProjectIpAccessList;
import com.pulumi.mongodbatlas.ProjectIpAccessListArgs;
import com.pulumi.mongodbatlas.MongodbatlasFunctions;
import com.pulumi.mongodbatlas.inputs.GetProjectIpAccessListArgs;
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 testProjectIpAccessList = new ProjectIpAccessList("testProjectIpAccessList", ProjectIpAccessListArgs.builder()
.projectId("<PROJECT-ID>")
.cidrBlock("1.2.3.4/32")
.comment("cidr block for tf acc testing")
.build());
final var test = MongodbatlasFunctions.getProjectIpAccessList(GetProjectIpAccessListArgs.builder()
.projectId(testProjectIpAccessList.projectId())
.cidrBlock(testProjectIpAccessList.cidrBlock())
.build());
}
}
resources:
testProjectIpAccessList:
type: mongodbatlas:ProjectIpAccessList
name: test
properties:
projectId: <PROJECT-ID>
cidrBlock: 1.2.3.4/32
comment: cidr block for tf acc testing
variables:
test:
fn::invoke:
Function: mongodbatlas:getProjectIpAccessList
Arguments:
projectId: ${testProjectIpAccessList.projectId}
cidrBlock: ${testProjectIpAccessList.cidrBlock}
Using IP Address
import * as pulumi from "@pulumi/pulumi";
import * as mongodbatlas from "@pulumi/mongodbatlas";
const testProjectIpAccessList = new mongodbatlas.ProjectIpAccessList("test", {
projectId: "<PROJECT-ID>",
ipAddress: "2.3.4.5",
comment: "ip address for tf acc testing",
});
const test = mongodbatlas.getProjectIpAccessListOutput({
projectId: testProjectIpAccessList.projectId,
ipAddress: testProjectIpAccessList.ipAddress,
});
import pulumi
import pulumi_mongodbatlas as mongodbatlas
test_project_ip_access_list = mongodbatlas.ProjectIpAccessList("test",
project_id="<PROJECT-ID>",
ip_address="2.3.4.5",
comment="ip address for tf acc testing")
test = mongodbatlas.get_project_ip_access_list_output(project_id=test_project_ip_access_list.project_id,
ip_address=test_project_ip_access_list.ip_address)
package main
import (
"github.com/pulumi/pulumi-mongodbatlas/sdk/v3/go/mongodbatlas"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
testProjectIpAccessList, err := mongodbatlas.NewProjectIpAccessList(ctx, "test", &mongodbatlas.ProjectIpAccessListArgs{
ProjectId: pulumi.String("<PROJECT-ID>"),
IpAddress: pulumi.String("2.3.4.5"),
Comment: pulumi.String("ip address for tf acc testing"),
})
if err != nil {
return err
}
_ = mongodbatlas.LookupProjectIpAccessListOutput(ctx, mongodbatlas.GetProjectIpAccessListOutputArgs{
ProjectId: testProjectIpAccessList.ProjectId,
IpAddress: testProjectIpAccessList.IpAddress,
}, nil)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;
return await Deployment.RunAsync(() =>
{
var testProjectIpAccessList = new Mongodbatlas.ProjectIpAccessList("test", new()
{
ProjectId = "<PROJECT-ID>",
IpAddress = "2.3.4.5",
Comment = "ip address for tf acc testing",
});
var test = Mongodbatlas.GetProjectIpAccessList.Invoke(new()
{
ProjectId = testProjectIpAccessList.ProjectId,
IpAddress = testProjectIpAccessList.IpAddress,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.mongodbatlas.ProjectIpAccessList;
import com.pulumi.mongodbatlas.ProjectIpAccessListArgs;
import com.pulumi.mongodbatlas.MongodbatlasFunctions;
import com.pulumi.mongodbatlas.inputs.GetProjectIpAccessListArgs;
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 testProjectIpAccessList = new ProjectIpAccessList("testProjectIpAccessList", ProjectIpAccessListArgs.builder()
.projectId("<PROJECT-ID>")
.ipAddress("2.3.4.5")
.comment("ip address for tf acc testing")
.build());
final var test = MongodbatlasFunctions.getProjectIpAccessList(GetProjectIpAccessListArgs.builder()
.projectId(testProjectIpAccessList.projectId())
.ipAddress(testProjectIpAccessList.ipAddress())
.build());
}
}
resources:
testProjectIpAccessList:
type: mongodbatlas:ProjectIpAccessList
name: test
properties:
projectId: <PROJECT-ID>
ipAddress: 2.3.4.5
comment: ip address for tf acc testing
variables:
test:
fn::invoke:
Function: mongodbatlas:getProjectIpAccessList
Arguments:
projectId: ${testProjectIpAccessList.projectId}
ipAddress: ${testProjectIpAccessList.ipAddress}
Using an AWS Security Group
import * as pulumi from "@pulumi/pulumi";
import * as mongodbatlas from "@pulumi/mongodbatlas";
const testNetworkContainer = new mongodbatlas.NetworkContainer("test", {
projectId: "<PROJECT-ID>",
atlasCidrBlock: "192.168.208.0/21",
providerName: "AWS",
regionName: "US_EAST_1",
});
const testNetworkPeering = new mongodbatlas.NetworkPeering("test", {
projectId: "<PROJECT-ID>",
containerId: testNetworkContainer.containerId,
accepterRegionName: "us-east-1",
providerName: "AWS",
routeTableCidrBlock: "172.31.0.0/16",
vpcId: "vpc-0d93d6f69f1578bd8",
awsAccountId: "232589400519",
});
const testProjectIpAccessList = new mongodbatlas.ProjectIpAccessList("test", {
projectId: "<PROJECT-ID>",
awsSecurityGroup: "sg-0026348ec11780bd1",
comment: "TestAcc for awsSecurityGroup",
}, {
dependsOn: [testNetworkPeering],
});
const test = mongodbatlas.getProjectIpAccessListOutput({
projectId: testProjectIpAccessList.projectId,
awsSecurityGroup: testProjectIpAccessList.awsSecurityGroup,
});
import pulumi
import pulumi_mongodbatlas as mongodbatlas
test_network_container = mongodbatlas.NetworkContainer("test",
project_id="<PROJECT-ID>",
atlas_cidr_block="192.168.208.0/21",
provider_name="AWS",
region_name="US_EAST_1")
test_network_peering = mongodbatlas.NetworkPeering("test",
project_id="<PROJECT-ID>",
container_id=test_network_container.container_id,
accepter_region_name="us-east-1",
provider_name="AWS",
route_table_cidr_block="172.31.0.0/16",
vpc_id="vpc-0d93d6f69f1578bd8",
aws_account_id="232589400519")
test_project_ip_access_list = mongodbatlas.ProjectIpAccessList("test",
project_id="<PROJECT-ID>",
aws_security_group="sg-0026348ec11780bd1",
comment="TestAcc for awsSecurityGroup",
opts = pulumi.ResourceOptions(depends_on=[test_network_peering]))
test = mongodbatlas.get_project_ip_access_list_output(project_id=test_project_ip_access_list.project_id,
aws_security_group=test_project_ip_access_list.aws_security_group)
package main
import (
"github.com/pulumi/pulumi-mongodbatlas/sdk/v3/go/mongodbatlas"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
testNetworkContainer, err := mongodbatlas.NewNetworkContainer(ctx, "test", &mongodbatlas.NetworkContainerArgs{
ProjectId: pulumi.String("<PROJECT-ID>"),
AtlasCidrBlock: pulumi.String("192.168.208.0/21"),
ProviderName: pulumi.String("AWS"),
RegionName: pulumi.String("US_EAST_1"),
})
if err != nil {
return err
}
testNetworkPeering, err := mongodbatlas.NewNetworkPeering(ctx, "test", &mongodbatlas.NetworkPeeringArgs{
ProjectId: pulumi.String("<PROJECT-ID>"),
ContainerId: testNetworkContainer.ContainerId,
AccepterRegionName: pulumi.String("us-east-1"),
ProviderName: pulumi.String("AWS"),
RouteTableCidrBlock: pulumi.String("172.31.0.0/16"),
VpcId: pulumi.String("vpc-0d93d6f69f1578bd8"),
AwsAccountId: pulumi.String("232589400519"),
})
if err != nil {
return err
}
testProjectIpAccessList, err := mongodbatlas.NewProjectIpAccessList(ctx, "test", &mongodbatlas.ProjectIpAccessListArgs{
ProjectId: pulumi.String("<PROJECT-ID>"),
AwsSecurityGroup: pulumi.String("sg-0026348ec11780bd1"),
Comment: pulumi.String("TestAcc for awsSecurityGroup"),
}, pulumi.DependsOn([]pulumi.Resource{
testNetworkPeering,
}))
if err != nil {
return err
}
_ = mongodbatlas.LookupProjectIpAccessListOutput(ctx, mongodbatlas.GetProjectIpAccessListOutputArgs{
ProjectId: testProjectIpAccessList.ProjectId,
AwsSecurityGroup: testProjectIpAccessList.AwsSecurityGroup,
}, nil)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;
return await Deployment.RunAsync(() =>
{
var testNetworkContainer = new Mongodbatlas.NetworkContainer("test", new()
{
ProjectId = "<PROJECT-ID>",
AtlasCidrBlock = "192.168.208.0/21",
ProviderName = "AWS",
RegionName = "US_EAST_1",
});
var testNetworkPeering = new Mongodbatlas.NetworkPeering("test", new()
{
ProjectId = "<PROJECT-ID>",
ContainerId = testNetworkContainer.ContainerId,
AccepterRegionName = "us-east-1",
ProviderName = "AWS",
RouteTableCidrBlock = "172.31.0.0/16",
VpcId = "vpc-0d93d6f69f1578bd8",
AwsAccountId = "232589400519",
});
var testProjectIpAccessList = new Mongodbatlas.ProjectIpAccessList("test", new()
{
ProjectId = "<PROJECT-ID>",
AwsSecurityGroup = "sg-0026348ec11780bd1",
Comment = "TestAcc for awsSecurityGroup",
}, new CustomResourceOptions
{
DependsOn =
{
testNetworkPeering,
},
});
var test = Mongodbatlas.GetProjectIpAccessList.Invoke(new()
{
ProjectId = testProjectIpAccessList.ProjectId,
AwsSecurityGroup = testProjectIpAccessList.AwsSecurityGroup,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.mongodbatlas.NetworkContainer;
import com.pulumi.mongodbatlas.NetworkContainerArgs;
import com.pulumi.mongodbatlas.NetworkPeering;
import com.pulumi.mongodbatlas.NetworkPeeringArgs;
import com.pulumi.mongodbatlas.ProjectIpAccessList;
import com.pulumi.mongodbatlas.ProjectIpAccessListArgs;
import com.pulumi.mongodbatlas.MongodbatlasFunctions;
import com.pulumi.mongodbatlas.inputs.GetProjectIpAccessListArgs;
import com.pulumi.resources.CustomResourceOptions;
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 testNetworkContainer = new NetworkContainer("testNetworkContainer", NetworkContainerArgs.builder()
.projectId("<PROJECT-ID>")
.atlasCidrBlock("192.168.208.0/21")
.providerName("AWS")
.regionName("US_EAST_1")
.build());
var testNetworkPeering = new NetworkPeering("testNetworkPeering", NetworkPeeringArgs.builder()
.projectId("<PROJECT-ID>")
.containerId(testNetworkContainer.containerId())
.accepterRegionName("us-east-1")
.providerName("AWS")
.routeTableCidrBlock("172.31.0.0/16")
.vpcId("vpc-0d93d6f69f1578bd8")
.awsAccountId("232589400519")
.build());
var testProjectIpAccessList = new ProjectIpAccessList("testProjectIpAccessList", ProjectIpAccessListArgs.builder()
.projectId("<PROJECT-ID>")
.awsSecurityGroup("sg-0026348ec11780bd1")
.comment("TestAcc for awsSecurityGroup")
.build(), CustomResourceOptions.builder()
.dependsOn(testNetworkPeering)
.build());
final var test = MongodbatlasFunctions.getProjectIpAccessList(GetProjectIpAccessListArgs.builder()
.projectId(testProjectIpAccessList.projectId())
.awsSecurityGroup(testProjectIpAccessList.awsSecurityGroup())
.build());
}
}
resources:
testNetworkContainer:
type: mongodbatlas:NetworkContainer
name: test
properties:
projectId: <PROJECT-ID>
atlasCidrBlock: 192.168.208.0/21
providerName: AWS
regionName: US_EAST_1
testNetworkPeering:
type: mongodbatlas:NetworkPeering
name: test
properties:
projectId: <PROJECT-ID>
containerId: ${testNetworkContainer.containerId}
accepterRegionName: us-east-1
providerName: AWS
routeTableCidrBlock: 172.31.0.0/16
vpcId: vpc-0d93d6f69f1578bd8
awsAccountId: '232589400519'
testProjectIpAccessList:
type: mongodbatlas:ProjectIpAccessList
name: test
properties:
projectId: <PROJECT-ID>
awsSecurityGroup: sg-0026348ec11780bd1
comment: TestAcc for awsSecurityGroup
options:
dependson:
- ${testNetworkPeering}
variables:
test:
fn::invoke:
Function: mongodbatlas:getProjectIpAccessList
Arguments:
projectId: ${testProjectIpAccessList.projectId}
awsSecurityGroup: ${testProjectIpAccessList.awsSecurityGroup}
IMPORTANT: In order to use AWS Security Group(s) VPC Peering must be enabled like in the above example.
Using getProjectIpAccessList
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 getProjectIpAccessList(args: GetProjectIpAccessListArgs, opts?: InvokeOptions): Promise<GetProjectIpAccessListResult>
function getProjectIpAccessListOutput(args: GetProjectIpAccessListOutputArgs, opts?: InvokeOptions): Output<GetProjectIpAccessListResult>
def get_project_ip_access_list(aws_security_group: Optional[str] = None,
cidr_block: Optional[str] = None,
ip_address: Optional[str] = None,
project_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetProjectIpAccessListResult
def get_project_ip_access_list_output(aws_security_group: Optional[pulumi.Input[str]] = None,
cidr_block: Optional[pulumi.Input[str]] = None,
ip_address: Optional[pulumi.Input[str]] = None,
project_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetProjectIpAccessListResult]
func LookupProjectIpAccessList(ctx *Context, args *LookupProjectIpAccessListArgs, opts ...InvokeOption) (*LookupProjectIpAccessListResult, error)
func LookupProjectIpAccessListOutput(ctx *Context, args *LookupProjectIpAccessListOutputArgs, opts ...InvokeOption) LookupProjectIpAccessListResultOutput
> Note: This function is named LookupProjectIpAccessList
in the Go SDK.
public static class GetProjectIpAccessList
{
public static Task<GetProjectIpAccessListResult> InvokeAsync(GetProjectIpAccessListArgs args, InvokeOptions? opts = null)
public static Output<GetProjectIpAccessListResult> Invoke(GetProjectIpAccessListInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetProjectIpAccessListResult> getProjectIpAccessList(GetProjectIpAccessListArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: mongodbatlas:index/getProjectIpAccessList:getProjectIpAccessList
arguments:
# arguments dictionary
The following arguments are supported:
- Project
Id string - Unique identifier for the project to which you want to add one or more access list entries.
- Aws
Security stringGroup - Unique identifier of the AWS security group to add to the access list.
- Cidr
Block string - Range of IP addresses in CIDR notation to be added to the access list.
- Ip
Address string Single IP address to be added to the access list.
NOTE: One of the following attributes must set:
aws_security_group
,cidr_block
orip_address
.
- Project
Id string - Unique identifier for the project to which you want to add one or more access list entries.
- Aws
Security stringGroup - Unique identifier of the AWS security group to add to the access list.
- Cidr
Block string - Range of IP addresses in CIDR notation to be added to the access list.
- Ip
Address string Single IP address to be added to the access list.
NOTE: One of the following attributes must set:
aws_security_group
,cidr_block
orip_address
.
- project
Id String - Unique identifier for the project to which you want to add one or more access list entries.
- aws
Security StringGroup - Unique identifier of the AWS security group to add to the access list.
- cidr
Block String - Range of IP addresses in CIDR notation to be added to the access list.
- ip
Address String Single IP address to be added to the access list.
NOTE: One of the following attributes must set:
aws_security_group
,cidr_block
orip_address
.
- project
Id string - Unique identifier for the project to which you want to add one or more access list entries.
- aws
Security stringGroup - Unique identifier of the AWS security group to add to the access list.
- cidr
Block string - Range of IP addresses in CIDR notation to be added to the access list.
- ip
Address string Single IP address to be added to the access list.
NOTE: One of the following attributes must set:
aws_security_group
,cidr_block
orip_address
.
- project_
id str - Unique identifier for the project to which you want to add one or more access list entries.
- aws_
security_ strgroup - Unique identifier of the AWS security group to add to the access list.
- cidr_
block str - Range of IP addresses in CIDR notation to be added to the access list.
- ip_
address str Single IP address to be added to the access list.
NOTE: One of the following attributes must set:
aws_security_group
,cidr_block
orip_address
.
- project
Id String - Unique identifier for the project to which you want to add one or more access list entries.
- aws
Security StringGroup - Unique identifier of the AWS security group to add to the access list.
- cidr
Block String - Range of IP addresses in CIDR notation to be added to the access list.
- ip
Address String Single IP address to be added to the access list.
NOTE: One of the following attributes must set:
aws_security_group
,cidr_block
orip_address
.
getProjectIpAccessList Result
The following output properties are available:
- aws_
security_ strgroup - cidr_
block str - comment str
- Comment to add to the access list entry.
- id str
- ip_
address str - project_
id str
Package Details
- Repository
- MongoDB Atlas pulumi/pulumi-mongodbatlas
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
mongodbatlas
Terraform Provider.