1. Packages
  2. AWS Classic
  3. API Docs
  4. eks
  5. AccessPolicyAssociation

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.32.0 published on Friday, Apr 19, 2024 by Pulumi

aws.eks.AccessPolicyAssociation

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.32.0 published on Friday, Apr 19, 2024 by Pulumi

    Access Entry Policy Association for an EKS Cluster.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.eks.AccessPolicyAssociation("example", {
        clusterName: exampleAwsEksCluster.name,
        policyArn: "arn:aws:eks::aws:cluster-access-policy/AmazonEKSViewPolicy",
        principalArn: exampleAwsIamUser.arn,
        accessScope: {
            type: "namespace",
            namespaces: ["example-namespace"],
        },
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.eks.AccessPolicyAssociation("example",
        cluster_name=example_aws_eks_cluster["name"],
        policy_arn="arn:aws:eks::aws:cluster-access-policy/AmazonEKSViewPolicy",
        principal_arn=example_aws_iam_user["arn"],
        access_scope=aws.eks.AccessPolicyAssociationAccessScopeArgs(
            type="namespace",
            namespaces=["example-namespace"],
        ))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/eks"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := eks.NewAccessPolicyAssociation(ctx, "example", &eks.AccessPolicyAssociationArgs{
    			ClusterName:  pulumi.Any(exampleAwsEksCluster.Name),
    			PolicyArn:    pulumi.String("arn:aws:eks::aws:cluster-access-policy/AmazonEKSViewPolicy"),
    			PrincipalArn: pulumi.Any(exampleAwsIamUser.Arn),
    			AccessScope: &eks.AccessPolicyAssociationAccessScopeArgs{
    				Type: pulumi.String("namespace"),
    				Namespaces: pulumi.StringArray{
    					pulumi.String("example-namespace"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.Eks.AccessPolicyAssociation("example", new()
        {
            ClusterName = exampleAwsEksCluster.Name,
            PolicyArn = "arn:aws:eks::aws:cluster-access-policy/AmazonEKSViewPolicy",
            PrincipalArn = exampleAwsIamUser.Arn,
            AccessScope = new Aws.Eks.Inputs.AccessPolicyAssociationAccessScopeArgs
            {
                Type = "namespace",
                Namespaces = new[]
                {
                    "example-namespace",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.eks.AccessPolicyAssociation;
    import com.pulumi.aws.eks.AccessPolicyAssociationArgs;
    import com.pulumi.aws.eks.inputs.AccessPolicyAssociationAccessScopeArgs;
    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 AccessPolicyAssociation("example", AccessPolicyAssociationArgs.builder()        
                .clusterName(exampleAwsEksCluster.name())
                .policyArn("arn:aws:eks::aws:cluster-access-policy/AmazonEKSViewPolicy")
                .principalArn(exampleAwsIamUser.arn())
                .accessScope(AccessPolicyAssociationAccessScopeArgs.builder()
                    .type("namespace")
                    .namespaces("example-namespace")
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:eks:AccessPolicyAssociation
        properties:
          clusterName: ${exampleAwsEksCluster.name}
          policyArn: arn:aws:eks::aws:cluster-access-policy/AmazonEKSViewPolicy
          principalArn: ${exampleAwsIamUser.arn}
          accessScope:
            type: namespace
            namespaces:
              - example-namespace
    

    Create AccessPolicyAssociation Resource

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

    Constructor syntax

    new AccessPolicyAssociation(name: string, args: AccessPolicyAssociationArgs, opts?: CustomResourceOptions);
    @overload
    def AccessPolicyAssociation(resource_name: str,
                                args: AccessPolicyAssociationArgs,
                                opts: Optional[ResourceOptions] = None)
    
    @overload
    def AccessPolicyAssociation(resource_name: str,
                                opts: Optional[ResourceOptions] = None,
                                access_scope: Optional[AccessPolicyAssociationAccessScopeArgs] = None,
                                cluster_name: Optional[str] = None,
                                policy_arn: Optional[str] = None,
                                principal_arn: Optional[str] = None)
    func NewAccessPolicyAssociation(ctx *Context, name string, args AccessPolicyAssociationArgs, opts ...ResourceOption) (*AccessPolicyAssociation, error)
    public AccessPolicyAssociation(string name, AccessPolicyAssociationArgs args, CustomResourceOptions? opts = null)
    public AccessPolicyAssociation(String name, AccessPolicyAssociationArgs args)
    public AccessPolicyAssociation(String name, AccessPolicyAssociationArgs args, CustomResourceOptions options)
    
    type: aws:eks:AccessPolicyAssociation
    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 AccessPolicyAssociationArgs
    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 AccessPolicyAssociationArgs
    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 AccessPolicyAssociationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AccessPolicyAssociationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AccessPolicyAssociationArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

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

    var accessPolicyAssociationResource = new Aws.Eks.AccessPolicyAssociation("accessPolicyAssociationResource", new()
    {
        AccessScope = new Aws.Eks.Inputs.AccessPolicyAssociationAccessScopeArgs
        {
            Type = "string",
            Namespaces = new[]
            {
                "string",
            },
        },
        ClusterName = "string",
        PolicyArn = "string",
        PrincipalArn = "string",
    });
    
    example, err := eks.NewAccessPolicyAssociation(ctx, "accessPolicyAssociationResource", &eks.AccessPolicyAssociationArgs{
    	AccessScope: &eks.AccessPolicyAssociationAccessScopeArgs{
    		Type: pulumi.String("string"),
    		Namespaces: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    	},
    	ClusterName:  pulumi.String("string"),
    	PolicyArn:    pulumi.String("string"),
    	PrincipalArn: pulumi.String("string"),
    })
    
    var accessPolicyAssociationResource = new AccessPolicyAssociation("accessPolicyAssociationResource", AccessPolicyAssociationArgs.builder()        
        .accessScope(AccessPolicyAssociationAccessScopeArgs.builder()
            .type("string")
            .namespaces("string")
            .build())
        .clusterName("string")
        .policyArn("string")
        .principalArn("string")
        .build());
    
    access_policy_association_resource = aws.eks.AccessPolicyAssociation("accessPolicyAssociationResource",
        access_scope=aws.eks.AccessPolicyAssociationAccessScopeArgs(
            type="string",
            namespaces=["string"],
        ),
        cluster_name="string",
        policy_arn="string",
        principal_arn="string")
    
    const accessPolicyAssociationResource = new aws.eks.AccessPolicyAssociation("accessPolicyAssociationResource", {
        accessScope: {
            type: "string",
            namespaces: ["string"],
        },
        clusterName: "string",
        policyArn: "string",
        principalArn: "string",
    });
    
    type: aws:eks:AccessPolicyAssociation
    properties:
        accessScope:
            namespaces:
                - string
            type: string
        clusterName: string
        policyArn: string
        principalArn: string
    

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

    AccessScope AccessPolicyAssociationAccessScope
    The configuration block to determine the scope of the access. See access_scope Block below.
    ClusterName string
    Name of the EKS Cluster.
    PolicyArn string
    The ARN of the access policy that you're associating.
    PrincipalArn string
    The IAM Principal ARN which requires Authentication access to the EKS cluster.
    AccessScope AccessPolicyAssociationAccessScopeArgs
    The configuration block to determine the scope of the access. See access_scope Block below.
    ClusterName string
    Name of the EKS Cluster.
    PolicyArn string
    The ARN of the access policy that you're associating.
    PrincipalArn string
    The IAM Principal ARN which requires Authentication access to the EKS cluster.
    accessScope AccessPolicyAssociationAccessScope
    The configuration block to determine the scope of the access. See access_scope Block below.
    clusterName String
    Name of the EKS Cluster.
    policyArn String
    The ARN of the access policy that you're associating.
    principalArn String
    The IAM Principal ARN which requires Authentication access to the EKS cluster.
    accessScope AccessPolicyAssociationAccessScope
    The configuration block to determine the scope of the access. See access_scope Block below.
    clusterName string
    Name of the EKS Cluster.
    policyArn string
    The ARN of the access policy that you're associating.
    principalArn string
    The IAM Principal ARN which requires Authentication access to the EKS cluster.
    access_scope AccessPolicyAssociationAccessScopeArgs
    The configuration block to determine the scope of the access. See access_scope Block below.
    cluster_name str
    Name of the EKS Cluster.
    policy_arn str
    The ARN of the access policy that you're associating.
    principal_arn str
    The IAM Principal ARN which requires Authentication access to the EKS cluster.
    accessScope Property Map
    The configuration block to determine the scope of the access. See access_scope Block below.
    clusterName String
    Name of the EKS Cluster.
    policyArn String
    The ARN of the access policy that you're associating.
    principalArn String
    The IAM Principal ARN which requires Authentication access to the EKS cluster.

    Outputs

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

    AssociatedAt string
    Date and time in RFC3339 format that the policy was associated.
    Id string
    The provider-assigned unique ID for this managed resource.
    ModifiedAt string
    Date and time in RFC3339 format that the policy was updated.
    AssociatedAt string
    Date and time in RFC3339 format that the policy was associated.
    Id string
    The provider-assigned unique ID for this managed resource.
    ModifiedAt string
    Date and time in RFC3339 format that the policy was updated.
    associatedAt String
    Date and time in RFC3339 format that the policy was associated.
    id String
    The provider-assigned unique ID for this managed resource.
    modifiedAt String
    Date and time in RFC3339 format that the policy was updated.
    associatedAt string
    Date and time in RFC3339 format that the policy was associated.
    id string
    The provider-assigned unique ID for this managed resource.
    modifiedAt string
    Date and time in RFC3339 format that the policy was updated.
    associated_at str
    Date and time in RFC3339 format that the policy was associated.
    id str
    The provider-assigned unique ID for this managed resource.
    modified_at str
    Date and time in RFC3339 format that the policy was updated.
    associatedAt String
    Date and time in RFC3339 format that the policy was associated.
    id String
    The provider-assigned unique ID for this managed resource.
    modifiedAt String
    Date and time in RFC3339 format that the policy was updated.

    Look up Existing AccessPolicyAssociation Resource

    Get an existing AccessPolicyAssociation 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?: AccessPolicyAssociationState, opts?: CustomResourceOptions): AccessPolicyAssociation
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            access_scope: Optional[AccessPolicyAssociationAccessScopeArgs] = None,
            associated_at: Optional[str] = None,
            cluster_name: Optional[str] = None,
            modified_at: Optional[str] = None,
            policy_arn: Optional[str] = None,
            principal_arn: Optional[str] = None) -> AccessPolicyAssociation
    func GetAccessPolicyAssociation(ctx *Context, name string, id IDInput, state *AccessPolicyAssociationState, opts ...ResourceOption) (*AccessPolicyAssociation, error)
    public static AccessPolicyAssociation Get(string name, Input<string> id, AccessPolicyAssociationState? state, CustomResourceOptions? opts = null)
    public static AccessPolicyAssociation get(String name, Output<String> id, AccessPolicyAssociationState 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:
    AccessScope AccessPolicyAssociationAccessScope
    The configuration block to determine the scope of the access. See access_scope Block below.
    AssociatedAt string
    Date and time in RFC3339 format that the policy was associated.
    ClusterName string
    Name of the EKS Cluster.
    ModifiedAt string
    Date and time in RFC3339 format that the policy was updated.
    PolicyArn string
    The ARN of the access policy that you're associating.
    PrincipalArn string
    The IAM Principal ARN which requires Authentication access to the EKS cluster.
    AccessScope AccessPolicyAssociationAccessScopeArgs
    The configuration block to determine the scope of the access. See access_scope Block below.
    AssociatedAt string
    Date and time in RFC3339 format that the policy was associated.
    ClusterName string
    Name of the EKS Cluster.
    ModifiedAt string
    Date and time in RFC3339 format that the policy was updated.
    PolicyArn string
    The ARN of the access policy that you're associating.
    PrincipalArn string
    The IAM Principal ARN which requires Authentication access to the EKS cluster.
    accessScope AccessPolicyAssociationAccessScope
    The configuration block to determine the scope of the access. See access_scope Block below.
    associatedAt String
    Date and time in RFC3339 format that the policy was associated.
    clusterName String
    Name of the EKS Cluster.
    modifiedAt String
    Date and time in RFC3339 format that the policy was updated.
    policyArn String
    The ARN of the access policy that you're associating.
    principalArn String
    The IAM Principal ARN which requires Authentication access to the EKS cluster.
    accessScope AccessPolicyAssociationAccessScope
    The configuration block to determine the scope of the access. See access_scope Block below.
    associatedAt string
    Date and time in RFC3339 format that the policy was associated.
    clusterName string
    Name of the EKS Cluster.
    modifiedAt string
    Date and time in RFC3339 format that the policy was updated.
    policyArn string
    The ARN of the access policy that you're associating.
    principalArn string
    The IAM Principal ARN which requires Authentication access to the EKS cluster.
    access_scope AccessPolicyAssociationAccessScopeArgs
    The configuration block to determine the scope of the access. See access_scope Block below.
    associated_at str
    Date and time in RFC3339 format that the policy was associated.
    cluster_name str
    Name of the EKS Cluster.
    modified_at str
    Date and time in RFC3339 format that the policy was updated.
    policy_arn str
    The ARN of the access policy that you're associating.
    principal_arn str
    The IAM Principal ARN which requires Authentication access to the EKS cluster.
    accessScope Property Map
    The configuration block to determine the scope of the access. See access_scope Block below.
    associatedAt String
    Date and time in RFC3339 format that the policy was associated.
    clusterName String
    Name of the EKS Cluster.
    modifiedAt String
    Date and time in RFC3339 format that the policy was updated.
    policyArn String
    The ARN of the access policy that you're associating.
    principalArn String
    The IAM Principal ARN which requires Authentication access to the EKS cluster.

    Supporting Types

    AccessPolicyAssociationAccessScope, AccessPolicyAssociationAccessScopeArgs

    Type string
    Valid values are namespace or cluster.
    Namespaces List<string>
    The namespaces to which the access scope applies when type is namespace.
    Type string
    Valid values are namespace or cluster.
    Namespaces []string
    The namespaces to which the access scope applies when type is namespace.
    type String
    Valid values are namespace or cluster.
    namespaces List<String>
    The namespaces to which the access scope applies when type is namespace.
    type string
    Valid values are namespace or cluster.
    namespaces string[]
    The namespaces to which the access scope applies when type is namespace.
    type str
    Valid values are namespace or cluster.
    namespaces Sequence[str]
    The namespaces to which the access scope applies when type is namespace.
    type String
    Valid values are namespace or cluster.
    namespaces List<String>
    The namespaces to which the access scope applies when type is namespace.

    Import

    Using pulumi import, import EKS access entry using the cluster_name principal_arn and policy_arn separated by a colon (#). For example:

    $ pulumi import aws:eks/accessPolicyAssociation:AccessPolicyAssociation my_eks_access_entry my_cluster_name#my_principal_arn#my_policy_arn
    

    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

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.32.0 published on Friday, Apr 19, 2024 by Pulumi