1. Packages
  2. AWS
  3. API Docs
  4. ec2clientvpn
  5. AuthorizationRule
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.ec2clientvpn.AuthorizationRule

Explore with Pulumi AI

Provides authorization rules for AWS Client VPN endpoints. For more information on usage, please see the AWS Client VPN Administrator’s Guide.

Example Usage

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

const example = new aws.ec2clientvpn.AuthorizationRule("example", {
    clientVpnEndpointId: exampleAwsEc2ClientVpnEndpoint.id,
    targetNetworkCidr: exampleAwsSubnet.cidrBlock,
    authorizeAllGroups: true,
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.ec2clientvpn.AuthorizationRule("example",
    client_vpn_endpoint_id=example_aws_ec2_client_vpn_endpoint["id"],
    target_network_cidr=example_aws_subnet["cidrBlock"],
    authorize_all_groups=True)
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2clientvpn"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2clientvpn.NewAuthorizationRule(ctx, "example", &ec2clientvpn.AuthorizationRuleArgs{
			ClientVpnEndpointId: pulumi.Any(exampleAwsEc2ClientVpnEndpoint.Id),
			TargetNetworkCidr:   pulumi.Any(exampleAwsSubnet.CidrBlock),
			AuthorizeAllGroups:  pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.Ec2ClientVpn.AuthorizationRule("example", new()
    {
        ClientVpnEndpointId = exampleAwsEc2ClientVpnEndpoint.Id,
        TargetNetworkCidr = exampleAwsSubnet.CidrBlock,
        AuthorizeAllGroups = true,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2clientvpn.AuthorizationRule;
import com.pulumi.aws.ec2clientvpn.AuthorizationRuleArgs;
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 example = new AuthorizationRule("example", AuthorizationRuleArgs.builder()
            .clientVpnEndpointId(exampleAwsEc2ClientVpnEndpoint.id())
            .targetNetworkCidr(exampleAwsSubnet.cidrBlock())
            .authorizeAllGroups(true)
            .build());

    }
}
Copy
resources:
  example:
    type: aws:ec2clientvpn:AuthorizationRule
    properties:
      clientVpnEndpointId: ${exampleAwsEc2ClientVpnEndpoint.id}
      targetNetworkCidr: ${exampleAwsSubnet.cidrBlock}
      authorizeAllGroups: true
Copy

Create AuthorizationRule Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new AuthorizationRule(name: string, args: AuthorizationRuleArgs, opts?: CustomResourceOptions);
@overload
def AuthorizationRule(resource_name: str,
                      args: AuthorizationRuleArgs,
                      opts: Optional[ResourceOptions] = None)

@overload
def AuthorizationRule(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      client_vpn_endpoint_id: Optional[str] = None,
                      target_network_cidr: Optional[str] = None,
                      access_group_id: Optional[str] = None,
                      authorize_all_groups: Optional[bool] = None,
                      description: Optional[str] = None)
func NewAuthorizationRule(ctx *Context, name string, args AuthorizationRuleArgs, opts ...ResourceOption) (*AuthorizationRule, error)
public AuthorizationRule(string name, AuthorizationRuleArgs args, CustomResourceOptions? opts = null)
public AuthorizationRule(String name, AuthorizationRuleArgs args)
public AuthorizationRule(String name, AuthorizationRuleArgs args, CustomResourceOptions options)
type: aws:ec2clientvpn:AuthorizationRule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. AuthorizationRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. AuthorizationRuleArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. AuthorizationRuleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. AuthorizationRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. AuthorizationRuleArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var authorizationRuleResource = new Aws.Ec2ClientVpn.AuthorizationRule("authorizationRuleResource", new()
{
    ClientVpnEndpointId = "string",
    TargetNetworkCidr = "string",
    AccessGroupId = "string",
    AuthorizeAllGroups = false,
    Description = "string",
});
Copy
example, err := ec2clientvpn.NewAuthorizationRule(ctx, "authorizationRuleResource", &ec2clientvpn.AuthorizationRuleArgs{
	ClientVpnEndpointId: pulumi.String("string"),
	TargetNetworkCidr:   pulumi.String("string"),
	AccessGroupId:       pulumi.String("string"),
	AuthorizeAllGroups:  pulumi.Bool(false),
	Description:         pulumi.String("string"),
})
Copy
var authorizationRuleResource = new AuthorizationRule("authorizationRuleResource", AuthorizationRuleArgs.builder()
    .clientVpnEndpointId("string")
    .targetNetworkCidr("string")
    .accessGroupId("string")
    .authorizeAllGroups(false)
    .description("string")
    .build());
Copy
authorization_rule_resource = aws.ec2clientvpn.AuthorizationRule("authorizationRuleResource",
    client_vpn_endpoint_id="string",
    target_network_cidr="string",
    access_group_id="string",
    authorize_all_groups=False,
    description="string")
Copy
const authorizationRuleResource = new aws.ec2clientvpn.AuthorizationRule("authorizationRuleResource", {
    clientVpnEndpointId: "string",
    targetNetworkCidr: "string",
    accessGroupId: "string",
    authorizeAllGroups: false,
    description: "string",
});
Copy
type: aws:ec2clientvpn:AuthorizationRule
properties:
    accessGroupId: string
    authorizeAllGroups: false
    clientVpnEndpointId: string
    description: string
    targetNetworkCidr: string
Copy

AuthorizationRule Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The AuthorizationRule resource accepts the following input properties:

ClientVpnEndpointId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Client VPN endpoint.
TargetNetworkCidr
This property is required.
Changes to this property will trigger replacement.
string
The IPv4 address range, in CIDR notation, of the network to which the authorization rule applies.
AccessGroupId Changes to this property will trigger replacement. string
The ID of the group to which the authorization rule grants access. One of access_group_id or authorize_all_groups must be set.
AuthorizeAllGroups Changes to this property will trigger replacement. bool
Indicates whether the authorization rule grants access to all clients. One of access_group_id or authorize_all_groups must be set.
Description Changes to this property will trigger replacement. string
A brief description of the authorization rule.
ClientVpnEndpointId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Client VPN endpoint.
TargetNetworkCidr
This property is required.
Changes to this property will trigger replacement.
string
The IPv4 address range, in CIDR notation, of the network to which the authorization rule applies.
AccessGroupId Changes to this property will trigger replacement. string
The ID of the group to which the authorization rule grants access. One of access_group_id or authorize_all_groups must be set.
AuthorizeAllGroups Changes to this property will trigger replacement. bool
Indicates whether the authorization rule grants access to all clients. One of access_group_id or authorize_all_groups must be set.
Description Changes to this property will trigger replacement. string
A brief description of the authorization rule.
clientVpnEndpointId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Client VPN endpoint.
targetNetworkCidr
This property is required.
Changes to this property will trigger replacement.
String
The IPv4 address range, in CIDR notation, of the network to which the authorization rule applies.
accessGroupId Changes to this property will trigger replacement. String
The ID of the group to which the authorization rule grants access. One of access_group_id or authorize_all_groups must be set.
authorizeAllGroups Changes to this property will trigger replacement. Boolean
Indicates whether the authorization rule grants access to all clients. One of access_group_id or authorize_all_groups must be set.
description Changes to this property will trigger replacement. String
A brief description of the authorization rule.
clientVpnEndpointId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Client VPN endpoint.
targetNetworkCidr
This property is required.
Changes to this property will trigger replacement.
string
The IPv4 address range, in CIDR notation, of the network to which the authorization rule applies.
accessGroupId Changes to this property will trigger replacement. string
The ID of the group to which the authorization rule grants access. One of access_group_id or authorize_all_groups must be set.
authorizeAllGroups Changes to this property will trigger replacement. boolean
Indicates whether the authorization rule grants access to all clients. One of access_group_id or authorize_all_groups must be set.
description Changes to this property will trigger replacement. string
A brief description of the authorization rule.
client_vpn_endpoint_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the Client VPN endpoint.
target_network_cidr
This property is required.
Changes to this property will trigger replacement.
str
The IPv4 address range, in CIDR notation, of the network to which the authorization rule applies.
access_group_id Changes to this property will trigger replacement. str
The ID of the group to which the authorization rule grants access. One of access_group_id or authorize_all_groups must be set.
authorize_all_groups Changes to this property will trigger replacement. bool
Indicates whether the authorization rule grants access to all clients. One of access_group_id or authorize_all_groups must be set.
description Changes to this property will trigger replacement. str
A brief description of the authorization rule.
clientVpnEndpointId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Client VPN endpoint.
targetNetworkCidr
This property is required.
Changes to this property will trigger replacement.
String
The IPv4 address range, in CIDR notation, of the network to which the authorization rule applies.
accessGroupId Changes to this property will trigger replacement. String
The ID of the group to which the authorization rule grants access. One of access_group_id or authorize_all_groups must be set.
authorizeAllGroups Changes to this property will trigger replacement. Boolean
Indicates whether the authorization rule grants access to all clients. One of access_group_id or authorize_all_groups must be set.
description Changes to this property will trigger replacement. String
A brief description of the authorization rule.

Outputs

All input properties are implicitly available as output properties. Additionally, the AuthorizationRule resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing AuthorizationRule Resource

Get an existing AuthorizationRule resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: AuthorizationRuleState, opts?: CustomResourceOptions): AuthorizationRule
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        access_group_id: Optional[str] = None,
        authorize_all_groups: Optional[bool] = None,
        client_vpn_endpoint_id: Optional[str] = None,
        description: Optional[str] = None,
        target_network_cidr: Optional[str] = None) -> AuthorizationRule
