github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/eks/accessEntry.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  // Access Entry Configurations for an EKS Cluster.
    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  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			_, err := eks.NewAccessEntry(ctx, "example", &eks.AccessEntryArgs{
    33  //				ClusterName:  pulumi.Any(exampleAwsEksCluster.Name),
    34  //				PrincipalArn: pulumi.Any(exampleAwsIamRole.Arn),
    35  //				KubernetesGroups: pulumi.StringArray{
    36  //					pulumi.String("group-1"),
    37  //					pulumi.String("group-2"),
    38  //				},
    39  //				Type: pulumi.String("STANDARD"),
    40  //			})
    41  //			if err != nil {
    42  //				return err
    43  //			}
    44  //			return nil
    45  //		})
    46  //	}
    47  //
    48  // ```
    49  // <!--End PulumiCodeChooser -->
    50  //
    51  // ## Import
    52  //
    53  // Using `pulumi import`, import EKS access entry using the `cluster_name` and `principal_arn` separated by a colon (`:`). For example:
    54  //
    55  // ```sh
    56  // $ pulumi import aws:eks/accessEntry:AccessEntry my_eks_access_entry my_cluster_name:my_principal_arn
    57  // ```
    58  type AccessEntry struct {
    59  	pulumi.CustomResourceState
    60  
    61  	// Amazon Resource Name (ARN) of the Access Entry.
    62  	AccessEntryArn pulumi.StringOutput `pulumi:"accessEntryArn"`
    63  	// Name of the EKS Cluster.
    64  	ClusterName pulumi.StringOutput `pulumi:"clusterName"`
    65  	// Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the EKS add-on was created.
    66  	CreatedAt pulumi.StringOutput `pulumi:"createdAt"`
    67  	// List of string which can optionally specify the Kubernetes groups the user would belong to when creating an access entry.
    68  	KubernetesGroups pulumi.StringArrayOutput `pulumi:"kubernetesGroups"`
    69  	// Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the EKS add-on was updated.
    70  	ModifiedAt pulumi.StringOutput `pulumi:"modifiedAt"`
    71  	// The IAM Principal ARN which requires Authentication access to the EKS cluster.
    72  	//
    73  	// The following arguments are optional:
    74  	PrincipalArn pulumi.StringOutput `pulumi:"principalArn"`
    75  	// 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.
    76  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    77  	// (Optional) Key-value map of resource tags, including those inherited from the provider `defaultTags` configuration block.
    78  	//
    79  	// Deprecated: Please use `tags` instead.
    80  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    81  	// Defaults to STANDARD which provides the standard workflow. EC2_LINUX, EC2_WINDOWS, FARGATE_LINUX types disallow users to input a username or groups, and prevent associations.
    82  	Type pulumi.StringPtrOutput `pulumi:"type"`
    83  	// Defaults to principal ARN if user is principal else defaults to assume-role/session-name is role is used.
    84  	UserName pulumi.StringOutput `pulumi:"userName"`
    85  }
    86  
    87  // NewAccessEntry registers a new resource with the given unique name, arguments, and options.
    88  func NewAccessEntry(ctx *pulumi.Context,
    89  	name string, args *AccessEntryArgs, opts ...pulumi.ResourceOption) (*AccessEntry, error) {
    90  	if args == nil {
    91  		return nil, errors.New("missing one or more required arguments")
    92  	}
    93  
    94  	if args.ClusterName == nil {
    95  		return nil, errors.New("invalid value for required argument 'ClusterName'")
    96  	}
    97  	if args.PrincipalArn == nil {
    98  		return nil, errors.New("invalid value for required argument 'PrincipalArn'")
    99  	}
   100  	opts = internal.PkgResourceDefaultOpts(opts)
   101  	var resource AccessEntry
   102  	err := ctx.RegisterResource("aws:eks/accessEntry:AccessEntry", name, args, &resource, opts...)
   103  	if err != nil {
   104  		return nil, err
   105  	}
   106  	return &resource, nil
   107  }
   108  
   109  // GetAccessEntry gets an existing AccessEntry resource's state with the given name, ID, and optional
   110  // state properties that are used to uniquely qualify the lookup (nil if not required).
   111  func GetAccessEntry(ctx *pulumi.Context,
   112  	name string, id pulumi.IDInput, state *AccessEntryState, opts ...pulumi.ResourceOption) (*AccessEntry, error) {
   113  	var resource AccessEntry
   114  	err := ctx.ReadResource("aws:eks/accessEntry:AccessEntry", name, id, state, &resource, opts...)
   115  	if err != nil {
   116  		return nil, err
   117  	}
   118  	return &resource, nil
   119  }
   120  
   121  // Input properties used for looking up and filtering AccessEntry resources.
   122  type accessEntryState struct {
   123  	// Amazon Resource Name (ARN) of the Access Entry.
   124  	AccessEntryArn *string `pulumi:"accessEntryArn"`
   125  	// Name of the EKS Cluster.
   126  	ClusterName *string `pulumi:"clusterName"`
   127  	// Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the EKS add-on was created.
   128  	CreatedAt *string `pulumi:"createdAt"`
   129  	// List of string which can optionally specify the Kubernetes groups the user would belong to when creating an access entry.
   130  	KubernetesGroups []string `pulumi:"kubernetesGroups"`
   131  	// Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the EKS add-on was updated.
   132  	ModifiedAt *string `pulumi:"modifiedAt"`
   133  	// The IAM Principal ARN which requires Authentication access to the EKS cluster.
   134  	//
   135  	// The following arguments are optional:
   136  	PrincipalArn *string `pulumi:"principalArn"`
   137  	// 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.
   138  	Tags map[string]string `pulumi:"tags"`
   139  	// (Optional) Key-value map of resource tags, including those inherited from the provider `defaultTags` configuration block.
   140  	//
   141  	// Deprecated: Please use `tags` instead.
   142  	TagsAll map[string]string `pulumi:"tagsAll"`
   143  	// Defaults to STANDARD which provides the standard workflow. EC2_LINUX, EC2_WINDOWS, FARGATE_LINUX types disallow users to input a username or groups, and prevent associations.
   144  	Type *string `pulumi:"type"`
   145  	// Defaults to principal ARN if user is principal else defaults to assume-role/session-name is role is used.
   146  	UserName *string `pulumi:"userName"`
   147  }
   148  
   149  type AccessEntryState struct {
   150  	// Amazon Resource Name (ARN) of the Access Entry.
   151  	AccessEntryArn pulumi.StringPtrInput
   152  	// Name of the EKS Cluster.
   153  	ClusterName pulumi.StringPtrInput
   154  	// Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the EKS add-on was created.
   155  	CreatedAt pulumi.StringPtrInput
   156  	// List of string which can optionally specify the Kubernetes groups the user would belong to when creating an access entry.
   157  	KubernetesGroups pulumi.StringArrayInput
   158  	// Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the EKS add-on was updated.
   159  	ModifiedAt pulumi.StringPtrInput
   160  	// The IAM Principal ARN which requires Authentication access to the EKS cluster.
   161  	//
   162  	// The following arguments are optional:
   163  	PrincipalArn pulumi.StringPtrInput
   164  	// 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.
   165  	Tags pulumi.StringMapInput
   166  	// (Optional) Key-value map of resource tags, including those inherited from the provider `defaultTags` configuration block.
   167  	//
   168  	// Deprecated: Please use `tags` instead.
   169  	TagsAll pulumi.StringMapInput
   170  	// Defaults to STANDARD which provides the standard workflow. EC2_LINUX, EC2_WINDOWS, FARGATE_LINUX types disallow users to input a username or groups, and prevent associations.
   171  	Type pulumi.StringPtrInput
   172  	// Defaults to principal ARN if user is principal else defaults to assume-role/session-name is role is used.
   173  	UserName pulumi.StringPtrInput
   174  }
   175  
   176  func (AccessEntryState) ElementType() reflect.Type {
   177  	return reflect.TypeOf((*accessEntryState)(nil)).Elem()
   178  }
   179  
   180  type accessEntryArgs struct {
   181  	// Name of the EKS Cluster.
   182  	ClusterName string `pulumi:"clusterName"`
   183  	// List of string which can optionally specify the Kubernetes groups the user would belong to when creating an access entry.
   184  	KubernetesGroups []string `pulumi:"kubernetesGroups"`
   185  	// The IAM Principal ARN which requires Authentication access to the EKS cluster.
   186  	//
   187  	// The following arguments are optional:
   188  	PrincipalArn string `pulumi:"principalArn"`
   189  	// 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.
   190  	Tags map[string]string `pulumi:"tags"`
   191  	// Defaults to STANDARD which provides the standard workflow. EC2_LINUX, EC2_WINDOWS, FARGATE_LINUX types disallow users to input a username or groups, and prevent associations.
   192  	Type *string `pulumi:"type"`
   193  	// Defaults to principal ARN if user is principal else defaults to assume-role/session-name is role is used.
   194  	UserName *string `pulumi:"userName"`
   195  }
   196  
   197  // The set of arguments for constructing a AccessEntry resource.
   198  type AccessEntryArgs struct {
   199  	// Name of the EKS Cluster.
   200  	ClusterName pulumi.StringInput
   201  	// List of string which can optionally specify the Kubernetes groups the user would belong to when creating an access entry.
   202  	KubernetesGroups pulumi.StringArrayInput
   203  	// The IAM Principal ARN which requires Authentication access to the EKS cluster.
   204  	//
   205  	// The following arguments are optional:
   206  	PrincipalArn pulumi.StringInput
   207  	// 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.
   208  	Tags pulumi.StringMapInput
   209  	// Defaults to STANDARD which provides the standard workflow. EC2_LINUX, EC2_WINDOWS, FARGATE_LINUX types disallow users to input a username or groups, and prevent associations.
   210  	Type pulumi.StringPtrInput
   211  	// Defaults to principal ARN if user is principal else defaults to assume-role/session-name is role is used.
   212  	UserName pulumi.StringPtrInput
   213  }
   214  
   215  func (AccessEntryArgs) ElementType() reflect.Type {
   216  	return reflect.TypeOf((*accessEntryArgs)(nil)).Elem()
   217  }
   218  
   219  type AccessEntryInput interface {
   220  	pulumi.Input
   221  
   222  	ToAccessEntryOutput() AccessEntryOutput
   223  	ToAccessEntryOutputWithContext(ctx context.Context) AccessEntryOutput
   224  }
   225  
   226  func (*AccessEntry) ElementType() reflect.Type {
   227  	return reflect.TypeOf((**AccessEntry)(nil)).Elem()
   228  }
   229  
   230  func (i *AccessEntry) ToAccessEntryOutput() AccessEntryOutput {
   231  	return i.ToAccessEntryOutputWithContext(context.Background())
   232  }
   233  
   234  func (i *AccessEntry) ToAccessEntryOutputWithContext(ctx context.Context) AccessEntryOutput {
   235  	return pulumi.ToOutputWithContext(ctx, i).(AccessEntryOutput)
   236  }
   237  
   238  // AccessEntryArrayInput is an input type that accepts AccessEntryArray and AccessEntryArrayOutput values.
   239  // You can construct a concrete instance of `AccessEntryArrayInput` via:
   240  //
   241  //	AccessEntryArray{ AccessEntryArgs{...} }
   242  type AccessEntryArrayInput interface {
   243  	pulumi.Input
   244  
   245  	ToAccessEntryArrayOutput() AccessEntryArrayOutput
   246  	ToAccessEntryArrayOutputWithContext(context.Context) AccessEntryArrayOutput
   247  }
   248  
   249  type AccessEntryArray []AccessEntryInput
   250  
   251  func (AccessEntryArray) ElementType() reflect.Type {
   252  	return reflect.TypeOf((*[]*AccessEntry)(nil)).Elem()
   253  }
   254  
   255  func (i AccessEntryArray) ToAccessEntryArrayOutput() AccessEntryArrayOutput {
   256  	return i.ToAccessEntryArrayOutputWithContext(context.Background())
   257  }
   258  
   259  func (i AccessEntryArray) ToAccessEntryArrayOutputWithContext(ctx context.Context) AccessEntryArrayOutput {
   260  	return pulumi.ToOutputWithContext(ctx, i).(AccessEntryArrayOutput)
   261  }
   262  
   263  // AccessEntryMapInput is an input type that accepts AccessEntryMap and AccessEntryMapOutput values.
   264  // You can construct a concrete instance of `AccessEntryMapInput` via:
   265  //
   266  //	AccessEntryMap{ "key": AccessEntryArgs{...} }
   267  type AccessEntryMapInput interface {
   268  	pulumi.Input
   269  
   270  	ToAccessEntryMapOutput() AccessEntryMapOutput
   271  	ToAccessEntryMapOutputWithContext(context.Context) AccessEntryMapOutput
   272  }
   273  
   274  type AccessEntryMap map[string]AccessEntryInput
   275  
   276  func (AccessEntryMap) ElementType() reflect.Type {
   277  	return reflect.TypeOf((*map[string]*AccessEntry)(nil)).Elem()
   278  }
   279  
   280  func (i AccessEntryMap) ToAccessEntryMapOutput() AccessEntryMapOutput {
   281  	return i.ToAccessEntryMapOutputWithContext(context.Background())
   282  }
   283  
   284  func (i AccessEntryMap) ToAccessEntryMapOutputWithContext(ctx context.Context) AccessEntryMapOutput {
   285  	return pulumi.ToOutputWithContext(ctx, i).(AccessEntryMapOutput)
   286  }
   287  
   288  type AccessEntryOutput struct{ *pulumi.OutputState }
   289  
   290  func (AccessEntryOutput) ElementType() reflect.Type {
   291  	return reflect.TypeOf((**AccessEntry)(nil)).Elem()
   292  }
   293  
   294  func (o AccessEntryOutput) ToAccessEntryOutput() AccessEntryOutput {
   295  	return o
   296  }
   297  
   298  func (o AccessEntryOutput) ToAccessEntryOutputWithContext(ctx context.Context) AccessEntryOutput {
   299  	return o
   300  }
   301  
   302  // Amazon Resource Name (ARN) of the Access Entry.
   303  func (o AccessEntryOutput) AccessEntryArn() pulumi.StringOutput {
   304  	return o.ApplyT(func(v *AccessEntry) pulumi.StringOutput { return v.AccessEntryArn }).(pulumi.StringOutput)
   305  }
   306  
   307  // Name of the EKS Cluster.
   308  func (o AccessEntryOutput) ClusterName() pulumi.StringOutput {
   309  	return o.ApplyT(func(v *AccessEntry) pulumi.StringOutput { return v.ClusterName }).(pulumi.StringOutput)
   310  }
   311  
   312  // Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the EKS add-on was created.
   313  func (o AccessEntryOutput) CreatedAt() pulumi.StringOutput {
   314  	return o.ApplyT(func(v *AccessEntry) pulumi.StringOutput { return v.CreatedAt }).(pulumi.StringOutput)
   315  }
   316  
   317  // List of string which can optionally specify the Kubernetes groups the user would belong to when creating an access entry.
   318  func (o AccessEntryOutput) KubernetesGroups() pulumi.StringArrayOutput {
   319  	return o.ApplyT(func(v *AccessEntry) pulumi.StringArrayOutput { return v.KubernetesGroups }).(pulumi.StringArrayOutput)
   320  }
   321  
   322  // Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the EKS add-on was updated.
   323  func (o AccessEntryOutput) ModifiedAt() pulumi.StringOutput {
   324  	return o.ApplyT(func(v *AccessEntry) pulumi.StringOutput { return v.ModifiedAt }).(pulumi.StringOutput)
   325  }
   326  
   327  // The IAM Principal ARN which requires Authentication access to the EKS cluster.
   328  //
   329  // The following arguments are optional:
   330  func (o AccessEntryOutput) PrincipalArn() pulumi.StringOutput {
   331  	return o.ApplyT(func(v *AccessEntry) pulumi.StringOutput { return v.PrincipalArn }).(pulumi.StringOutput)
   332  }
   333  
   334  // 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.
   335  func (o AccessEntryOutput) Tags() pulumi.StringMapOutput {
   336  	return o.ApplyT(func(v *AccessEntry) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   337  }
   338  
   339  // (Optional) Key-value map of resource tags, including those inherited from the provider `defaultTags` configuration block.
   340  //
   341  // Deprecated: Please use `tags` instead.
   342  func (o AccessEntryOutput) TagsAll() pulumi.StringMapOutput {
   343  	return o.ApplyT(func(v *AccessEntry) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   344  }
   345  
   346  // Defaults to STANDARD which provides the standard workflow. EC2_LINUX, EC2_WINDOWS, FARGATE_LINUX types disallow users to input a username or groups, and prevent associations.
   347  func (o AccessEntryOutput) Type() pulumi.StringPtrOutput {
   348  	return o.ApplyT(func(v *AccessEntry) pulumi.StringPtrOutput { return v.Type }).(pulumi.StringPtrOutput)
   349  }
   350  
   351  // Defaults to principal ARN if user is principal else defaults to assume-role/session-name is role is used.
   352  func (o AccessEntryOutput) UserName() pulumi.StringOutput {
   353  	return o.ApplyT(func(v *AccessEntry) pulumi.StringOutput { return v.UserName }).(pulumi.StringOutput)
   354  }
   355  
   356  type AccessEntryArrayOutput struct{ *pulumi.OutputState }
   357  
   358  func (AccessEntryArrayOutput) ElementType() reflect.Type {
   359  	return reflect.TypeOf((*[]*AccessEntry)(nil)).Elem()
   360  }
   361  
   362  func (o AccessEntryArrayOutput) ToAccessEntryArrayOutput() AccessEntryArrayOutput {
   363  	return o
   364  }
   365  
   366  func (o AccessEntryArrayOutput) ToAccessEntryArrayOutputWithContext(ctx context.Context) AccessEntryArrayOutput {
   367  	return o
   368  }
   369  
   370  func (o AccessEntryArrayOutput) Index(i pulumi.IntInput) AccessEntryOutput {
   371  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *AccessEntry {
   372  		return vs[0].([]*AccessEntry)[vs[1].(int)]
   373  	}).(AccessEntryOutput)
   374  }
   375  
   376  type AccessEntryMapOutput struct{ *pulumi.OutputState }
   377  
   378  func (AccessEntryMapOutput) ElementType() reflect.Type {
   379  	return reflect.TypeOf((*map[string]*AccessEntry)(nil)).Elem()
   380  }
   381  
   382  func (o AccessEntryMapOutput) ToAccessEntryMapOutput() AccessEntryMapOutput {
   383  	return o
   384  }
   385  
   386  func (o AccessEntryMapOutput) ToAccessEntryMapOutputWithContext(ctx context.Context) AccessEntryMapOutput {
   387  	return o
   388  }
   389  
   390  func (o AccessEntryMapOutput) MapIndex(k pulumi.StringInput) AccessEntryOutput {
   391  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *AccessEntry {
   392  		return vs[0].(map[string]*AccessEntry)[vs[1].(string)]
   393  	}).(AccessEntryOutput)
   394  }
   395  
   396  func init() {
   397  	pulumi.RegisterInputType(reflect.TypeOf((*AccessEntryInput)(nil)).Elem(), &AccessEntry{})
   398  	pulumi.RegisterInputType(reflect.TypeOf((*AccessEntryArrayInput)(nil)).Elem(), AccessEntryArray{})
   399  	pulumi.RegisterInputType(reflect.TypeOf((*AccessEntryMapInput)(nil)).Elem(), AccessEntryMap{})
   400  	pulumi.RegisterOutputType(AccessEntryOutput{})
   401  	pulumi.RegisterOutputType(AccessEntryArrayOutput{})
   402  	pulumi.RegisterOutputType(AccessEntryMapOutput{})
   403  }