aws.eks.AccessPolicyAssociation
Explore with Pulumi AI
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={
"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
This property is required. string - The unique name of the resource.
- args
This property is required. AccessPolicyAssociationArgs - 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. 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
This property is required. string - The unique name of the resource.
- args
This property is required. AccessPolicyAssociationArgs - 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. AccessPolicyAssociationArgs - 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. AccessPolicyAssociationArgs - 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 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={
"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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The AccessPolicyAssociation resource accepts the following input properties:
- Access
Scope This property is required. Changes to this property will trigger replacement.
Policy Association Access Scope - The configuration block to determine the scope of the access. See
access_scope
Block below. - Cluster
Name This property is required. Changes to this property will trigger replacement.
- Name of the EKS Cluster.
- Policy
Arn This property is required. Changes to this property will trigger replacement.
- The ARN of the access policy that you're associating.
- Principal
Arn This property is required. Changes to this property will trigger replacement.
- The IAM Principal ARN which requires Authentication access to the EKS cluster.
- Access
Scope This property is required. Changes to this property will trigger replacement.
Policy Association Access Scope Args - The configuration block to determine the scope of the access. See
access_scope
Block below. - Cluster
Name This property is required. Changes to this property will trigger replacement.
- Name of the EKS Cluster.
- Policy
Arn This property is required. Changes to this property will trigger replacement.
- The ARN of the access policy that you're associating.
- Principal
Arn This property is required. Changes to this property will trigger replacement.
- The IAM Principal ARN which requires Authentication access to the EKS cluster.
- access
Scope This property is required. Changes to this property will trigger replacement.
Policy Association Access Scope - The configuration block to determine the scope of the access. See
access_scope
Block below. - cluster
Name This property is required. Changes to this property will trigger replacement.
- Name of the EKS Cluster.
- policy
Arn This property is required. Changes to this property will trigger replacement.
- The ARN of the access policy that you're associating.
- principal
Arn This property is required. Changes to this property will trigger replacement.
- The IAM Principal ARN which requires Authentication access to the EKS cluster.
- access
Scope This property is required. Changes to this property will trigger replacement.
Policy Association Access Scope - The configuration block to determine the scope of the access. See
access_scope
Block below. - cluster
Name This property is required. Changes to this property will trigger replacement.
- Name of the EKS Cluster.
- policy
Arn This property is required. Changes to this property will trigger replacement.
- The ARN of the access policy that you're associating.
- principal
Arn This property is required. Changes to this property will trigger replacement.
- The IAM Principal ARN which requires Authentication access to the EKS cluster.
- access_
scope This property is required. Changes to this property will trigger replacement.
Policy Association Access Scope Args - The configuration block to determine the scope of the access. See
access_scope
Block below. - cluster_
name This property is required. Changes to this property will trigger replacement.
- Name of the EKS Cluster.
- policy_
arn This property is required. Changes to this property will trigger replacement.
- The ARN of the access policy that you're associating.
- principal_
arn This property is required. Changes to this property will trigger replacement.
- The IAM Principal ARN which requires Authentication access to the EKS cluster.
- access
Scope This property is required. Changes to this property will trigger replacement.
- The configuration block to determine the scope of the access. See
access_scope
Block below. - cluster
Name This property is required. Changes to this property will trigger replacement.
- Name of the EKS Cluster.
- policy
Arn This property is required. Changes to this property will trigger replacement.
- The ARN of the access policy that you're associating.
- principal
Arn This property is required. Changes to this property will trigger replacement.
- 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:
- Associated
At string - Date and time in RFC3339 format that the policy was associated.
- Id string
- The provider-assigned unique ID for this managed resource.
- Modified
At string - Date and time in RFC3339 format that the policy was updated.
- Associated
At string - Date and time in RFC3339 format that the policy was associated.
- Id string
- The provider-assigned unique ID for this managed resource.
- Modified
At string - Date and time in RFC3339 format that the policy was updated.
- associated
At String - Date and time in RFC3339 format that the policy was associated.
- id String
- The provider-assigned unique ID for this managed resource.
- modified
At String - Date and time in RFC3339 format that the policy was updated.
- associated
At string - Date and time in RFC3339 format that the policy was associated.
- id string
- The provider-assigned unique ID for this managed resource.
- modified
At 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.
- associated
At String - Date and time in RFC3339 format that the policy was associated.
- id String
- The provider-assigned unique ID for this managed resource.
- modified
At 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)
resources: _: type: aws:eks:AccessPolicyAssociation 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.
- Access
Scope Changes to this property will trigger replacement.
Policy Association Access Scope - The configuration block to determine the scope of the access. See
access_scope
Block below. - Associated
At string - Date and time in RFC3339 format that the policy was associated.
- Cluster
Name Changes to this property will trigger replacement.
- Name of the EKS Cluster.
- Modified
At string - Date and time in RFC3339 format that the policy was updated.
- Policy
Arn Changes to this property will trigger replacement.
- The ARN of the access policy that you're associating.
- Principal
Arn Changes to this property will trigger replacement.
- The IAM Principal ARN which requires Authentication access to the EKS cluster.
- Access
Scope Changes to this property will trigger replacement.
Policy Association Access Scope Args - The configuration block to determine the scope of the access. See
access_scope
Block below. - Associated
At string - Date and time in RFC3339 format that the policy was associated.
- Cluster
Name Changes to this property will trigger replacement.
- Name of the EKS Cluster.
- Modified
At string - Date and time in RFC3339 format that the policy was updated.
- Policy
Arn Changes to this property will trigger replacement.
- The ARN of the access policy that you're associating.
- Principal
Arn Changes to this property will trigger replacement.
- The IAM Principal ARN which requires Authentication access to the EKS cluster.
- access
Scope Changes to this property will trigger replacement.
Policy Association Access Scope - The configuration block to determine the scope of the access. See
access_scope
Block below. - associated
At String - Date and time in RFC3339 format that the policy was associated.
- cluster
Name Changes to this property will trigger replacement.
- Name of the EKS Cluster.
- modified
At String - Date and time in RFC3339 format that the policy was updated.
- policy
Arn Changes to this property will trigger replacement.
- The ARN of the access policy that you're associating.
- principal
Arn Changes to this property will trigger replacement.
- The IAM Principal ARN which requires Authentication access to the EKS cluster.
- access
Scope Changes to this property will trigger replacement.
Policy Association Access Scope - The configuration block to determine the scope of the access. See
access_scope
Block below. - associated
At string - Date and time in RFC3339 format that the policy was associated.
- cluster
Name Changes to this property will trigger replacement.
- Name of the EKS Cluster.
- modified
At string - Date and time in RFC3339 format that the policy was updated.
- policy
Arn Changes to this property will trigger replacement.
- The ARN of the access policy that you're associating.
- principal
Arn Changes to this property will trigger replacement.
- The IAM Principal ARN which requires Authentication access to the EKS cluster.
- access_
scope Changes to this property will trigger replacement.
Policy Association Access Scope Args - 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 Changes to this property will trigger replacement.
- Name of the EKS Cluster.
- modified_
at str - Date and time in RFC3339 format that the policy was updated.
- policy_
arn Changes to this property will trigger replacement.
- The ARN of the access policy that you're associating.
- principal_
arn Changes to this property will trigger replacement.
- The IAM Principal ARN which requires Authentication access to the EKS cluster.
- access
Scope Changes to this property will trigger replacement.
- The configuration block to determine the scope of the access. See
access_scope
Block below. - associated
At String - Date and time in RFC3339 format that the policy was associated.
- cluster
Name Changes to this property will trigger replacement.
- Name of the EKS Cluster.
- modified
At String - Date and time in RFC3339 format that the policy was updated.
- policy
Arn Changes to this property will trigger replacement.
- The ARN of the access policy that you're associating.
- principal
Arn Changes to this property will trigger replacement.
- The IAM Principal ARN which requires Authentication access to the EKS cluster.
Supporting Types
AccessPolicyAssociationAccessScope, AccessPolicyAssociationAccessScopeArgs
- Type
This property is required. Changes to this property will trigger replacement.
- Valid values are
namespace
orcluster
. - Namespaces
Changes to this property will trigger replacement.
- The namespaces to which the access scope applies when type is namespace.
- Type
This property is required. Changes to this property will trigger replacement.
- Valid values are
namespace
orcluster
. - Namespaces
Changes to this property will trigger replacement.
- The namespaces to which the access scope applies when type is namespace.
- type
This property is required. Changes to this property will trigger replacement.
- Valid values are
namespace
orcluster
. - namespaces
Changes to this property will trigger replacement.
- The namespaces to which the access scope applies when type is namespace.
- type
This property is required. Changes to this property will trigger replacement.
- Valid values are
namespace
orcluster
. - namespaces
Changes to this property will trigger replacement.
- The namespaces to which the access scope applies when type is namespace.
- type
This property is required. Changes to this property will trigger replacement.
- Valid values are
namespace
orcluster
. - namespaces
Changes to this property will trigger replacement.
- The namespaces to which the access scope applies when type is namespace.
- type
This property is required. Changes to this property will trigger replacement.
- Valid values are
namespace
orcluster
. - namespaces
Changes to this property will trigger replacement.
- 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 an octothorp (#
). 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.