VpcConnection class

Resource for managing an AWS QuickSight VPC Connection.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const vpcConnectionRole = new aws.iam.Role("vpc_connection_role", {
    inlinePolicies: [{
        name: "QuickSightVPCConnectionRolePolicy",
        policy: JSON.stringify({
            Version: "2012-10-17",
            Statement: [{
                Effect: "Allow",
                Action: [
                    "ec2:CreateNetworkInterface",
                    "ec2:ModifyNetworkInterfaceAttribute",
                    "ec2:DeleteNetworkInterface",
                    "ec2:DescribeSubnets",
                    "ec2:DescribeSecurityGroups",
                ],
                Resource: ["*"],
            }],
        }),
    }],
    assumeRolePolicy: JSON.stringify({
        Version: "2012-10-17",
        Statement: [{
            Effect: "Allow",
            Action: "sts:AssumeRole",
            Principal: {
                Service: "quicksight.amazonaws.com",
            },
        }],
    }),
});
const example = new aws.quicksight.VpcConnection("example", {
    vpcConnectionId: "example-connection-id",
    name: "Example Connection",
    roleArn: vpcConnectionRole.arn,
    securityGroupIds: ["sg-00000000000000000"],
    subnetIds: [
        "subnet-00000000000000000",
        "subnet-00000000000000001",
    ],
});
import pulumi
import json
import pulumi_aws as aws

vpc_connection_role = aws.iam.Role("vpc_connection_role",
    inline_policies=[{
        "name": "QuickSightVPCConnectionRolePolicy",
        "policy": json.dumps({
            "Version": "2012-10-17",
            "Statement": [{
                "Effect": "Allow",
                "Action": [
                    "ec2:CreateNetworkInterface",
                    "ec2:ModifyNetworkInterfaceAttribute",
                    "ec2:DeleteNetworkInterface",
                    "ec2:DescribeSubnets",
                    "ec2:DescribeSecurityGroups",
                ],
                "Resource": ["*"],
            }],
        }),
    }],
    assume_role_policy=json.dumps({
        "Version": "2012-10-17",
        "Statement": [{
            "Effect": "Allow",
            "Action": "sts:AssumeRole",
            "Principal": {
                "Service": "quicksight.amazonaws.com",
            },
        }],
    }))
