github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/efs/mountTarget.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 efs
     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  // Provides an Elastic File System (EFS) mount target.
    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/ec2"
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/efs"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			foo, err := ec2.NewVpc(ctx, "foo", &ec2.VpcArgs{
    34  //				CidrBlock: pulumi.String("10.0.0.0/16"),
    35  //			})
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			alphaSubnet, err := ec2.NewSubnet(ctx, "alpha", &ec2.SubnetArgs{
    40  //				VpcId:            foo.ID(),
    41  //				AvailabilityZone: pulumi.String("us-west-2a"),
    42  //				CidrBlock:        pulumi.String("10.0.1.0/24"),
    43  //			})
    44  //			if err != nil {
    45  //				return err
    46  //			}
    47  //			_, err = efs.NewMountTarget(ctx, "alpha", &efs.MountTargetArgs{
    48  //				FileSystemId: pulumi.Any(fooAwsEfsFileSystem.Id),
    49  //				SubnetId:     alphaSubnet.ID(),
    50  //			})
    51  //			if err != nil {
    52  //				return err
    53  //			}
    54  //			return nil
    55  //		})
    56  //	}
    57  //
    58  // ```
    59  // <!--End PulumiCodeChooser -->
    60  //
    61  // ## Import
    62  //
    63  // Using `pulumi import`, import the EFS mount targets using the `id`. For example:
    64  //
    65  // ```sh
    66  // $ pulumi import aws:efs/mountTarget:MountTarget alpha fsmt-52a643fb
    67  // ```
    68  type MountTarget struct {
    69  	pulumi.CustomResourceState
    70  
    71  	// The unique and consistent identifier of the Availability Zone (AZ) that the mount target resides in.
    72  	AvailabilityZoneId pulumi.StringOutput `pulumi:"availabilityZoneId"`
    73  	// The name of the Availability Zone (AZ) that the mount target resides in.
    74  	AvailabilityZoneName pulumi.StringOutput `pulumi:"availabilityZoneName"`
    75  	// The DNS name for the EFS file system.
    76  	DnsName pulumi.StringOutput `pulumi:"dnsName"`
    77  	// Amazon Resource Name of the file system.
    78  	FileSystemArn pulumi.StringOutput `pulumi:"fileSystemArn"`
    79  	// The ID of the file system for which the mount target is intended.
    80  	FileSystemId pulumi.StringOutput `pulumi:"fileSystemId"`
    81  	// The address (within the address range of the specified subnet) at
    82  	// which the file system may be mounted via the mount target.
    83  	IpAddress pulumi.StringOutput `pulumi:"ipAddress"`
    84  	// The DNS name for the given subnet/AZ per [documented convention](http://docs.aws.amazon.com/efs/latest/ug/mounting-fs-mount-cmd-dns-name.html).
    85  	MountTargetDnsName pulumi.StringOutput `pulumi:"mountTargetDnsName"`
    86  	// The ID of the network interface that Amazon EFS created when it created the mount target.
    87  	NetworkInterfaceId pulumi.StringOutput `pulumi:"networkInterfaceId"`
    88  	// AWS account ID that owns the resource.
    89  	OwnerId pulumi.StringOutput `pulumi:"ownerId"`
    90  	// A list of up to 5 VPC security group IDs (that must
    91  	// be for the same VPC as subnet specified) in effect for the mount target.
    92  	SecurityGroups pulumi.StringArrayOutput `pulumi:"securityGroups"`
    93  	// The ID of the subnet to add the mount target in.
    94  	SubnetId pulumi.StringOutput `pulumi:"subnetId"`
    95  }
    96  
    97  // NewMountTarget registers a new resource with the given unique name, arguments, and options.
    98  func NewMountTarget(ctx *pulumi.Context,
    99  	name string, args *MountTargetArgs, opts ...pulumi.ResourceOption) (*MountTarget, error) {
   100  	if args == nil {
   101  		return nil, errors.New("missing one or more required arguments")
   102  	}
   103  
   104  	if args.FileSystemId == nil {
   105  		return nil, errors.New("invalid value for required argument 'FileSystemId'")
   106  	}
   107  	if args.SubnetId == nil {
   108  		return nil, errors.New("invalid value for required argument 'SubnetId'")
   109  	}
   110  	opts = internal.PkgResourceDefaultOpts(opts)
   111  	var resource MountTarget
   112  	err := ctx.RegisterResource("aws:efs/mountTarget:MountTarget", name, args, &resource, opts...)
   113  	if err != nil {
   114  		return nil, err
   115  	}
   116  	return &resource, nil
   117  }
   118  
   119  // GetMountTarget gets an existing MountTarget resource's state with the given name, ID, and optional
   120  // state properties that are used to uniquely qualify the lookup (nil if not required).
   121  func GetMountTarget(ctx *pulumi.Context,
   122  	name string, id pulumi.IDInput, state *MountTargetState, opts ...pulumi.ResourceOption) (*MountTarget, error) {
   123  	var resource MountTarget
   124  	err := ctx.ReadResource("aws:efs/mountTarget:MountTarget", name, id, state, &resource, opts...)
   125  	if err != nil {
   126  		return nil, err
   127  	}
   128  	return &resource, nil
   129  }
   130  
   131  // Input properties used for looking up and filtering MountTarget resources.
   132  type mountTargetState struct {
   133  	// The unique and consistent identifier of the Availability Zone (AZ) that the mount target resides in.
   134  	AvailabilityZoneId *string `pulumi:"availabilityZoneId"`
   135  	// The name of the Availability Zone (AZ) that the mount target resides in.
   136  	AvailabilityZoneName *string `pulumi:"availabilityZoneName"`
   137  	// The DNS name for the EFS file system.
   138  	DnsName *string `pulumi:"dnsName"`
   139  	// Amazon Resource Name of the file system.
   140  	FileSystemArn *string `pulumi:"fileSystemArn"`
   141  	// The ID of the file system for which the mount target is intended.
   142  	FileSystemId *string `pulumi:"fileSystemId"`
   143  	// The address (within the address range of the specified subnet) at
   144  	// which the file system may be mounted via the mount target.
   145  	IpAddress *string `pulumi:"ipAddress"`
   146  	// The DNS name for the given subnet/AZ per [documented convention](http://docs.aws.amazon.com/efs/latest/ug/mounting-fs-mount-cmd-dns-name.html).
   147  	MountTargetDnsName *string `pulumi:"mountTargetDnsName"`
   148  	// The ID of the network interface that Amazon EFS created when it created the mount target.
   149  	NetworkInterfaceId *string `pulumi:"networkInterfaceId"`
   150  	// AWS account ID that owns the resource.
   151  	OwnerId *string `pulumi:"ownerId"`
   152  	// A list of up to 5 VPC security group IDs (that must
   153  	// be for the same VPC as subnet specified) in effect for the mount target.
   154  	SecurityGroups []string `pulumi:"securityGroups"`
   155  	// The ID of the subnet to add the mount target in.
   156  	SubnetId *string `pulumi:"subnetId"`
   157  }
   158  
   159  type MountTargetState struct {
   160  	// The unique and consistent identifier of the Availability Zone (AZ) that the mount target resides in.
   161  	AvailabilityZoneId pulumi.StringPtrInput
   162  	// The name of the Availability Zone (AZ) that the mount target resides in.
   163  	AvailabilityZoneName pulumi.StringPtrInput
   164  	// The DNS name for the EFS file system.
   165  	DnsName pulumi.StringPtrInput
   166  	// Amazon Resource Name of the file system.
   167  	FileSystemArn pulumi.StringPtrInput
   168  	// The ID of the file system for which the mount target is intended.
   169  	FileSystemId pulumi.StringPtrInput
   170  	// The address (within the address range of the specified subnet) at
   171  	// which the file system may be mounted via the mount target.
   172  	IpAddress pulumi.StringPtrInput
   173  	// The DNS name for the given subnet/AZ per [documented convention](http://docs.aws.amazon.com/efs/latest/ug/mounting-fs-mount-cmd-dns-name.html).
   174  	MountTargetDnsName pulumi.StringPtrInput
   175  	// The ID of the network interface that Amazon EFS created when it created the mount target.
   176  	NetworkInterfaceId pulumi.StringPtrInput
   177  	// AWS account ID that owns the resource.
   178  	OwnerId pulumi.StringPtrInput
   179  	// A list of up to 5 VPC security group IDs (that must
   180  	// be for the same VPC as subnet specified) in effect for the mount target.
   181  	SecurityGroups pulumi.StringArrayInput
   182  	// The ID of the subnet to add the mount target in.
   183  	SubnetId pulumi.StringPtrInput
   184  }
   185  
   186  func (MountTargetState) ElementType() reflect.Type {
   187  	return reflect.TypeOf((*mountTargetState)(nil)).Elem()
   188  }
   189  
   190  type mountTargetArgs struct {
   191  	// The ID of the file system for which the mount target is intended.
   192  	FileSystemId string `pulumi:"fileSystemId"`
   193  	// The address (within the address range of the specified subnet) at
   194  	// which the file system may be mounted via the mount target.
   195  	IpAddress *string `pulumi:"ipAddress"`
   196  	// A list of up to 5 VPC security group IDs (that must
   197  	// be for the same VPC as subnet specified) in effect for the mount target.
   198  	SecurityGroups []string `pulumi:"securityGroups"`
   199  	// The ID of the subnet to add the mount target in.
   200  	SubnetId string `pulumi:"subnetId"`
   201  }
   202  
   203  // The set of arguments for constructing a MountTarget resource.
   204  type MountTargetArgs struct {
   205  	// The ID of the file system for which the mount target is intended.
   206  	FileSystemId pulumi.StringInput
   207  	// The address (within the address range of the specified subnet) at
   208  	// which the file system may be mounted via the mount target.
   209  	IpAddress pulumi.StringPtrInput
   210  	// A list of up to 5 VPC security group IDs (that must
   211  	// be for the same VPC as subnet specified) in effect for the mount target.
   212  	SecurityGroups pulumi.StringArrayInput
   213  	// The ID of the subnet to add the mount target in.
   214  	SubnetId pulumi.StringInput
   215  }
   216  
   217  func (MountTargetArgs) ElementType() reflect.Type {
   218  	return reflect.TypeOf((*mountTargetArgs)(nil)).Elem()
   219  }
   220  
   221  type MountTargetInput interface {
   222  	pulumi.Input
   223  
   224  	ToMountTargetOutput() MountTargetOutput
   225  	ToMountTargetOutputWithContext(ctx context.Context) MountTargetOutput
   226  }
   227  
   228  func (*MountTarget) ElementType() reflect.Type {
   229  	return reflect.TypeOf((**MountTarget)(nil)).Elem()
   230  }
   231  
   232  func (i *MountTarget) ToMountTargetOutput() MountTargetOutput {
   233  	return i.ToMountTargetOutputWithContext(context.Background())
   234  }
   235  
   236  func (i *MountTarget) ToMountTargetOutputWithContext(ctx context.Context) MountTargetOutput {
   237  	return pulumi.ToOutputWithContext(ctx, i).(MountTargetOutput)
   238  }
   239  
   240  // MountTargetArrayInput is an input type that accepts MountTargetArray and MountTargetArrayOutput values.
   241  // You can construct a concrete instance of `MountTargetArrayInput` via:
   242  //
   243  //	MountTargetArray{ MountTargetArgs{...} }
   244  type MountTargetArrayInput interface {
   245  	pulumi.Input
   246  
   247  	ToMountTargetArrayOutput() MountTargetArrayOutput
   248  	ToMountTargetArrayOutputWithContext(context.Context) MountTargetArrayOutput
   249  }
   250  
   251  type MountTargetArray []MountTargetInput
   252  
   253  func (MountTargetArray) ElementType() reflect.Type {
   254  	return reflect.TypeOf((*[]*MountTarget)(nil)).Elem()
   255  }
   256  
   257  func (i MountTargetArray) ToMountTargetArrayOutput() MountTargetArrayOutput {
   258  	return i.ToMountTargetArrayOutputWithContext(context.Background())
   259  }
   260  
   261  func (i MountTargetArray) ToMountTargetArrayOutputWithContext(ctx context.Context) MountTargetArrayOutput {
   262  	return pulumi.ToOutputWithContext(ctx, i).(MountTargetArrayOutput)
   263  }
   264  
   265  // MountTargetMapInput is an input type that accepts MountTargetMap and MountTargetMapOutput values.
   266  // You can construct a concrete instance of `MountTargetMapInput` via:
   267  //
   268  //	MountTargetMap{ "key": MountTargetArgs{...} }
   269  type MountTargetMapInput interface {
   270  	pulumi.Input
   271  
   272  	ToMountTargetMapOutput() MountTargetMapOutput
   273  	ToMountTargetMapOutputWithContext(context.Context) MountTargetMapOutput
   274  }
   275  
   276  type MountTargetMap map[string]MountTargetInput
   277  
   278  func (MountTargetMap) ElementType() reflect.Type {
   279  	return reflect.TypeOf((*map[string]*MountTarget)(nil)).Elem()
   280  }
   281  
   282  func (i MountTargetMap) ToMountTargetMapOutput() MountTargetMapOutput {
   283  	return i.ToMountTargetMapOutputWithContext(context.Background())
   284  }
   285  
   286  func (i MountTargetMap) ToMountTargetMapOutputWithContext(ctx context.Context) MountTargetMapOutput {
   287  	return pulumi.ToOutputWithContext(ctx, i).(MountTargetMapOutput)
   288  }
   289  
   290  type MountTargetOutput struct{ *pulumi.OutputState }
   291  
   292  func (MountTargetOutput) ElementType() reflect.Type {
   293  	return reflect.TypeOf((**MountTarget)(nil)).Elem()
   294  }
   295  
   296  func (o MountTargetOutput) ToMountTargetOutput() MountTargetOutput {
   297  	return o
   298  }
   299  
   300  func (o MountTargetOutput) ToMountTargetOutputWithContext(ctx context.Context) MountTargetOutput {
   301  	return o
   302  }
   303  
   304  // The unique and consistent identifier of the Availability Zone (AZ) that the mount target resides in.
   305  func (o MountTargetOutput) AvailabilityZoneId() pulumi.StringOutput {
   306  	return o.ApplyT(func(v *MountTarget) pulumi.StringOutput { return v.AvailabilityZoneId }).(pulumi.StringOutput)
   307  }
   308  
   309  // The name of the Availability Zone (AZ) that the mount target resides in.
   310  func (o MountTargetOutput) AvailabilityZoneName() pulumi.StringOutput {
   311  	return o.ApplyT(func(v *MountTarget) pulumi.StringOutput { return v.AvailabilityZoneName }).(pulumi.StringOutput)
   312  }
   313  
   314  // The DNS name for the EFS file system.
   315  func (o MountTargetOutput) DnsName() pulumi.StringOutput {
   316  	return o.ApplyT(func(v *MountTarget) pulumi.StringOutput { return v.DnsName }).(pulumi.StringOutput)
   317  }
   318  
   319  // Amazon Resource Name of the file system.
   320  func (o MountTargetOutput) FileSystemArn() pulumi.StringOutput {
   321  	return o.ApplyT(func(v *MountTarget) pulumi.StringOutput { return v.FileSystemArn }).(pulumi.StringOutput)
   322  }
   323  
   324  // The ID of the file system for which the mount target is intended.
   325  func (o MountTargetOutput) FileSystemId() pulumi.StringOutput {
   326  	return o.ApplyT(func(v *MountTarget) pulumi.StringOutput { return v.FileSystemId }).(pulumi.StringOutput)
   327  }
   328  
   329  // The address (within the address range of the specified subnet) at
   330  // which the file system may be mounted via the mount target.
   331  func (o MountTargetOutput) IpAddress() pulumi.StringOutput {
   332  	return o.ApplyT(func(v *MountTarget) pulumi.StringOutput { return v.IpAddress }).(pulumi.StringOutput)
   333  }
   334  
   335  // The DNS name for the given subnet/AZ per [documented convention](http://docs.aws.amazon.com/efs/latest/ug/mounting-fs-mount-cmd-dns-name.html).
   336  func (o MountTargetOutput) MountTargetDnsName() pulumi.StringOutput {
   337  	return o.ApplyT(func(v *MountTarget) pulumi.StringOutput { return v.MountTargetDnsName }).(pulumi.StringOutput)
   338  }
   339  
   340  // The ID of the network interface that Amazon EFS created when it created the mount target.
   341  func (o MountTargetOutput) NetworkInterfaceId() pulumi.StringOutput {
   342  	return o.ApplyT(func(v *MountTarget) pulumi.StringOutput { return v.NetworkInterfaceId }).(pulumi.StringOutput)
   343  }
   344  
   345  // AWS account ID that owns the resource.
   346  func (o MountTargetOutput) OwnerId() pulumi.StringOutput {
   347  	return o.ApplyT(func(v *MountTarget) pulumi.StringOutput { return v.OwnerId }).(pulumi.StringOutput)
   348  }
   349  
   350  // A list of up to 5 VPC security group IDs (that must
   351  // be for the same VPC as subnet specified) in effect for the mount target.
   352  func (o MountTargetOutput) SecurityGroups() pulumi.StringArrayOutput {
   353  	return o.ApplyT(func(v *MountTarget) pulumi.StringArrayOutput { return v.SecurityGroups }).(pulumi.StringArrayOutput)
   354  }
   355  
   356  // The ID of the subnet to add the mount target in.
   357  func (o MountTargetOutput) SubnetId() pulumi.StringOutput {
   358  	return o.ApplyT(func(v *MountTarget) pulumi.StringOutput { return v.SubnetId }).(pulumi.StringOutput)
   359  }
   360  
   361  type MountTargetArrayOutput struct{ *pulumi.OutputState }
   362  
   363  func (MountTargetArrayOutput) ElementType() reflect.Type {
   364  	return reflect.TypeOf((*[]*MountTarget)(nil)).Elem()
   365  }
   366  
   367  func (o MountTargetArrayOutput) ToMountTargetArrayOutput() MountTargetArrayOutput {
   368  	return o
   369  }
   370  
   371  func (o MountTargetArrayOutput) ToMountTargetArrayOutputWithContext(ctx context.Context) MountTargetArrayOutput {
   372  	return o
   373  }
   374  
   375  func (o MountTargetArrayOutput) Index(i pulumi.IntInput) MountTargetOutput {
   376  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *MountTarget {
   377  		return vs[0].([]*MountTarget)[vs[1].(int)]
   378  	}).(MountTargetOutput)
   379  }
   380  
   381  type MountTargetMapOutput struct{ *pulumi.OutputState }
   382  
   383  func (MountTargetMapOutput) ElementType() reflect.Type {
   384  	return reflect.TypeOf((*map[string]*MountTarget)(nil)).Elem()
   385  }
   386  
   387  func (o MountTargetMapOutput) ToMountTargetMapOutput() MountTargetMapOutput {
   388  	return o
   389  }
   390  
   391  func (o MountTargetMapOutput) ToMountTargetMapOutputWithContext(ctx context.Context) MountTargetMapOutput {
   392  	return o
   393  }
   394  
   395  func (o MountTargetMapOutput) MapIndex(k pulumi.StringInput) MountTargetOutput {
   396  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *MountTarget {
   397  		return vs[0].(map[string]*MountTarget)[vs[1].(string)]
   398  	}).(MountTargetOutput)
   399  }
   400  
   401  func init() {
   402  	pulumi.RegisterInputType(reflect.TypeOf((*MountTargetInput)(nil)).Elem(), &MountTarget{})
   403  	pulumi.RegisterInputType(reflect.TypeOf((*MountTargetArrayInput)(nil)).Elem(), MountTargetArray{})
   404  	pulumi.RegisterInputType(reflect.TypeOf((*MountTargetMapInput)(nil)).Elem(), MountTargetMap{})
   405  	pulumi.RegisterOutputType(MountTargetOutput{})
   406  	pulumi.RegisterOutputType(MountTargetArrayOutput{})
   407  	pulumi.RegisterOutputType(MountTargetMapOutput{})
   408  }