FargateProfile class

Manages an EKS Fargate Profile.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.eks.FargateProfile("example", {
    selectors: [{
        namespace: "example",
    }],
    clusterName: exampleAwsEksCluster.name,
    fargateProfileName: "example",
    podExecutionRoleArn: exampleAwsIamRole.arn,
    subnetIds: exampleAwsSubnet.map(__item => __item.id),
});
import pulumi
import pulumi_aws as aws

example = aws.eks.FargateProfile("example",
    selectors=[{
        "namespace": "example",
    }],
    cluster_name=example_aws_eks_cluster["name"],
    fargate_profile_name="example",
    pod_execution_role_arn=example_aws_iam_role["arn"],
    subnet_ids=[__item["id"] for __item in example_aws_subnet])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.Eks.FargateProfile("example", new()
    {
        Selectors = new[]
        {
            new Aws.Eks.Inputs.FargateProfileSelectorArgs
            {
                Namespace = "example",
            },
        },
        ClusterName = exampleAwsEksCluster.Name,
        FargateProfileName = "example",
        PodExecutionRoleArn = exampleAwsIamRole.Arn,
        SubnetIds = exampleAwsSubnet.Select(__item => __item.Id).ToList(),
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/eks"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
var splat0 []interface{}
for _, val0 := range exampleAwsSubnet {
splat0 = append(splat0, val0.(map[string]interface{})["id"])
}
_, err := eks.NewFargateProfile(ctx, "example", &eks.FargateProfileArgs{
Selectors: eks.FargateProfileSelectorArray{
&eks.FargateProfileSelectorArgs{
Namespace: pulumi.String("example"),
},
},
ClusterName: pulumi.Any(exampleAwsEksCluster.Name),
FargateProfileName: pulumi.String("example"),
PodExecutionRoleArn: pulumi.Any(exampleAwsIamRole.Arn),
SubnetIds: toPulumiArray(splat0),
})
if err != nil {
return err
}
return nil
})
}
func toPulumiArray(arr []) pulumi.Array {
var pulumiArr pulumi.Array
for _, v := range arr {
pulumiArr = append(pulumiArr, pulumi.(v))
}
return pulumiArr
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_eks_fargateprofile" "example" {
  selectors {
    namespace = "example"
  }
  cluster_name           = exampleAwsEksCluster.name
  fargate_profile_name   = "example"
  pod_execution_role_arn = exampleAwsIamRole.arn
  subnet_ids             = exampleAwsSubnet[*].id
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.eks.FargateProfile;
import com.pulumi.aws.eks.FargateProfileArgs;
import com.pulumi.aws.eks.inputs.FargateProfileSelectorArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 FargateProfile("example", FargateProfileArgs.builder()
            .selectors(FargateProfileSelectorArgs.builder()
                .namespace("example")
                .build())
            .clusterName(exampleAwsEksCluster.name())
            .fargateProfileName("example")
            .podExecutionRoleArn(exampleAwsIamRole.arn())
            .subnetIds(exampleAwsSubnet.stream().map(element -> element.id()).collect(toList()))
            .build());

    }
}

Example IAM Role for EKS Fargate Profile

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.iam.Role("example", {
    name: "eks-fargate-profile-example",
    assumeRolePolicy: JSON.stringify({
        Statement: [{
            Action: "sts:AssumeRole",
            Effect: "Allow",
            Principal: {
                Service: "eks-fargate-pods.amazonaws.com",
            },
        }],
        Version: "2012-10-17",
    }),
});
const example_AmazonEKSFargatePodExecutionRolePolicy = new aws.iam.RolePolicyAttachment("example-AmazonEKSFargatePodExecutionRolePolicy", {
    policyArn: "arn:aws:iam::aws:policy/AmazonEKSFargatePodExecutionRolePolicy",
    role: example.name,
});
import pulumi
import json
import pulumi_aws as aws

example = aws.iam.Role("example",
    name="eks-fargate-profile-example",
    assume_role_policy=json.dumps({
        "Statement": [{
            "Action": "sts:AssumeRole",
            "Effect": "Allow",
            "Principal": {
                "Service": "eks-fargate-pods.amazonaws.com",
            },
        }],
        "Version": "2012-10-17",
    }))