func GetAuthorizationRule(ctx *Context, name string, id IDInput, state *AuthorizationRuleState, opts ...ResourceOption) (*AuthorizationRule, error)
public static AuthorizationRule Get(string name, Input<string> id, AuthorizationRuleState? state, CustomResourceOptions? opts = null)
public static AuthorizationRule get(String name, Output<String> id, AuthorizationRuleState state, CustomResourceOptions options)
resources:  _:    type: aws:ec2clientvpn:AuthorizationRule    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AccessGroupId Changes to this property will trigger replacement. string
The ID of the group to which the authorization rule grants access. One of access_group_id or authorize_all_groups must be set.
AuthorizeAllGroups Changes to this property will trigger replacement. bool
Indicates whether the authorization rule grants access to all clients. One of access_group_id or authorize_all_groups must be set.
ClientVpnEndpointId Changes to this property will trigger replacement. string
The ID of the Client VPN endpoint.
Description Changes to this property will trigger replacement. string
A brief description of the authorization rule.
TargetNetworkCidr Changes to this property will trigger replacement. string
The IPv4 address range, in CIDR notation, of the network to which the authorization rule applies.
AccessGroupId Changes to this property will trigger replacement. string
The ID of the group to which the authorization rule grants access. One of access_group_id or authorize_all_groups must be set.
AuthorizeAllGroups Changes to this property will trigger replacement. bool
Indicates whether the authorization rule grants access to all clients. One of access_group_id or authorize_all_groups must be set.
ClientVpnEndpointId Changes to this property will trigger replacement. string
The ID of the Client VPN endpoint.
Description Changes to this property will trigger replacement. string
A brief description of the authorization rule.
TargetNetworkCidr Changes to this property will trigger replacement. string
The IPv4 address range, in CIDR notation, of the network to which the authorization rule applies.
accessGroupId Changes to this property will trigger replacement. String
The ID of the group to which the authorization rule grants access. One of access_group_id or authorize_all_groups must be set.
authorizeAllGroups Changes to this property will trigger replacement. Boolean
Indicates whether the authorization rule grants access to all clients. One of access_group_id or authorize_all_groups must be set.
clientVpnEndpointId Changes to this property will trigger replacement. String
The ID of the Client VPN endpoint.
description Changes to this property will trigger replacement. String
A brief description of the authorization rule.
targetNetworkCidr Changes to this property will trigger replacement. String
The IPv4 address range, in CIDR notation, of the network to which the authorization rule applies.
accessGroupId Changes to this property will trigger replacement. string
The ID of the group to which the authorization rule grants access. One of access_group_id or authorize_all_groups must be set.
authorizeAllGroups Changes to this property will trigger replacement. boolean
Indicates whether the authorization rule grants access to all clients. One of access_group_id or authorize_all_groups must be set.
clientVpnEndpointId Changes to this property will trigger replacement. string
The ID of the Client VPN endpoint.
description Changes to this property will trigger replacement. string
A brief description of the authorization rule.
targetNetworkCidr Changes to this property will trigger replacement. string
The IPv4 address range, in CIDR notation, of the network to which the authorization rule applies.
access_group_id Changes to this property will trigger replacement. str
The ID of the group to which the authorization rule grants access. One of access_group_id or authorize_all_groups must be set.
authorize_all_groups Changes to this property will trigger replacement. bool
Indicates whether the authorization rule grants access to all clients. One of access_group_id or authorize_all_groups must be set.
client_vpn_endpoint_id Changes to this property will trigger replacement. str
The ID of the Client VPN endpoint.
description Changes to this property will trigger replacement. str
A brief description of the authorization rule.
target_network_cidr Changes to this property will trigger replacement. str
The IPv4 address range, in CIDR notation, of the network to which the authorization rule applies.
accessGroupId Changes to this property will trigger replacement. String
The ID of the group to which the authorization rule grants access. One of access_group_id or authorize_all_groups must be set.
authorizeAllGroups Changes to this property will trigger replacement. Boolean
Indicates whether the authorization rule grants access to all clients. One of access_group_id or authorize_all_groups must be set.
clientVpnEndpointId Changes to this property will trigger replacement. String
The ID of the Client VPN endpoint.
description Changes to this property will trigger replacement. String
A brief description of the authorization rule.
targetNetworkCidr Changes to this property will trigger replacement. String
The IPv4 address range, in CIDR notation, of the network to which the authorization rule applies.

Import

Using the endpoint ID, target network CIDR, and group name:

Using pulumi import to import AWS Client VPN authorization rules using the endpoint ID and target network CIDR. If there is a specific group name, include that also. All values are separated by a ,. For example:

Using the endpoint ID and target network CIDR:

$ pulumi import aws:ec2clientvpn/authorizationRule:AuthorizationRule example cvpn-endpoint-0ac3a1abbccddd666,10.1.0.0/24
Copy

Using the endpoint ID, target network CIDR, and group name:

$ pulumi import aws:ec2clientvpn/authorizationRule:AuthorizationRule example cvpn-endpoint-0ac3a1abbccddd666,10.1.0.0/24,team-a
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.