iac_modules/PulumiGo/pulumi.go
2025-05-16 19:41:03 +08:00

25 lines
546 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package cloudwalker
import (
"fmt"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func DeployInfrastructure() error {
err := pulumi.Run(func(ctx *pulumi.Context) error {
// 示例:创建一个 S3 bucketPulumi 示例)
bucket, err := pulumi.NewBucket(ctx, "my-bucket", &pulumi.BucketArgs{})
if err != nil {
return fmt.Errorf("failed to create bucket: %v", err)
}
// 输出结果
ctx.Export("bucketName", bucket.ID())
return nil
})
if err != nil {
return fmt.Errorf("failed to run pulumi: %v", err)
}
return nil
}