github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/eks/fargateProfile.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package eks
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Manages an EKS Fargate Profile.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/eks"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  // func main() {
    30  // pulumi.Run(func(ctx *pulumi.Context) error {
    31  // var splat0 []interface{}
    32  // for _, val0 := range exampleAwsSubnet {
    33  // splat0 = append(splat0, val0.Id)
    34  // }
    35  // _, err := eks.NewFargateProfile(ctx, "example", &eks.FargateProfileArgs{
    36  // ClusterName: pulumi.Any(exampleAwsEksCluster.Name),
    37  // FargateProfileName: pulumi.String("example"),
    38  // PodExecutionRoleArn: pulumi.Any(exampleAwsIamRole.Arn),
    39  // SubnetIds: toPulumiArray(splat0),
    40  // Selectors: eks.FargateProfileSelectorArray{
    41  // &eks.FargateProfileSelectorArgs{
    42  // Namespace: pulumi.String("example"),
    43  // },
    44  // },
    45  // })
    46  // if err != nil {
    47  // return err
    48  // }
    49  // return nil
    50  // })
    51  // }
    52  // func toPulumiArray(arr []) pulumi.Array {
    53  // var pulumiArr pulumi.Array
    54  // for _, v := range arr {
    55  // pulumiArr = append(pulumiArr, pulumi.(v))
    56  // }
    57  // return pulumiArr
    58  // }
    59  // ```
    60  // <!--End PulumiCodeChooser -->
    61  //
    62  // ### Example IAM Role for EKS Fargate Profile
    63  //
    64  // <!--Start PulumiCodeChooser -->
    65  // ```go
    66  // package main
    67  //
    68  // import (
    69  //
    70  //	"encoding/json"
    71  //
    72  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    73  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    74  //
    75  // )
    76  //
    77  //	func main() {
    78  //		pulumi.Run(func(ctx *pulumi.Context) error {
    79  //			tmpJSON0, err := json.Marshal(map[string]interface{}{
    80  //				"Statement": []map[string]interface{}{
    81  //					map[string]interface{}{
    82  //						"Action": "sts:AssumeRole",
    83  //						"Effect": "Allow",
    84  //						"Principal": map[string]interface{}{
    85  //							"Service": "eks-fargate-pods.amazonaws.com",
    86  //						},
    87  //					},
    88  //				},
    89  //				"Version": "2012-10-17",
    90  //			})
    91  //			if err != nil {
    92  //				return err
    93  //			}
    94  //			json0 := string(tmpJSON0)
    95  //			example, err := iam.NewRole(ctx, "example", &iam.RoleArgs{
    96  //				Name:             pulumi.String("eks-fargate-profile-example"),
    97  //				AssumeRolePolicy: pulumi.String(json0),
    98  //			})
    99  //			if err != nil {
   100  //				return err
   101  //			}
   102  //			_, err = iam.NewRolePolicyAttachment(ctx, "example-AmazonEKSFargatePodExecutionRolePolicy", &iam.RolePolicyAttachmentArgs{
   103  //				PolicyArn: pulumi.String("arn:aws:iam::aws:policy/AmazonEKSFargatePodExecutionRolePolicy"),
   104  //				Role:      example.Name,
   105  //			})
   106  //			if err != nil {
   107  //				return err
   108  //			}
   109  //			return nil
   110  //		})
   111  //	}
   112  //
   113  // ```
   114  // <!--End PulumiCodeChooser -->
   115  //
   116  // ## Import
   117  //
   118  // Using `pulumi import`, import EKS Fargate Profiles using the `cluster_name` and `fargate_profile_name` separated by a colon (`:`). For example:
   119  //
   120  // ```sh
   121  // $ pulumi import aws:eks/fargateProfile:FargateProfile my_fargate_profile my_cluster:my_fargate_profile
   122  // ```
   123  type FargateProfile struct {
   124  	pulumi.CustomResourceState
   125  
   126  	// Amazon Resource Name (ARN) of the EKS Fargate Profile.
   127  	Arn pulumi.StringOutput `pulumi:"arn"`
   128  	// Name of the EKS Cluster.
   129  	ClusterName pulumi.StringOutput `pulumi:"clusterName"`
   130  	// Name of the EKS Fargate Profile.
   131  	FargateProfileName pulumi.StringOutput `pulumi:"fargateProfileName"`
   132  	// Amazon Resource Name (ARN) of the IAM Role that provides permissions for the EKS Fargate Profile.
   133  	PodExecutionRoleArn pulumi.StringOutput `pulumi:"podExecutionRoleArn"`
   134  	// Configuration block(s) for selecting Kubernetes Pods to execute with this EKS Fargate Profile. Detailed below.
   135  	Selectors FargateProfileSelectorArrayOutput `pulumi:"selectors"`
   136  	// Status of the EKS Fargate Profile.
   137  	Status pulumi.StringOutput `pulumi:"status"`
   138  	// 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).
   139  	//
   140  	// The following arguments are optional:
   141  	SubnetIds pulumi.StringArrayOutput `pulumi:"subnetIds"`
   142  	// 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.
   143  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   144  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   145  	//
   146  	// Deprecated: Please use `tags` instead.
   147  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   148  }
   149  
   150  // NewFargateProfile registers a new resource with the given unique name, arguments, and options.
   151  func NewFargateProfile(ctx *pulumi.Context,
   152  	name string, args *FargateProfileArgs, opts ...pulumi.ResourceOption) (*FargateProfile, error) {
   153  	if args == nil {
   154  		return nil, errors.New("missing one or more required arguments")
   155  	}
   156  
   157  	if args.ClusterName == nil {
   158  		return nil, errors.New("invalid value for required argument 'ClusterName'")
   159  	}
   160  	if args.PodExecutionRoleArn == nil {
   161  		return nil, errors.New("invalid value for required argument 'PodExecutionRoleArn'")
   162  	}
   163  	if args.Selectors == nil {
   164  		return nil, errors.New("invalid value for required argument 'Selectors'")
   165  	}
   166  	opts = internal.PkgResourceDefaultOpts(opts)
   167  	var resource FargateProfile
   168  	err := ctx.RegisterResource("aws:eks/fargateProfile:FargateProfile", name, args, &resource, opts...)
   169  	if err != nil {
   170  		return nil, err
   171  	}
   172  	return &resource, nil
   173  }
   174  
   175  // GetFargateProfile gets an existing FargateProfile resource's state with the given name, ID, and optional
   176  // state properties that are used to uniquely qualify the lookup (nil if not required).
   177  func GetFargateProfile(ctx *pulumi.Context,
   178  	name string, id pulumi.IDInput, state *FargateProfileState, opts ...pulumi.ResourceOption) (*FargateProfile, error) {
   179  	var resource FargateProfile
   180  	err := ctx.ReadResource("aws:eks/fargateProfile:FargateProfile", name, id, state, &resource, opts...)
   181  	if err != nil {
   182  		return nil, err
   183  	}
   184  	return &resource, nil
   185  }
   186  
   187  // Input properties used for looking up and filtering FargateProfile resources.
   188  type fargateProfileState struct {
   189  	// Amazon Resource Name (ARN) of the EKS Fargate Profile.
   190  	Arn *string `pulumi:"arn"`
   191  	// Name of the EKS Cluster.
   192  	ClusterName *string `pulumi:"clusterName"`
   193  	// Name of the EKS Fargate Profile.
   194  	FargateProfileName *string `pulumi:"fargateProfileName"`
   195  	// Amazon Resource Name (ARN) of the IAM Role that provides permissions for the EKS Fargate Profile.
   196  	PodExecutionRoleArn *string `pulumi:"podExecutionRoleArn"`
   197  	// Configuration block(s) for selecting Kubernetes Pods to execute with this EKS Fargate Profile. Detailed below.
   198  	Selectors []FargateProfileSelector `pulumi:"selectors"`
   199  	// Status of the EKS Fargate Profile.
   200  	Status *string `pulumi:"status"`
   201  	// 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).
   202  	//
   203  	// The following arguments are optional:
   204  	SubnetIds []string `pulumi:"subnetIds"`
   205  	// 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.
   206  	Tags map[string]string `pulumi:"tags"`
   207  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   208  	//
   209  	// Deprecated: Please use `tags` instead.
   210  	TagsAll map[string]string `pulumi:"tagsAll"`
   211  }
   212  
   213  type FargateProfileState struct {
   214  	// Amazon Resource Name (ARN) of the EKS Fargate Profile.
   215  	Arn pulumi.StringPtrInput
   216  	// Name of the EKS Cluster.
   217  	ClusterName pulumi.StringPtrInput
   218  	// Name of the EKS Fargate Profile.
   219  	FargateProfileName pulumi.StringPtrInput
   220  	// Amazon Resource Name (ARN) of the IAM Role that provides permissions for the EKS Fargate Profile.
   221  	PodExecutionRoleArn pulumi.StringPtrInput
   222  	// Configuration block(s) for selecting Kubernetes Pods to execute with this EKS Fargate Profile. Detailed below.
   223  	Selectors FargateProfileSelectorArrayInput
   224  	// Status of the EKS Fargate Profile.
   225  	Status pulumi.StringPtrInput
   226  	// 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).
   227  	//
   228  	// The following arguments are optional:
   229  	SubnetIds pulumi.StringArrayInput
   230  	// 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.
   231  	Tags pulumi.StringMapInput
   232  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   233  	//
   234  	// Deprecated: Please use `tags` instead.
   235  	TagsAll pulumi.StringMapInput
   236  }
   237  
   238  func (FargateProfileState) ElementType() reflect.Type {
   239  	return reflect.TypeOf((*fargateProfileState)(nil)).Elem()
   240  }
   241  
   242  type fargateProfileArgs struct {
   243  	// Name of the EKS Cluster.
   244  	ClusterName string `pulumi:"clusterName"`
   245  	// Name of the EKS Fargate Profile.
   246  	FargateProfileName *string `pulumi:"fargateProfileName"`
   247  	// Amazon Resource Name (ARN) of the IAM Role that provides permissions for the EKS Fargate Profile.
   248  	PodExecutionRoleArn string `pulumi:"podExecutionRoleArn"`
   249  	// Configuration block(s) for selecting Kubernetes Pods to execute with this EKS Fargate Profile. Detailed below.
   250  	Selectors []FargateProfileSelector `pulumi:"selectors"`
   251  	// 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).
   252  	//
   253  	// The following arguments are optional:
   254  	SubnetIds []string `pulumi:"subnetIds"`
   255  	// 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.
   256  	Tags map[string]string `pulumi:"tags"`
   257  }
   258  
   259  // The set of arguments for constructing a FargateProfile resource.
   260  type FargateProfileArgs struct {
   261  	// Name of the EKS Cluster.
   262  	ClusterName pulumi.StringInput
   263  	// Name of the EKS Fargate Profile.
   264  	FargateProfileName pulumi.StringPtrInput
   265  	// Amazon Resource Name (ARN) of the IAM Role that provides permissions for the EKS Fargate Profile.
   266  	PodExecutionRoleArn pulumi.StringInput
   267  	// Configuration block(s) for selecting Kubernetes Pods to execute with this EKS Fargate Profile. Detailed below.
   268  	Selectors FargateProfileSelectorArrayInput
   269  	// 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).
   270  	//
   271  	// The following arguments are optional:
   272  	SubnetIds pulumi.StringArrayInput
   273  	// 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.
   274  	Tags pulumi.StringMapInput
   275  }
   276  
   277  func (FargateProfileArgs) ElementType() reflect.Type {
   278  	return reflect.TypeOf((*fargateProfileArgs)(nil)).Elem()
   279  }
   280  
   281  type FargateProfileInput interface {
   282  	pulumi.Input
   283  
   284  	ToFargateProfileOutput() FargateProfileOutput
   285  	ToFargateProfileOutputWithContext(ctx context.Context) FargateProfileOutput
   286  }
   287  
   288  func (*FargateProfile) ElementType() reflect.Type {
   289  	return reflect.TypeOf((**FargateProfile)(nil)).Elem()
   290  }
   291  
   292  func (i *FargateProfile) ToFargateProfileOutput() FargateProfileOutput {
   293  	return i.ToFargateProfileOutputWithContext(context.Background())
   294  }
   295  
   296  func (i *FargateProfile) ToFargateProfileOutputWithContext(ctx context.Context) FargateProfileOutput {
   297  	return pulumi.ToOutputWithContext(ctx, i).(FargateProfileOutput)
   298  }
   299  
   300  // FargateProfileArrayInput is an input type that accepts FargateProfileArray and FargateProfileArrayOutput values.
   301  // You can construct a concrete instance of `FargateProfileArrayInput` via:
   302  //
   303  //	FargateProfileArray{ FargateProfileArgs{...} }
   304  type FargateProfileArrayInput interface {
   305  	pulumi.Input
   306  
   307  	ToFargateProfileArrayOutput() FargateProfileArrayOutput
   308  	ToFargateProfileArrayOutputWithContext(context.Context) FargateProfileArrayOutput
   309  }
   310  
   311  type FargateProfileArray []FargateProfileInput
   312  
   313  func (FargateProfileArray) ElementType() reflect.Type {
   314  	return reflect.TypeOf((*[]*FargateProfile)(nil)).Elem()
   315  }
   316  
   317  func (i FargateProfileArray) ToFargateProfileArrayOutput() FargateProfileArrayOutput {
   318  	return i.ToFargateProfileArrayOutputWithContext(context.Background())
   319  }
   320  
   321  func (i FargateProfileArray) ToFargateProfileArrayOutputWithContext(ctx context.Context) FargateProfileArrayOutput {
   322  	return pulumi.ToOutputWithContext(ctx, i).(FargateProfileArrayOutput)
   323  }
   324  
   325  // FargateProfileMapInput is an input type that accepts FargateProfileMap and FargateProfileMapOutput values.
   326  // You can construct a concrete instance of `FargateProfileMapInput` via:
   327  //
   328  //	FargateProfileMap{ "key": FargateProfileArgs{...} }
   329  type FargateProfileMapInput interface {
   330  	pulumi.Input
   331  
   332  	ToFargateProfileMapOutput() FargateProfileMapOutput
   333  	ToFargateProfileMapOutputWithContext(context.Context) FargateProfileMapOutput
   334  }
   335  
   336  type FargateProfileMap map[string]FargateProfileInput
   337  
   338  func (FargateProfileMap) ElementType() reflect.Type {
   339  	return reflect.TypeOf((*map[string]*FargateProfile)(nil)).Elem()
   340  }
   341  
   342  func (i FargateProfileMap) ToFargateProfileMapOutput() FargateProfileMapOutput {
   343  	return i.ToFargateProfileMapOutputWithContext(context.Background())
   344  }
   345  
   346  func (i FargateProfileMap) ToFargateProfileMapOutputWithContext(ctx context.Context) FargateProfileMapOutput {
   347  	return pulumi.ToOutputWithContext(ctx, i).(FargateProfileMapOutput)
   348  }
   349  
   350  type FargateProfileOutput struct{ *pulumi.OutputState }
   351  
   352  func (FargateProfileOutput) ElementType() reflect.Type {
   353  	return reflect.TypeOf((**FargateProfile)(nil)).Elem()
   354  }
   355  
   356  func (o FargateProfileOutput) ToFargateProfileOutput() FargateProfileOutput {
   357  	return o
   358  }
   359  
   360  func (o FargateProfileOutput) ToFargateProfileOutputWithContext(ctx context.Context) FargateProfileOutput {
   361  	return o
   362  }
   363  
   364  // Amazon Resource Name (ARN) of the EKS Fargate Profile.
   365  func (o FargateProfileOutput) Arn() pulumi.StringOutput {
   366  	return o.ApplyT(func(v *FargateProfile) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   367  }
   368  
   369  // Name of the EKS Cluster.
   370  func (o FargateProfileOutput) ClusterName() pulumi.StringOutput {
   371  	return o.ApplyT(func(v *FargateProfile) pulumi.StringOutput { return v.ClusterName }).(pulumi.StringOutput)
   372  }
   373  
   374  // Name of the EKS Fargate Profile.
   375  func (o FargateProfileOutput) FargateProfileName() pulumi.StringOutput {
   376  	return o.ApplyT(func(v *FargateProfile) pulumi.StringOutput { return v.FargateProfileName }).(pulumi.StringOutput)
   377  }
   378  
   379  // Amazon Resource Name (ARN) of the IAM Role that provides permissions for the EKS Fargate Profile.
   380  func (o FargateProfileOutput) PodExecutionRoleArn() pulumi.StringOutput {
   381  	return o.ApplyT(func(v *FargateProfile) pulumi.StringOutput { return v.PodExecutionRoleArn }).(pulumi.StringOutput)
   382  }
   383  
   384  // Configuration block(s) for selecting Kubernetes Pods to execute with this EKS Fargate Profile. Detailed below.
   385  func (o FargateProfileOutput) Selectors() FargateProfileSelectorArrayOutput {
   386  	return o.ApplyT(func(v *FargateProfile) FargateProfileSelectorArrayOutput { return v.Selectors }).(FargateProfileSelectorArrayOutput)
   387  }
   388  
   389  // Status of the EKS Fargate Profile.
   390  func (o FargateProfileOutput) Status() pulumi.StringOutput {
   391  	return o.ApplyT(func(v *FargateProfile) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
   392  }
   393  
   394  // 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).
   395  //
   396  // The following arguments are optional:
   397  func (o FargateProfileOutput) SubnetIds() pulumi.StringArrayOutput {
   398  	return o.ApplyT(func(v *FargateProfile) pulumi.StringArrayOutput { return v.SubnetIds }).(pulumi.StringArrayOutput)
   399  }
   400  
   401  // 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.
   402  func (o FargateProfileOutput) Tags() pulumi.StringMapOutput {
   403  	return o.ApplyT(func(v *FargateProfile) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   404  }
   405  
   406  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   407  //
   408  // Deprecated: Please use `tags` instead.
   409  func (o FargateProfileOutput) TagsAll() pulumi.StringMapOutput {
   410  	return o.ApplyT(func(v *FargateProfile) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   411  }
   412  
   413  type FargateProfileArrayOutput struct{ *pulumi.OutputState }
   414  
   415  func (FargateProfileArrayOutput) ElementType() reflect.Type {
   416  	return reflect.TypeOf((*[]*FargateProfile)(nil)).Elem()
   417  }
   418  
   419  func (o FargateProfileArrayOutput) ToFargateProfileArrayOutput() FargateProfileArrayOutput {
   420  	return o
   421  }
   422  
   423  func (o FargateProfileArrayOutput) ToFargateProfileArrayOutputWithContext(ctx context.Context) FargateProfileArrayOutput {
   424  	return o
   425  }
   426  
   427  func (o FargateProfileArrayOutput) Index(i pulumi.IntInput) FargateProfileOutput {
   428  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *FargateProfile {
   429  		return vs[0].([]*FargateProfile)[vs[1].(int)]
   430  	}).(FargateProfileOutput)
   431  }
   432  
   433  type FargateProfileMapOutput struct{ *pulumi.OutputState }
   434  
   435  func (FargateProfileMapOutput) ElementType() reflect.Type {
   436  	return reflect.TypeOf((*map[string]*FargateProfile)(nil)).Elem()
   437  }
   438  
   439  func (o FargateProfileMapOutput) ToFargateProfileMapOutput() FargateProfileMapOutput {
   440  	return o
   441  }
   442  
   443  func (o FargateProfileMapOutput) ToFargateProfileMapOutputWithContext(ctx context.Context) FargateProfileMapOutput {
   444  	return o
   445  }
   446  
   447  func (o FargateProfileMapOutput) MapIndex(k pulumi.StringInput) FargateProfileOutput {
   448  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *FargateProfile {
   449  		return vs[0].(map[string]*FargateProfile)[vs[1].(string)]
   450  	}).(FargateProfileOutput)
   451  }
   452  
   453  func init() {
   454  	pulumi.RegisterInputType(reflect.TypeOf((*FargateProfileInput)(nil)).Elem(), &FargateProfile{})
   455  	pulumi.RegisterInputType(reflect.TypeOf((*FargateProfileArrayInput)(nil)).Elem(), FargateProfileArray{})
   456  	pulumi.RegisterInputType(reflect.TypeOf((*FargateProfileMapInput)(nil)).Elem(), FargateProfileMap{})
   457  	pulumi.RegisterOutputType(FargateProfileOutput{})
   458  	pulumi.RegisterOutputType(FargateProfileArrayOutput{})
   459  	pulumi.RegisterOutputType(FargateProfileMapOutput{})
   460  }