SecurityGroupAssociation class
Provides a resource to create an association between a VPC endpoint and a security group.
> NOTE on VPC Endpoints and VPC Endpoint Security Group Associations: The provider provides
both a standalone VPC Endpoint Security Group Association (an association between a VPC endpoint
and a single securityGroupId) and a VPC Endpoint resource with a securityGroupIds
attribute. Do not use the same security group ID in both a VPC Endpoint resource and a VPC Endpoint Security
Group Association resource. Doing so will cause a conflict of associations and will overwrite the association.
Example Usage
Basic usage:
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const sgEc2 = new aws.ec2.SecurityGroupAssociation("sg_ec2", {
vpcEndpointId: ec2.id,
securityGroupId: sg.id,
});
import pulumi
import pulumi_aws as aws
sg_ec2 = aws.ec2.SecurityGroupAssociation("sg_ec2",
vpc_endpoint_id=ec2["id"],
security_group_id=sg["id"])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var sgEc2 = new Aws.Ec2.SecurityGroupAssociation("sg_ec2", new()
{
VpcEndpointId = ec2.Id,
SecurityGroupId = sg.Id,
});
});
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 {
_, err := ec2.NewSecurityGroupAssociation(ctx, "sg_ec2", &ec2.SecurityGroupAssociationArgs{
VpcEndpointId: pulumi.Any(ec2.Id),
SecurityGroupId: pulumi.Any(sg.Id),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_ec2_securitygroupassociation" "sg_ec2" {
vpc_endpoint_id = ec2.id
security_group_id = sg.id
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.SecurityGroupAssociation;
import com.pulumi.aws.ec2.SecurityGroupAssociationArgs;
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 sgEc2 = new SecurityGroupAssociation("sgEc2", SecurityGroupAssociationArgs.builder()
.vpcEndpointId(ec2.id())
.securityGroupId(sg.id())
.build());
}
}
resources:
sgEc2:
type: aws:ec2:SecurityGroupAssociation
name: sg_ec2
properties:
vpcEndpointId: ${ec2.id}
securityGroupId: ${sg.id}
Import
Using pulumi import, import VPC Endpoint Security Group Associations using vpcEndpointId together with securityGroupId. For example:
$ pulumi import aws:ec2/securityGroupAssociation:SecurityGroupAssociation example vpce-aaaaaaaa/sg-bbbbbbbbbbbbbbbbb
Constructors
- SecurityGroupAssociation(String name, {SecurityGroupAssociationArgs? args, CustomResourceOptions? options})
-
Creates a new SecurityGroupAssociation.
nameThe Pulumi resource name.argsArguments used to configure this SecurityGroupAssociation. The set of arguments for SecurityGroupAssociation.optionsResource options controlling this resource's behavior. - SecurityGroupAssociation.reference(String urn)
- Creates a typed reference to an existing SecurityGroupAssociation 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
- 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
-
replaceDefaultAssociation
↔ Output<
bool?> -
Whether this association should replace the association with the VPC's default security group that is created when no security groups are specified during VPC endpoint creation. At most 1 association per-VPC endpoint should be configured with
replaceDefaultAssociation = true.falseshould be used when importing resources.latefinal -
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
securityGroupId
↔ Output<
String> -
The ID of the security group to be associated with the VPC endpoint.
latefinal
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
-
vpcEndpointId
↔ Output<
String> -
The ID of the VPC endpoint with which the security group will be associated.
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, {SecurityGroupAssociationState? state, CustomResourceOptions? options}) → SecurityGroupAssociation -
Gets an existing SecurityGroupAssociation resource's state with the given
nameandid.