AuthPolicy class

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",
                },
            },
        }],
    }))
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 main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-aws/sdk/v7/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]map[string]string{
						"StringNotEqualsIgnoreCase": map[string]string{
							"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
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_vpclattice_service" "example" {
  name               = "example-vpclattice-service"
  auth_type          = "AWS_IAM"
  custom_domain_name = "example.com"
}
resource "aws_vpclattice_authpolicy" "example" {
  resource_identifier = aws_vpclattice_service.example.arn
  policy = jsonencode({
    "Version" = "2012-10-17"
    "Statement" = [{
      "Action"    = "*"
      "Effect"    = "Allow"
      "Principal" = "*"
      "Resource"  = "*"
      "Condition" = {
        "StringNotEqualsIgnoreCase" = {
          "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.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 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

Import

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

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

Constructors

AuthPolicy(String name, {AuthPolicyArgs? args, CustomResourceOptions? options})
Creates a new AuthPolicy. name The Pulumi resource name. args Arguments used to configure this AuthPolicy. The set of arguments for AuthPolicy. options Resource options controlling this resource's behavior.
AuthPolicy.reference(String urn)
Creates a typed reference to an existing AuthPolicy 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
policy ↔ Output<String>
Auth policy. The policy string in JSON must not contain newlines or blank lines.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceIdentifier ↔ Output<String>
ID or ARN of the service network or service for which the policy is created.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
state ↔ Output<String?>
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.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

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, {AuthPolicyState? state, CustomResourceOptions? options}) → AuthPolicy
Gets an existing AuthPolicy resource's state with the given name and id.