VpcBlockPublicAccessExclusion class
Resource for managing an AWS EC2 VPC Block Public Access Exclusion.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test = new aws.ec2.Vpc("test", {cidrBlock: "10.1.0.0/16"});
const testVpcBlockPublicAccessExclusion = new aws.ec2.VpcBlockPublicAccessExclusion("test", {
vpcId: test.id,
internetGatewayExclusionMode: "allow-bidirectional",
});
import pulumi
import pulumi_aws as aws
test = aws.ec2.Vpc("test", cidr_block="10.1.0.0/16")
test_vpc_block_public_access_exclusion = aws.ec2.VpcBlockPublicAccessExclusion("test",
vpc_id=test.id,
internet_gateway_exclusion_mode="allow-bidirectional")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var test = new Aws.Ec2.Vpc("test", new()
{
CidrBlock = "10.1.0.0/16",
});
var testVpcBlockPublicAccessExclusion = new Aws.Ec2.VpcBlockPublicAccessExclusion("test", new()
{
VpcId = test.Id,
InternetGatewayExclusionMode = "allow-bidirectional",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
test, err := ec2.NewVpc(ctx, "test", &ec2.VpcArgs{
CidrBlock: pulumi.String("10.1.0.0/16"),
})
if err != nil {
return err
}
_, err = ec2.NewVpcBlockPublicAccessExclusion(ctx, "test", &ec2.VpcBlockPublicAccessExclusionArgs{
VpcId: test.ID().ToIDOutput().ToStringOutput(),
InternetGatewayExclusionMode: pulumi.String("allow-bidirectional"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_ec2_vpc" "test" {
cidr_block = "10.1.0.0/16"
}
resource "aws_ec2_vpcblockpublicaccessexclusion" "test" {
vpc_id = aws_ec2_vpc.test.id
internet_gateway_exclusion_mode = "allow-bidirectional"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Vpc;
import com.pulumi.aws.ec2.VpcArgs;
import com.pulumi.aws.ec2.VpcBlockPublicAccessExclusion;
import com.pulumi.aws.ec2.VpcBlockPublicAccessExclusionArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 test = new Vpc("test", VpcArgs.builder()
.cidrBlock("10.1.0.0/16")
.build());
var testVpcBlockPublicAccessExclusion = new VpcBlockPublicAccessExclusion("testVpcBlockPublicAccessExclusion", VpcBlockPublicAccessExclusionArgs.builder()
.vpcId(test.id())
.internetGatewayExclusionMode("allow-bidirectional")
.build());
}
}
resources:
test:
type: aws:ec2:Vpc
properties:
cidrBlock: 10.1.0.0/16
testVpcBlockPublicAccessExclusion:
type: aws:ec2:VpcBlockPublicAccessExclusion
name: test
properties:
vpcId: ${test.id}
internetGatewayExclusionMode: allow-bidirectional
Usage with subnet id
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test = new aws.ec2.Vpc("test", {cidrBlock: "10.1.0.0/16"});
const testSubnet = new aws.ec2.Subnet("test", {
cidrBlock: "10.1.1.0/24",
vpcId: test.id,
});
const testVpcBlockPublicAccessExclusion = new aws.ec2.VpcBlockPublicAccessExclusion("test", {
subnetId: testSubnet.id,
internetGatewayExclusionMode: "allow-egress",
});
import pulumi
import pulumi_aws as aws
test = aws.ec2.Vpc("test", cidr_block="10.1.0.0/16")
test_subnet = aws.ec2.Subnet("test",
cidr_block="10.1.1.0/24",
vpc_id=test.id)
test_vpc_block_public_access_exclusion = aws.ec2.VpcBlockPublicAccessExclusion("test",
subnet_id=test_subnet.id,
internet_gateway_exclusion_mode="allow-egress")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var test = new Aws.Ec2.Vpc("test", new()
{
CidrBlock = "10.1.0.0/16",
});
var testSubnet = new Aws.Ec2.Subnet("test", new()
{
CidrBlock = "10.1.1.0/24",
VpcId = test.Id,
});
var testVpcBlockPublicAccessExclusion = new Aws.Ec2.VpcBlockPublicAccessExclusion("test", new()
{
SubnetId = testSubnet.Id,
InternetGatewayExclusionMode = "allow-egress",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
test, err := ec2.NewVpc(ctx, "test", &ec2.VpcArgs{
CidrBlock: pulumi.String("10.1.0.0/16"),
})
if err != nil {
return err
}
testSubnet, err := ec2.NewSubnet(ctx, "test", &ec2.SubnetArgs{
CidrBlock: pulumi.String("10.1.1.0/24"),
VpcId: test.ID().ToIDOutput().ToStringOutput(),
})
if err != nil {
return err
}
_, err = ec2.NewVpcBlockPublicAccessExclusion(ctx, "test", &ec2.VpcBlockPublicAccessExclusionArgs{
SubnetId: testSubnet.ID().ToIDOutput().ToStringOutput(),
InternetGatewayExclusionMode: pulumi.String("allow-egress"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_ec2_vpc" "test" {
cidr_block = "10.1.0.0/16"
}
resource "aws_ec2_subnet" "test" {
cidr_block = "10.1.1.0/24"
vpc_id = aws_ec2_vpc.test.id
}
resource "aws_ec2_vpcblockpublicaccessexclusion" "test" {
subnet_id = aws_ec2_subnet.test.id
internet_gateway_exclusion_mode = "allow-egress"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Vpc;
import com.pulumi.aws.ec2.VpcArgs;
import com.pulumi.aws.ec2.Subnet;
import com.pulumi.aws.ec2.SubnetArgs;
import com.pulumi.aws.ec2.VpcBlockPublicAccessExclusion;
import com.pulumi.aws.ec2.VpcBlockPublicAccessExclusionArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 test = new Vpc("test", VpcArgs.builder()
.cidrBlock("10.1.0.0/16")
.build());
var testSubnet = new Subnet("testSubnet", SubnetArgs.builder()
.cidrBlock("10.1.1.0/24")
.vpcId(test.id())
.build());
var testVpcBlockPublicAccessExclusion = new VpcBlockPublicAccessExclusion("testVpcBlockPublicAccessExclusion", VpcBlockPublicAccessExclusionArgs.builder()
.subnetId(testSubnet.id())
.internetGatewayExclusionMode("allow-egress")
.build());
}
}
resources:
test:
type: aws:ec2:Vpc
properties:
cidrBlock: 10.1.0.0/16
testSubnet:
type: aws:ec2:Subnet
name: test
properties:
cidrBlock: 10.1.1.0/24
vpcId: ${test.id}
testVpcBlockPublicAccessExclusion:
type: aws:ec2:VpcBlockPublicAccessExclusion
name: test
properties:
subnetId: ${testSubnet.id}
internetGatewayExclusionMode: allow-egress
Import
Using pulumi import, import EC2 VPC Block Public Access Exclusion using the id. For example:
$ pulumi import aws:ec2/vpcBlockPublicAccessExclusion:VpcBlockPublicAccessExclusion example vpcbpa-exclude-1234abcd
Constructors
- VpcBlockPublicAccessExclusion(String name, {VpcBlockPublicAccessExclusionArgs? args, CustomResourceOptions? options})
-
Creates a new VpcBlockPublicAccessExclusion.
nameThe Pulumi resource name.argsArguments used to configure this VpcBlockPublicAccessExclusion. The set of arguments for VpcBlockPublicAccessExclusion.optionsResource options controlling this resource's behavior. - VpcBlockPublicAccessExclusion.reference(String urn)
- Creates a typed reference to an existing VpcBlockPublicAccessExclusion resource.
Properties
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
-
internetGatewayExclusionMode
↔ Output<
String> -
Mode of exclusion from Block Public Access. The allowed values are
allow-egressandallow-bidirectional.latefinal - isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceArn
↔ Output<
String> -
ARN the excluded resource.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
subnetId
↔ Output<
String?> -
Id of the subnet to which this exclusion applies. Either this or the vpcId needs to be provided.
latefinal
-
A map of tags to assign to the exclusion. If configured with a provider
defaultTagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.latefinal -
A map of tags assigned to the resource, including those inherited from the provider
defaultTagsconfiguration block.latefinal -
timeouts
↔ Output<
VpcBlockPublicAccessExclusionTimeouts?> -
latefinal
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
-
vpcId
↔ Output<
String?> -
Id of the VPC to which this exclusion applies. Either this or the subnetId needs to be provided.
latefinal
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {VpcBlockPublicAccessExclusionState? state, CustomResourceOptions? options}) → VpcBlockPublicAccessExclusion -
Gets an existing VpcBlockPublicAccessExclusion resource's state with the given
nameandid.