example = aws.quicksight.VpcConnection("example",
    vpc_connection_id="example-connection-id",
    name="Example Connection",
    role_arn=vpc_connection_role.arn,
    security_group_ids=["sg-00000000000000000"],
    subnet_ids=[
        "subnet-00000000000000000",
        "subnet-00000000000000001",
    ])
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var vpcConnectionRole = new Aws.Iam.Role("vpc_connection_role", new()
    {
        InlinePolicies = new[]
        {
            new Aws.Iam.Inputs.RoleInlinePolicyArgs
            {
                Name = "QuickSightVPCConnectionRolePolicy",
                Policy = JsonSerializer.Serialize(new Dictionary<string, object?>
                {
                    ["Version"] = "2012-10-17",
                    ["Statement"] = new[]
                    {
                        new Dictionary<string, object?>
                        {
                            ["Effect"] = "Allow",
                            ["Action"] = new[]
                            {
                                "ec2:CreateNetworkInterface",
                                "ec2:ModifyNetworkInterfaceAttribute",
                                "ec2:DeleteNetworkInterface",
                                "ec2:DescribeSubnets",
                                "ec2:DescribeSecurityGroups",
                            },
                            ["Resource"] = new[]
                            {
                                "*",
                            },
                        },
                    },
                }),
            },
        },
        AssumeRolePolicy = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["Version"] = "2012-10-17",
            ["Statement"] = new[]
            {
                new Dictionary<string, object?>
                {
                    ["Effect"] = "Allow",
                    ["Action"] = "sts:AssumeRole",
                    ["Principal"] = new Dictionary<string, object?>
                    {
                        ["Service"] = "quicksight.amazonaws.com",
                    },
                },
            },
        }),
    });

    var example = new Aws.Quicksight.VpcConnection("example", new()
    {
        VpcConnectionId = "example-connection-id",
        Name = "Example Connection",
        RoleArn = vpcConnectionRole.Arn,
        SecurityGroupIds = new[]
        {
            "sg-00000000000000000",
        },
        SubnetIds = new[]
        {
            "subnet-00000000000000000",
            "subnet-00000000000000001",
        },
    });

});
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/iam"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/quicksight"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"Version": "2012-10-17",
			"Statement": []map[string]interface{}{
				map[string]interface{}{
					"Effect": "Allow",
					"Action": []string{
						"ec2:CreateNetworkInterface",
						"ec2:ModifyNetworkInterfaceAttribute",
						"ec2:DeleteNetworkInterface",
						"ec2:DescribeSubnets",
						"ec2:DescribeSecurityGroups",
					},
					"Resource": []string{
						"*",
					},
				},
			},
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		tmpJSON1, err := json.Marshal(map[string]interface{}{
			"Version": "2012-10-17",
			"Statement": []map[string]interface{}{
				map[string]interface{}{
					"Effect": "Allow",
					"Action": "sts:AssumeRole",
					"Principal": map[string]string{
						"Service": "quicksight.amazonaws.com",
					},
				},
			},
		})
		if err != nil {
			return err
		}
		json1 := string(tmpJSON1)
		vpcConnectionRole, err := iam.NewRole(ctx, "vpc_connection_role", &iam.RoleArgs{
			InlinePolicies: iam.RoleInlinePolicyArray{
				&iam.RoleInlinePolicyArgs{
					Name:   pulumi.String("QuickSightVPCConnectionRolePolicy"),
					Policy: pulumi.String(json0),
				},
			},
			AssumeRolePolicy: pulumi.String(json1),
		})
		if err != nil {
			return err
		}
		_, err = quicksight.NewVpcConnection(ctx, "example", &quicksight.VpcConnectionArgs{
			VpcConnectionId: pulumi.String("example-connection-id"),
			Name:            pulumi.String("Example Connection"),
			RoleArn:         vpcConnectionRole.Arn,
			SecurityGroupIds: pulumi.StringArray{
				pulumi.String("sg-00000000000000000"),
			},
			SubnetIds: pulumi.StringArray{
				pulumi.String("subnet-00000000000000000"),
				pulumi.String("subnet-00000000000000001"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_iam_role" "vpc_connection_role" {
  inline_policies {
    name = "QuickSightVPCConnectionRolePolicy"
    policy = jsonencode({
      "Version" = "2012-10-17"
      "Statement" = [{
        "Effect"   = "Allow"
        "Action"   = ["ec2:CreateNetworkInterface", "ec2:ModifyNetworkInterfaceAttribute", "ec2:DeleteNetworkInterface", "ec2:DescribeSubnets", "ec2:DescribeSecurityGroups"]
        "Resource" = ["*"]
      }]
    })
  }
  assume_role_policy = jsonencode({
    "Version" = "2012-10-17"
    "Statement" = [{
      "Effect" = "Allow"
      "Action" = "sts:AssumeRole"
      "Principal" = {
        "Service" = "quicksight.amazonaws.com"
      }
    }]
  })
}
resource "aws_quicksight_vpcconnection" "example" {
  vpc_connection_id  = "example-connection-id"
  name               = "Example Connection"
  role_arn           = aws_iam_role.vpc_connection_role.arn
  security_group_ids = ["sg-00000000000000000"]
  subnet_ids         = ["subnet-00000000000000000", "subnet-00000000000000001"]
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.iam.inputs.RoleInlinePolicyArgs;
import com.pulumi.aws.quicksight.VpcConnection;
import com.pulumi.aws.quicksight.VpcConnectionArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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 vpcConnectionRole = new Role("vpcConnectionRole", RoleArgs.builder()
            .inlinePolicies(RoleInlinePolicyArgs.builder()
                .name("QuickSightVPCConnectionRolePolicy")
                .policy(serializeJson(
                    jsonObject(
                        jsonProperty("Version", "2012-10-17"),
                        jsonProperty("Statement", jsonArray(jsonObject(
                            jsonProperty("Effect", "Allow"),
                            jsonProperty("Action", jsonArray(
                                "ec2:CreateNetworkInterface",
                                "ec2:ModifyNetworkInterfaceAttribute",
                                "ec2:DeleteNetworkInterface",
                                "ec2:DescribeSubnets",
                                "ec2:DescribeSecurityGroups"
                            )),
                            jsonProperty("Resource", jsonArray("*"))
                        )))
                    )))
                .build())
            .assumeRolePolicy(serializeJson(
                jsonObject(
                    jsonProperty("Version", "2012-10-17"),
                    jsonProperty("Statement", jsonArray(jsonObject(
                        jsonProperty("Effect", "Allow"),
                        jsonProperty("Action", "sts:AssumeRole"),
                        jsonProperty("Principal", jsonObject(
                            jsonProperty("Service", "quicksight.amazonaws.com")
                        ))
                    )))
                )))
            .build());

        var example = new VpcConnection("example", VpcConnectionArgs.builder()
            .vpcConnectionId("example-connection-id")
            .name("Example Connection")
            .roleArn(vpcConnectionRole.arn())
            .securityGroupIds("sg-00000000000000000")
            .subnetIds(
                "subnet-00000000000000000",
                "subnet-00000000000000001")
            .build());

    }
}
resources:
  vpcConnectionRole:
    type: aws:iam:Role
    name: vpc_connection_role
    properties:
      inlinePolicies:
        - name: QuickSightVPCConnectionRolePolicy
          policy:
            fn::toJSON:
              Version: 2012-10-17
              Statement:
                - Effect: Allow
                  Action:
                    - ec2:CreateNetworkInterface
                    - ec2:ModifyNetworkInterfaceAttribute
                    - ec2:DeleteNetworkInterface
                    - ec2:DescribeSubnets
                    - ec2:DescribeSecurityGroups
                  Resource:
                    - '*'
      assumeRolePolicy:
        fn::toJSON:
          Version: 2012-10-17
          Statement:
            - Effect: Allow
              Action: sts:AssumeRole
              Principal:
                Service: quicksight.amazonaws.com
  example:
    type: aws:quicksight:VpcConnection
    properties:
      vpcConnectionId: example-connection-id
      name: Example Connection
      roleArn: ${vpcConnectionRole.arn}
      securityGroupIds:
        - sg-00000000000000000
      subnetIds:
        - subnet-00000000000000000
        - subnet-00000000000000001

Import

Using pulumi import, import QuickSight VPC connection using the AWS account ID and VPC connection ID separated by commas (,). For example:

$ pulumi import aws:quicksight/vpcConnection:VpcConnection example 123456789012,example

Constructors

VpcConnection(String name, {VpcConnectionArgs? args, CustomResourceOptions? options})
Creates a new VpcConnection. name The Pulumi resource name. args Arguments used to configure this VpcConnection. The set of arguments for VpcConnection. options Resource options controlling this resource's behavior.
VpcConnection.reference(String urn)
Creates a typed reference to an existing VpcConnection resource.

Properties

arn ↔ Output<String>
ARN of the VPC connection.
latefinal
availabilityStatus ↔ Output<String>
The availability status of the VPC connection. Valid values are AVAILABLE, UNAVAILABLE or PARTIALLY_AVAILABLE.
latefinal
awsAccountId ↔ Output<String>
AWS account ID. Defaults to automatically determined account ID of the Terraform AWS provider.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
dnsResolvers ↔ Output<List<String>?>
A list of IP addresses of DNS resolver endpoints for the VPC connection.
latefinal
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
name ↔ Output<String>
The display name for the VPC connection.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
roleArn ↔ Output<String>
The IAM role to associate with the VPC connection.
latefinal
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
securityGroupIds ↔ Output<List<String>>
A list of security group IDs for the VPC connection.
latefinal
subnetIds ↔ Output<List<String>>
A list of subnet IDs for the VPC connection.
latefinal
tags ↔ Output<Map<String, String>?>
Key-value map of resource tags. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
latefinal
tagsAll ↔ Output<Map<String, String>>
A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
timeouts ↔ Output<VpcConnectionTimeouts?>
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited
vpcConnectionId ↔ Output<String>
The ID of the VPC connection.
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, {VpcConnectionState? state, CustomResourceOptions? options}) → VpcConnection
Gets an existing VpcConnection resource's state with the given name and id.