Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi
alicloud.slb.getAttachments
Explore with Pulumi AI
This data source provides the server load balancer attachments of the current Alibaba Cloud user.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const sampleDs = alicloud.slb.getAttachments({
loadBalancerId: sampleSlb.id,
});
export const firstSlbAttachmentInstanceId = sampleDs.then(sampleDs => sampleDs.slbAttachments?.[0]?.instanceId);
import pulumi
import pulumi_alicloud as alicloud
sample_ds = alicloud.slb.get_attachments(load_balancer_id=sample_slb["id"])
pulumi.export("firstSlbAttachmentInstanceId", sample_ds.slb_attachments[0].instance_id)
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/slb"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
sampleDs, err := slb.GetAttachments(ctx, &slb.GetAttachmentsArgs{
LoadBalancerId: sampleSlb.Id,
}, nil)
if err != nil {
return err
}
ctx.Export("firstSlbAttachmentInstanceId", sampleDs.SlbAttachments[0].InstanceId)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var sampleDs = AliCloud.Slb.GetAttachments.Invoke(new()
{
LoadBalancerId = sampleSlb.Id,
});
return new Dictionary<string, object?>
{
["firstSlbAttachmentInstanceId"] = sampleDs.Apply(getAttachmentsResult => getAttachmentsResult.SlbAttachments[0]?.InstanceId),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.slb.SlbFunctions;
import com.pulumi.alicloud.slb.inputs.GetAttachmentsArgs;
import java.util.List;
import java.util.ArrayList;
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) {
final var sampleDs = SlbFunctions.getAttachments(GetAttachmentsArgs.builder()
.loadBalancerId(sampleSlb.id())
.build());
ctx.export("firstSlbAttachmentInstanceId", sampleDs.applyValue(getAttachmentsResult -> getAttachmentsResult.slbAttachments()[0].instanceId()));
}
}
variables:
sampleDs:
fn::invoke:
Function: alicloud:slb:getAttachments
Arguments:
loadBalancerId: ${sampleSlb.id}
outputs:
firstSlbAttachmentInstanceId: ${sampleDs.slbAttachments[0].instanceId}
Using getAttachments
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getAttachments(args: GetAttachmentsArgs, opts?: InvokeOptions): Promise<GetAttachmentsResult>
function getAttachmentsOutput(args: GetAttachmentsOutputArgs, opts?: InvokeOptions): Output<GetAttachmentsResult>
def get_attachments(instance_ids: Optional[Sequence[str]] = None,
load_balancer_id: Optional[str] = None,
output_file: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetAttachmentsResult
def get_attachments_output(instance_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
load_balancer_id: Optional[pulumi.Input[str]] = None,
output_file: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetAttachmentsResult]
func GetAttachments(ctx *Context, args *GetAttachmentsArgs, opts ...InvokeOption) (*GetAttachmentsResult, error)
func GetAttachmentsOutput(ctx *Context, args *GetAttachmentsOutputArgs, opts ...InvokeOption) GetAttachmentsResultOutput
> Note: This function is named GetAttachments
in the Go SDK.
public static class GetAttachments
{
public static Task<GetAttachmentsResult> InvokeAsync(GetAttachmentsArgs args, InvokeOptions? opts = null)
public static Output<GetAttachmentsResult> Invoke(GetAttachmentsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetAttachmentsResult> getAttachments(GetAttachmentsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: alicloud:slb/getAttachments:getAttachments
arguments:
# arguments dictionary
The following arguments are supported:
- Load
Balancer stringId - ID of the SLB with attachments.
- Instance
Ids List<string> - List of attached ECS instance IDs.
- Output
File string - File name where to save data source results (after running
pulumi preview
).
- Load
Balancer stringId - ID of the SLB with attachments.
- Instance
Ids []string - List of attached ECS instance IDs.
- Output
File string - File name where to save data source results (after running
pulumi preview
).
- load
Balancer StringId - ID of the SLB with attachments.
- instance
Ids List<String> - List of attached ECS instance IDs.
- output
File String - File name where to save data source results (after running
pulumi preview
).
- load
Balancer stringId - ID of the SLB with attachments.
- instance
Ids string[] - List of attached ECS instance IDs.
- output
File string - File name where to save data source results (after running
pulumi preview
).
- load_
balancer_ strid - ID of the SLB with attachments.
- instance_
ids Sequence[str] - List of attached ECS instance IDs.
- output_
file str - File name where to save data source results (after running
pulumi preview
).
- load
Balancer StringId - ID of the SLB with attachments.
- instance
Ids List<String> - List of attached ECS instance IDs.
- output
File String - File name where to save data source results (after running
pulumi preview
).
getAttachments Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Load
Balancer stringId - Slb
Attachments List<Pulumi.Ali Cloud. Slb. Outputs. Get Attachments Slb Attachment> - A list of SLB attachments. Each element contains the following attributes:
- Instance
Ids List<string> - Output
File string
- Id string
- The provider-assigned unique ID for this managed resource.
- Load
Balancer stringId - Slb
Attachments []GetAttachments Slb Attachment - A list of SLB attachments. Each element contains the following attributes:
- Instance
Ids []string - Output
File string
- id String
- The provider-assigned unique ID for this managed resource.
- load
Balancer StringId - slb
Attachments List<GetAttachments Slb Attachment> - A list of SLB attachments. Each element contains the following attributes:
- instance
Ids List<String> - output
File String
- id string
- The provider-assigned unique ID for this managed resource.
- load
Balancer stringId - slb
Attachments GetAttachments Slb Attachment[] - A list of SLB attachments. Each element contains the following attributes:
- instance
Ids string[] - output
File string
- id str
- The provider-assigned unique ID for this managed resource.
- load_
balancer_ strid - slb_
attachments Sequence[GetAttachments Slb Attachment] - A list of SLB attachments. Each element contains the following attributes:
- instance_
ids Sequence[str] - output_
file str
- id String
- The provider-assigned unique ID for this managed resource.
- load
Balancer StringId - slb
Attachments List<Property Map> - A list of SLB attachments. Each element contains the following attributes:
- instance
Ids List<String> - output
File String
Supporting Types
GetAttachmentsSlbAttachment
- Instance
Id string - ID of the attached ECS instance.
- Weight int
- Weight associated to the ECS instance.
- Instance
Id string - ID of the attached ECS instance.
- Weight int
- Weight associated to the ECS instance.
- instance
Id String - ID of the attached ECS instance.
- weight Integer
- Weight associated to the ECS instance.
- instance
Id string - ID of the attached ECS instance.
- weight number
- Weight associated to the ECS instance.
- instance_
id str - ID of the attached ECS instance.
- weight int
- Weight associated to the ECS instance.
- instance
Id String - ID of the attached ECS instance.
- weight Number
- Weight associated to the ECS instance.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.