TL;博士。我想通过本地 Pulumi 堆栈保存将先前堆栈的输出准备在较新的堆栈中。例如,在之前创建的 VPC/子网中创建 AWS Fargate ECS 集群。如何在 Python 中做到这一点?
我创建了dev
Pulumi 堆栈,应用代码:
$ mkdir pulumi-infra-az
$ pulumi login --local
$ pulumi stack init dev
得到了这样的Outputs
:
...
Outputs:
pulumi-private-subnet-ids: [
[0]: "subnet-0dcbaabe273db8feb"
[1]: "subnet-08c63207611c6bae2"
[2]: "subnet-00fa346a71a323551"
]
pulumi-public-subnet-ids : [
[0]: "subnet-02c50846690f2cd70"
[1]: "subnet-06282506863db7ac1"
[2]: "subnet-0cfae8a4f5e4fc03c"
]
pulumi-vpc-id : "vpc-0767f0d49e3a59d42"
Resources:
~ 3 updated
22 unchanged
Duration: 10s
Permalink: file:///root/.pulumi/stacks/dev.json
...
正如您在此处看到的,我正在使用本地堆栈放置/root/.pulumi/stacks/dev.json
。到目前为止,一切都很好。现在在其他目录中,我想创建 fargate 集群描述:
$ mkdir pulumi-ecs-fargate
$ pulumi stack init dev-ecs # by the way can I use the same `dev` stack name here?
在这里我需要阅读以前创建pulumi-private-subnet-ids
的 , pulumi-public-subnet-ids
,pulumi-vpc-id
输出值?如何正确地做到这一点?
我只找到了https://app.pulumi.com后端示例:
https
://www.pulumi.com/docs/intro/concepts/organizing-stacks-projects/#inter-stack-dependencies https://www .pulumi.com/docs/intro/concepts/programming-model/#stack-references
https://www.pulumi.com/docs/tutorials/aws/aws-py-stackreference/
任何人都可以提供本地或 AWS s3 示例如何读取其他堆栈/目录中的输出吗?