example__amazon_eks_fargate_pod_execution_role_policy = aws.iam.RolePolicyAttachment("example-AmazonEKSFargatePodExecutionRolePolicy",
    policy_arn="arn:aws:iam::aws:policy/AmazonEKSFargatePodExecutionRolePolicy",
    role=example.name)
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.Iam.Role("example", new()
    {
        Name = "eks-fargate-profile-example",
        AssumeRolePolicy = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["Statement"] = new[]
            {
                new Dictionary<string, object?>
                {
                    ["Action"] = "sts:AssumeRole",
                    ["Effect"] = "Allow",
                    ["Principal"] = new Dictionary<string, object?>
                    {
                        ["Service"] = "eks-fargate-pods.amazonaws.com",
                    },
                },
            },
            ["Version"] = "2012-10-17",
        }),
    });

    var example_AmazonEKSFargatePodExecutionRolePolicy = new Aws.Iam.RolePolicyAttachment("example-AmazonEKSFargatePodExecutionRolePolicy", new()
    {
        PolicyArn = "arn:aws:iam::aws:policy/AmazonEKSFargatePodExecutionRolePolicy",
        Role = example.Name,
    });

});
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/iam"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"Statement": []map[string]interface{}{
				map[string]interface{}{
					"Action": "sts:AssumeRole",
					"Effect": "Allow",
					"Principal": map[string]string{
						"Service": "eks-fargate-pods.amazonaws.com",
					},
				},
			},
			"Version": "2012-10-17",
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		example, err := iam.NewRole(ctx, "example", &iam.RoleArgs{
			Name:             pulumi.String("eks-fargate-profile-example"),
			AssumeRolePolicy: pulumi.String(json0),
		})
		if err != nil {
			return err
		}
		_, err = iam.NewRolePolicyAttachment(ctx, "example-AmazonEKSFargatePodExecutionRolePolicy", &iam.RolePolicyAttachmentArgs{
			PolicyArn: pulumi.String("arn:aws:iam::aws:policy/AmazonEKSFargatePodExecutionRolePolicy"),
			Role:      example.Name,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_iam_role" "example" {
  name = "eks-fargate-profile-example"
  assume_role_policy = jsonencode({
    "Statement" = [{
      "Action" = "sts:AssumeRole"
      "Effect" = "Allow"
      "Principal" = {
        "Service" = "eks-fargate-pods.amazonaws.com"
      }
    }]
    "Version" = "2012-10-17"
  })
}
resource "aws_iam_rolepolicyattachment" "example-AmazonEKSFargatePodExecutionRolePolicy" {
  policy_arn = "arn:aws:iam::aws:policy/AmazonEKSFargatePodExecutionRolePolicy"
  role       = aws_iam_role.example.name
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.iam.RolePolicyAttachment;
import com.pulumi.aws.iam.RolePolicyAttachmentArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.ArrayList;
import java.util.Arrays;
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 Role("example", RoleArgs.builder()
            .name("eks-fargate-profile-example")
            .assumeRolePolicy(serializeJson(
                jsonObject(
                    jsonProperty("Statement", jsonArray(jsonObject(
                        jsonProperty("Action", "sts:AssumeRole"),
                        jsonProperty("Effect", "Allow"),
                        jsonProperty("Principal", jsonObject(
                            jsonProperty("Service", "eks-fargate-pods.amazonaws.com")
                        ))
                    ))),
                    jsonProperty("Version", "2012-10-17")
                )))
            .build());

        var example_AmazonEKSFargatePodExecutionRolePolicy = new RolePolicyAttachment("example-AmazonEKSFargatePodExecutionRolePolicy", RolePolicyAttachmentArgs.builder()
            .policyArn("arn:aws:iam::aws:policy/AmazonEKSFargatePodExecutionRolePolicy")
            .role(example.name())
            .build());

    }
}
resources:
  example:
    type: aws:iam:Role
    properties:
      name: eks-fargate-profile-example
      assumeRolePolicy:
        fn::toJSON:
          Statement:
            - Action: sts:AssumeRole
              Effect: Allow
              Principal:
                Service: eks-fargate-pods.amazonaws.com
          Version: 2012-10-17
  example-AmazonEKSFargatePodExecutionRolePolicy:
    type: aws:iam:RolePolicyAttachment
    properties:
      policyArn: arn:aws:iam::aws:policy/AmazonEKSFargatePodExecutionRolePolicy
      role: ${example.name}

Import

Identity Schema

Required

  • clusterName (String) Name of the EKS Cluster.
  • fargateProfileName (String) Name of the Fargate profile.

Optional

  • accountId (String) AWS Account where this resource is managed.
  • region (String) Region where this resource is managed.

Using pulumi import, import Fargate Profiles using clusterName and fargateProfileName separated by a colon (:). For example:

$ pulumi import aws:eks/fargateProfile:FargateProfile example example-cluster:example-profile

Constructors

FargateProfile(String name, {FargateProfileArgs? args, CustomResourceOptions? options})
Creates a new FargateProfile. name The Pulumi resource name. args Arguments used to configure this FargateProfile. The set of arguments for FargateProfile. options Resource options controlling this resource's behavior.
FargateProfile.reference(String urn)
Creates a typed reference to an existing FargateProfile resource.

Properties

arn ↔ Output<String>
ARN of the EKS Fargate Profile.
latefinal
childResources → Set<Resource>
finalinherited
clusterName ↔ Output<String>
Name of the EKS Cluster.
latefinal
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
fargateProfileName ↔ Output<String>
Name of the EKS Fargate Profile.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
podExecutionRoleArn ↔ Output<String>
ARN of the IAM Role that provides permissions for the EKS Fargate Profile.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectors ↔ Output<List<FargateProfileSelector>>
Configuration block(s) for selecting Kubernetes Pods to execute with this EKS Fargate Profile. Detailed below.
latefinal
status ↔ Output<String>
Status of the EKS Fargate Profile.
latefinal
subnetIds ↔ Output<List<String>?>
Identifiers of private EC2 Subnets to associate with the EKS Fargate Profile. These subnets must have the following resource tag: kubernetes.io/cluster/CLUSTER_NAME (where CLUSTER_NAME is replaced with the name of the EKS Cluster).
latefinal
tags ↔ Output<Map<String, String>?>
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.
latefinal
tagsAll ↔ Output<Map<String, String>>
A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {FargateProfileState? state, CustomResourceOptions? options}) → FargateProfile
Gets an existing FargateProfile resource's state with the given name and id.