alicloud.slb.getAttachments
Explore with Pulumi AI
This data source provides the server load balancer attachments of the current Alibaba Cloud user.
Example Usage
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 = alicloud_slb_load_balancer.Sample_slb.Id,
});
return new Dictionary<string, object?>
{
["firstSlbAttachmentInstanceId"] = sampleDs.Apply(getAttachmentsResult => getAttachmentsResult.SlbAttachments[0]?.InstanceId),
};
});
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: alicloud_slb_load_balancer.Sample_slb.Id,
}, nil)
if err != nil {
return err
}
ctx.Export("firstSlbAttachmentInstanceId", sampleDs.SlbAttachments[0].InstanceId)
return nil
})
}
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(alicloud_slb_load_balancer.sample_slb().id())
.build());
ctx.export("firstSlbAttachmentInstanceId", sampleDs.applyValue(getAttachmentsResult -> getAttachmentsResult.slbAttachments()[0].instanceId()));
}
}
import pulumi
import pulumi_alicloud as alicloud
sample_ds = alicloud.slb.get_attachments(load_balancer_id=%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
pulumi.export("firstSlbAttachmentInstanceId", sample_ds.slb_attachments[0].instance_id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const sampleDs = alicloud.slb.getAttachments({
loadBalancerId: alicloud_slb_load_balancer.sample_slb.id,
});
export const firstSlbAttachmentInstanceId = sampleDs.then(sampleDs => sampleDs.slbAttachments?.[0]?.instanceId);
variables:
sampleDs:
fn::invoke:
Function: alicloud:slb:getAttachments
Arguments:
loadBalancerId: ${alicloud_slb_load_balancer.sample_slb.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.