Try AWS Native preview for resources not in the classic version.
aws.vpclattice.AuthPolicy
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
Resource for managing an AWS VPC Lattice Auth Policy.
Example Usage
Basic Usage
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var exampleService = new Aws.VpcLattice.Service("exampleService", new()
{
AuthType = "AWS_IAM",
CustomDomainName = "example.com",
});
var exampleAuthPolicy = new Aws.VpcLattice.AuthPolicy("exampleAuthPolicy", new()
{
ResourceIdentifier = exampleService.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/v6/go/aws/vpclattice"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleService, err := vpclattice.NewService(ctx, "exampleService", &vpclattice.ServiceArgs{
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, "exampleAuthPolicy", &vpclattice.AuthPolicyArgs{
ResourceIdentifier: exampleService.Arn,
Policy: pulumi.String(json0),
})
if err != nil {
return err
}
return nil
})
}
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 exampleService = new Service("exampleService", ServiceArgs.builder()
.authType("AWS_IAM")
.customDomainName("example.com")
.build());
var exampleAuthPolicy = new AuthPolicy("exampleAuthPolicy", AuthPolicyArgs.builder()
.resourceIdentifier(exampleService.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());
}
}
import pulumi
import json
import pulumi_aws as aws
example_service = aws.vpclattice.Service("exampleService",
auth_type="AWS_IAM",
custom_domain_name="example.com")
example_auth_policy = aws.vpclattice.AuthPolicy("exampleAuthPolicy",
resource_identifier=example_service.arn,
policy=json.dumps({
"Version": "2012-10-17",
"Statement": [{
"Action": "*",
"Effect": "Allow",
"Principal": "*",
"Resource": "*",
"Condition": {
"StringNotEqualsIgnoreCase": {
"aws:PrincipalType": "anonymous",
},
},
}],
}))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const exampleService = new aws.vpclattice.Service("exampleService", {
authType: "AWS_IAM",
customDomainName: "example.com",
});
const exampleAuthPolicy = new aws.vpclattice.AuthPolicy("exampleAuthPolicy", {
resourceIdentifier: exampleService.arn,
policy: JSON.stringify({
Version: "2012-10-17",
Statement: [{
Action: "*",
Effect: "Allow",
Principal: "*",
Resource: "*",
Condition: {
StringNotEqualsIgnoreCase: {
"aws:PrincipalType": "anonymous",
},
},
}],
}),
});
resources:
exampleService:
type: aws:vpclattice:Service
properties:
authType: AWS_IAM
customDomainName: example.com
exampleAuthPolicy:
type: aws:vpclattice:AuthPolicy
properties:
resourceIdentifier: ${exampleService.arn}
policy:
fn::toJSON:
Version: 2012-10-17
Statement:
- Action: '*'
Effect: Allow
Principal: '*'
Resource: '*'
Condition:
StringNotEqualsIgnoreCase:
aws:PrincipalType: anonymous
Create AuthPolicy Resource
new AuthPolicy(name: string, args: AuthPolicyArgs, opts?: CustomResourceOptions);
@overload
def AuthPolicy(resource_name: str,
opts: Optional[ResourceOptions] = None,
policy: Optional[str] = None,
resource_identifier: Optional[str] = None,
state: Optional[str] = None)
@overload
def AuthPolicy(resource_name: str,
args: AuthPolicyArgs,
opts: Optional[ResourceOptions] = 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.
- 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.
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
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.
- Resource
Identifier 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.
- Resource
Identifier 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.
- resource
Identifier 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.
- resource
Identifier 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.
- resource
Identifier 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.
- Policy string
The auth policy. The policy string in JSON must not contain newlines or blank lines.
- Resource
Identifier 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.
- Resource
Identifier 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.
- resource
Identifier 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.
- resource
Identifier 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.
- resource
Identifier 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 example_id_arg
. For example:
$ pulumi import aws:vpclattice/authPolicy:AuthPolicy example rft-8012925589
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
aws
Terraform Provider.
Try AWS Native preview for resources not in the classic version.