Skip to content

Resource: awsEksFargateProfile

Manages an EKS Fargate Profile.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.eksFargateProfile.EksFargateProfile(this, "example", {
  clusterName: "${aws_eks_cluster.example.name}",
  fargateProfileName: "example",
  podExecutionRoleArn: "${aws_iam_role.example.arn}",
  selector: [
    {
      namespace: "example",
    },
  ],
  subnetIds: "${aws_subnet.example[*].id}",
});

Example IAM Role for EKS Fargate Profile

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsIamRoleExample = new aws.iamRole.IamRole(this, "example", {
  assumeRolePolicy:
    '${jsonencode({\n    Statement = [{\n      Action = "sts:AssumeRole"\n      Effect = "Allow"\n      Principal = {\n        Service = "eks-fargate-pods.amazonaws.com"\n      }\n    }]\n    Version = "2012-10-17"\n  })}',
  name: "eks-fargate-profile-example",
});
new aws.iamRolePolicyAttachment.IamRolePolicyAttachment(
  this,
  "example-AmazonEKSFargatePodExecutionRolePolicy",
  {
    policyArn: "arn:aws:iam::aws:policy/AmazonEKSFargatePodExecutionRolePolicy",
    role: awsIamRoleExample.name,
  }
);

Argument Reference

The following arguments are required:

  • clusterName – (Required) Name of the EKS Cluster. Must be between 1-100 characters in length. Must begin with an alphanumeric character, and must only contain alphanumeric characters, dashes and underscores (^[09AZaZ][aZaZ09\_]+$).
  • fargateProfileName – (Required) Name of the EKS Fargate Profile.
  • podExecutionRoleArn – (Required) Amazon Resource Name (ARN) of the IAM Role that provides permissions for the EKS Fargate Profile.
  • selector - (Required) Configuration block(s) for selecting Kubernetes Pods to execute with this EKS Fargate Profile. Detailed below.
  • subnetIds – (Required) Identifiers of private EC2 Subnets to associate with the EKS Fargate Profile. These subnets must have the following resource tag: kubernetesIo/cluster/clusterName (where CLUSTER_NAME is replaced with the name of the EKS Cluster).

The following arguments are optional:

  • tags - (Optional) Key-value map of resource tags. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

selector Configuration Block

The following arguments are required:

  • namespace - (Required) Kubernetes namespace for selection.

The following arguments are optional:

  • labels - (Optional) Key-value map of Kubernetes labels for selection.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • arn - Amazon Resource Name (ARN) of the EKS Fargate Profile.
  • id - EKS Cluster name and EKS Fargate Profile name separated by a colon (:).
  • status - Status of the EKS Fargate Profile.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Timeouts

Configuration options:

  • create - (Default 10M)
  • delete - (Default 10M)

Import

EKS Fargate Profiles can be imported using the clusterName and fargateProfileName separated by a colon (:), e.g.,

$ terraform import aws_eks_fargate_profile.my_fargate_profile my_cluster:my_fargate_profile