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 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.
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 AccessPolicy Association Access Scope - The configuration block to determine the scope of the access. See
access_scope
Block below. - Cluster
Name string - Name of the EKS Cluster.
- Policy
Arn string - The ARN of the access policy that you're associating.
- Principal
Arn string - The IAM Principal ARN which requires Authentication access to the EKS cluster.
- Access
Scope AccessPolicy Association Access Scope Args - The configuration block to determine the scope of the access. See
access_scope
Block below. - Cluster
Name string - Name of the EKS Cluster.
- Policy
Arn string - The ARN of the access policy that you're associating.
- Principal
Arn string - The IAM Principal ARN which requires Authentication access to the EKS cluster.
- access
Scope AccessPolicy Association Access Scope - The configuration block to determine the scope of the access. See
access_scope
Block below. - cluster
Name String - Name of the EKS Cluster.
- policy
Arn String - The ARN of the access policy that you're associating.
- principal
Arn String - The IAM Principal ARN which requires Authentication access to the EKS cluster.
- access
Scope AccessPolicy Association Access Scope - The configuration block to determine the scope of the access. See
access_scope
Block below. - cluster
Name string - Name of the EKS Cluster.
- policy
Arn string - The ARN of the access policy that you're associating.
- principal
Arn string - The IAM Principal ARN which requires Authentication access to the EKS cluster.
- access_
scope AccessPolicy Association Access Scope Args - 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.
- access
Scope Property Map - The configuration block to determine the scope of the access. See
access_scope
Block below. - cluster
Name String - Name of the EKS Cluster.
- policy
Arn String - The ARN of the access policy that you're associating.
- principal
Arn 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:
- 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)
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.
- Access
Scope AccessPolicy 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 string - Name of the EKS Cluster.
- Modified
At string - Date and time in RFC3339 format that the policy was updated.
- Policy
Arn string - The ARN of the access policy that you're associating.
- Principal
Arn string - The IAM Principal ARN which requires Authentication access to the EKS cluster.
- Access
Scope AccessPolicy 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 string - Name of the EKS Cluster.
- Modified
At string - Date and time in RFC3339 format that the policy was updated.
- Policy
Arn string - The ARN of the access policy that you're associating.
- Principal
Arn string - The IAM Principal ARN which requires Authentication access to the EKS cluster.
- access
Scope AccessPolicy 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 String - Name of the EKS Cluster.
- modified
At String - Date and time in RFC3339 format that the policy was updated.
- policy
Arn String - The ARN of the access policy that you're associating.
- principal
Arn String - The IAM Principal ARN which requires Authentication access to the EKS cluster.
- access
Scope AccessPolicy 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 string - Name of the EKS Cluster.
- modified
At string - Date and time in RFC3339 format that the policy was updated.
- policy
Arn string - The ARN of the access policy that you're associating.
- principal
Arn string - The IAM Principal ARN which requires Authentication access to the EKS cluster.
- access_
scope AccessPolicy 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 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.
- access
Scope Property Map - 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 String - Name of the EKS Cluster.
- modified
At String - Date and time in RFC3339 format that the policy was updated.
- policy
Arn String - The ARN of the access policy that you're associating.
- principal
Arn String - The IAM Principal ARN which requires Authentication access to the EKS cluster.
Supporting Types
AccessPolicyAssociationAccessScope, AccessPolicyAssociationAccessScopeArgs
- Type string
- Valid values are
namespace
orcluster
. - Namespaces List<string>
- The namespaces to which the access scope applies when type is namespace.
- Type string
- Valid values are
namespace
orcluster
. - Namespaces []string
- The namespaces to which the access scope applies when type is namespace.
- type String
- Valid values are
namespace
orcluster
. - namespaces List<String>
- The namespaces to which the access scope applies when type is namespace.
- type string
- Valid values are
namespace
orcluster
. - namespaces string[]
- The namespaces to which the access scope applies when type is namespace.
- type str
- Valid values are
namespace
orcluster
. - namespaces Sequence[str]
- The namespaces to which the access scope applies when type is namespace.
- type String
- Valid values are
namespace
orcluster
. - 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.