1. Packages
  2. AWS
  3. API Docs
  4. vpclattice
  5. AuthPolicy
AWS v6.64.0 published on Friday, Dec 6, 2024 by Pulumi

aws.vpclattice.AuthPolicy

Explore with Pulumi AI

aws logo
AWS v6.64.0 published on Friday, Dec 6, 2024 by Pulumi

    Resource for managing an AWS VPC Lattice Auth Policy.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.vpclattice.Service("example", {
        name: "example-vpclattice-service",
        authType: "AWS_IAM",
        customDomainName: "example.com",
    });
    const exampleAuthPolicy = new aws.vpclattice.AuthPolicy("example", {
        resourceIdentifier: example.arn,
        policy: JSON.stringify({
            Version: "2012-10-17",
            Statement: [{
                Action: "*",
                Effect: "Allow",
                Principal: "*",
                Resource: "*",
                Condition: {
                    StringNotEqualsIgnoreCase: {
                        "aws:PrincipalType": "anonymous",
                    },
                },
            }],
        }),
    });
    
    import pulumi
    import json
    import pulumi_aws as aws
    
    example = aws.vpclattice.Service("example",
        name="example-vpclattice-service",
        auth_type="AWS_IAM",
        custom_domain_name="example.com")
    example_auth_policy = aws.vpclattice.AuthPolicy("example",
        resource_identifier=example.arn,
        policy=json.dumps({
            "Version": "2012-10-17",
            "Statement": [{
                "Action": "*",
                "Effect": "Allow",
                "Principal": "*",
                "Resource": "*",
                "Condition": {
                    "StringNotEqualsIgnoreCase": {
                        "aws:PrincipalType": "anonymous",
                    },
                },
            }],
        }))
    
    package main
    
    import (
    	"encoding/json"
    
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/vpclattice"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := vpclattice.NewService(ctx, "example", &vpclattice.ServiceArgs{
    			Name:             pulumi.String("example-vpclattice-service"),
    			AuthType:         pulumi.String("AWS_IAM"),
    			CustomDomainName: pulumi.String("example.com"),
    		})
    		if err != nil {
    			return err
    		}
    		tmpJSON0, err := json.Marshal(map[string]interface{}{
    			"Version": "2012-10-17",
    			"Statement": []map[string]interface{}{
    				map[string]interface{}{
    					"Action":    "*",
    					"Effect":    "Allow",
    					"Principal": "*",
    					"Resource":  "*",
    					"Condition": map[string]interface{}{
    						"StringNotEqualsIgnoreCase": map[string]interface{}{
    							"aws:PrincipalType": "anonymous",
    						},
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		_, err = vpclattice.NewAuthPolicy(ctx, "example", &vpclattice.AuthPolicyArgs{
    			ResourceIdentifier: example.Arn,
    			Policy:             pulumi.String(json0),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.VpcLattice.Service("example", new()
        {
            Name = "example-vpclattice-service",
            AuthType = "AWS_IAM",
            CustomDomainName = "example.com",
        });
    
        var exampleAuthPolicy = new Aws.VpcLattice.AuthPolicy("example", new()
        {
            ResourceIdentifier = example.Arn,
            Policy = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["Version"] = "2012-10-17",
                ["Statement"] = new[]
                {
                    new Dictionary<string, object?>
                    {
                        ["Action"] = "*",
                        ["Effect"] = "Allow",
                        ["Principal"] = "*",
                        ["Resource"] = "*",
                        ["Condition"] = new Dictionary<string, object?>
                        {
                            ["StringNotEqualsIgnoreCase"] = new Dictionary<string, object?>
                            {
                                ["aws:PrincipalType"] = "anonymous",
                            },
                        },
                    },
                },
            }),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.vpclattice.Service;
    import com.pulumi.aws.vpclattice.ServiceArgs;
    import com.pulumi.aws.vpclattice.AuthPolicy;
    import com.pulumi.aws.vpclattice.AuthPolicyArgs;
    import static com.pulumi.codegen.internal.Serialization.*;
    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 Service("example", ServiceArgs.builder()
                .name("example-vpclattice-service")
                .authType("AWS_IAM")
                .customDomainName("example.com")
                .build());
    
            var exampleAuthPolicy = new AuthPolicy("exampleAuthPolicy", AuthPolicyArgs.builder()
                .resourceIdentifier(example.arn())
                .policy(serializeJson(
                    jsonObject(
                        jsonProperty("Version", "2012-10-17"),
                        jsonProperty("Statement", jsonArray(jsonObject(
                            jsonProperty("Action", "*"),
                            jsonProperty("Effect", "Allow"),
                            jsonProperty("Principal", "*"),
                            jsonProperty("Resource", "*"),
                            jsonProperty("Condition", jsonObject(
                                jsonProperty("StringNotEqualsIgnoreCase", jsonObject(
                                    jsonProperty("aws:PrincipalType", "anonymous")
                                ))
                            ))
                        )))
                    )))
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:vpclattice:Service
        properties:
          name: example-vpclattice-service
          authType: AWS_IAM
          customDomainName: example.com
      exampleAuthPolicy:
        type: aws:vpclattice:AuthPolicy
        name: example
        properties:
          resourceIdentifier: ${example.arn}
          policy:
            fn::toJSON:
              Version: 2012-10-17
              Statement:
                - Action: '*'
                  Effect: Allow
                  Principal: '*'
                  Resource: '*'
                  Condition:
                    StringNotEqualsIgnoreCase:
                      aws:PrincipalType: anonymous
    

    Create AuthPolicy Resource

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

    Constructor syntax

    new AuthPolicy(name: string, args: AuthPolicyArgs, opts?: CustomResourceOptions);
    @overload
    def AuthPolicy(resource_name: str,
                   args: AuthPolicyArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def AuthPolicy(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   policy: Optional[str] = None,
                   resource_identifier: Optional[str] = None,
                   state: Optional[str] = None)
    func NewAuthPolicy(ctx *Context, name string, args AuthPolicyArgs, opts ...ResourceOption) (*AuthPolicy, error)
    public AuthPolicy(string name, AuthPolicyArgs args, CustomResourceOptions? opts = null)
    public AuthPolicy(String name, AuthPolicyArgs args)
    public AuthPolicy(String name, AuthPolicyArgs args, CustomResourceOptions options)
    
    type: aws:vpclattice:AuthPolicy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args AuthPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args AuthPolicyArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args AuthPolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AuthPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AuthPolicyArgs
    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 authPolicyResource = new Aws.VpcLattice.AuthPolicy("authPolicyResource", new()
    {
        Policy = "string",
        ResourceIdentifier = "string",
        State = "string",
    });
    
    example, err := vpclattice.NewAuthPolicy(ctx, "authPolicyResource", &vpclattice.AuthPolicyArgs{
    	Policy:             pulumi.String("string"),
    	ResourceIdentifier: pulumi.String("string"),
    	State:              pulumi.String("string"),
    })
    
    var authPolicyResource = new AuthPolicy("authPolicyResource", AuthPolicyArgs.builder()
        .policy("string")
        .resourceIdentifier("string")
        .state("string")
        .build());
    
    auth_policy_resource = aws.vpclattice.AuthPolicy("authPolicyResource",
        policy="string",
        resource_identifier="string",
        state="string")
    
    const authPolicyResource = new aws.vpclattice.AuthPolicy("authPolicyResource", {
        policy: "string",
        resourceIdentifier: "string",
        state: "string",
    });
    
    type: aws:vpclattice:AuthPolicy
    properties:
        policy: string
        resourceIdentifier: string
        state: string
    

    AuthPolicy 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 AuthPolicy resource accepts the following input properties:

    Policy string
    The auth policy. The policy string in JSON must not contain newlines or blank lines.
    ResourceIdentifier string
    The ID or Amazon Resource Name (ARN) of the service network or service for which the policy is created.
    State string
    The state of the auth policy. The auth policy is only active when the auth type is set to AWS_IAM. If you provide a policy, then authentication and authorization decisions are made based on this policy and the client's IAM policy. If the Auth type is NONE, then, any auth policy you provide will remain inactive.
    Policy string
    The auth policy. The policy string in JSON must not contain newlines or blank lines.
    ResourceIdentifier string
    The ID or Amazon Resource Name (ARN) of the service network or service for which the policy is created.
    State string
    The state of the auth policy. The auth policy is only active when the auth type is set to AWS_IAM. If you provide a policy, then authentication and authorization decisions are made based on this policy and the client's IAM policy. If the Auth type is NONE, then, any auth policy you provide will remain inactive.
    policy String
    The auth policy. The policy string in JSON must not contain newlines or blank lines.
    resourceIdentifier String
    The ID or Amazon Resource Name (ARN) of the service network or service for which the policy is created.
    state String
    The state of the auth policy. The auth policy is only active when the auth type is set to AWS_IAM. If you provide a policy, then authentication and authorization decisions are made based on this policy and the client's IAM policy. If the Auth type is NONE, then, any auth policy you provide will remain inactive.
    policy string
    The auth policy. The policy string in JSON must not contain newlines or blank lines.
    resourceIdentifier string
    The ID or Amazon Resource Name (ARN) of the service network or service for which the policy is created.
    state string
    The state of the auth policy. The auth policy is only active when the auth type is set to AWS_IAM. If you provide a policy, then authentication and authorization decisions are made based on this policy and the client's IAM policy. If the Auth type is NONE, then, any auth policy you provide will remain inactive.
    policy str
    The auth policy. The policy string in JSON must not contain newlines or blank lines.
    resource_identifier str
    The ID or Amazon Resource Name (ARN) of the service network or service for which the policy is created.
    state str
    The state of the auth policy. The auth policy is only active when the auth type is set to AWS_IAM. If you provide a policy, then authentication and authorization decisions are made based on this policy and the client's IAM policy. If the Auth type is NONE, then, any auth policy you provide will remain inactive.
    policy String
    The auth policy. The policy string in JSON must not contain newlines or blank lines.
    resourceIdentifier String
    The ID or Amazon Resource Name (ARN) of the service network or service for which the policy is created.
    state String
    The state of the auth policy. The auth policy is only active when the auth type is set to AWS_IAM. If you provide a policy, then authentication and authorization decisions are made based on this policy and the client's IAM policy. If the Auth type is NONE, then, any auth policy you provide will remain inactive.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the AuthPolicy 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 AuthPolicy Resource

    Get an existing AuthPolicy 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?: AuthPolicyState, opts?: CustomResourceOptions): AuthPolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            policy: Optional[str] = None,
            resource_identifier: Optional[str] = None,
            state: Optional[str] = None) -> AuthPolicy
    func GetAuthPolicy(ctx *Context, name string, id IDInput, state *AuthPolicyState, opts ...ResourceOption) (*AuthPolicy, error)
    public static AuthPolicy Get(string name, Input<string> id, AuthPolicyState? state, CustomResourceOptions? opts = null)
    public static AuthPolicy get(String name, Output<String> id, AuthPolicyState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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:
    Policy string
    The auth policy. The policy string in JSON must not contain newlines or blank lines.
    ResourceIdentifier string
    The ID or Amazon Resource Name (ARN) of the service network or service for which the policy is created.
    State string
    The state of the auth policy. The auth policy is only active when the auth type is set to AWS_IAM. If you provide a policy, then authentication and authorization decisions are made based on this policy and the client's IAM policy. If the Auth type is NONE, then, any auth policy you provide will remain inactive.
    Policy string
    The auth policy. The policy string in JSON must not contain newlines or blank lines.
    ResourceIdentifier string
    The ID or Amazon Resource Name (ARN) of the service network or service for which the policy is created.
    State string
    The state of the auth policy. The auth policy is only active when the auth type is set to AWS_IAM. If you provide a policy, then authentication and authorization decisions are made based on this policy and the client's IAM policy. If the Auth type is NONE, then, any auth policy you provide will remain inactive.
    policy String
    The auth policy. The policy string in JSON must not contain newlines or blank lines.
    resourceIdentifier String
    The ID or Amazon Resource Name (ARN) of the service network or service for which the policy is created.
    state String
    The state of the auth policy. The auth policy is only active when the auth type is set to AWS_IAM. If you provide a policy, then authentication and authorization decisions are made based on this policy and the client's IAM policy. If the Auth type is NONE, then, any auth policy you provide will remain inactive.
    policy string
    The auth policy. The policy string in JSON must not contain newlines or blank lines.
    resourceIdentifier string
    The ID or Amazon Resource Name (ARN) of the service network or service for which the policy is created.
    state string
    The state of the auth policy. The auth policy is only active when the auth type is set to AWS_IAM. If you provide a policy, then authentication and authorization decisions are made based on this policy and the client's IAM policy. If the Auth type is NONE, then, any auth policy you provide will remain inactive.
    policy str
    The auth policy. The policy string in JSON must not contain newlines or blank lines.
    resource_identifier str
    The ID or Amazon Resource Name (ARN) of the service network or service for which the policy is created.
    state str
    The state of the auth policy. The auth policy is only active when the auth type is set to AWS_IAM. If you provide a policy, then authentication and authorization decisions are made based on this policy and the client's IAM policy. If the Auth type is NONE, then, any auth policy you provide will remain inactive.
    policy String
    The auth policy. The policy string in JSON must not contain newlines or blank lines.
    resourceIdentifier String
    The ID or Amazon Resource Name (ARN) of the service network or service for which the policy is created.
    state String
    The state of the auth policy. The auth policy is only active when the auth type is set to AWS_IAM. If you provide a policy, then authentication and authorization decisions are made based on this policy and the client's IAM policy. If the Auth type is NONE, then, any auth policy you provide will remain inactive.

    Import

    Using pulumi import, import VPC Lattice Auth Policy using the id. For example:

    $ pulumi import aws:vpclattice/authPolicy:AuthPolicy example abcd-12345678
    

    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.
    aws logo
    AWS v6.64.0 published on Friday, Dec 6, 2024 by Pulumi