运行terraform并等待需要很长时间.所以我想运行它来排除花费最长时间执行的rds,或者我想只运行ec2资源.有没有办法在terraform中做这样的事情?
Sau*_*abh 47
添加到 Julio 的答案中,您可以通过以下方式定位多个资源:
terraform init
terraform plan -target=resource_type1.resource_name1 -target=resource_type2.resource_name1
terraform apply -target=resource_type1.resource_name1 -target=resource_type2.resource_name1
Run Code Online (Sandbox Code Playgroud)
如果输出计划,则只需要在计划阶段指定参数:
terraform init
terraform plan \
-target=resource_type1.resource_name1 \
-target=resource_type2.resource_name1 \
-out plan
terraform apply plan
Run Code Online (Sandbox Code Playgroud)
Jul*_*yes 12
你可以-target=resource像这样使用:
terraform plan -target=module.mymodule.aws_instance.myinstance
terraform apply -target=module.mymodule.aws_instance.myinstance
Run Code Online (Sandbox Code Playgroud)
要么
terraform plan -target=aws_instance.myinstance
terraform apply -target=aws_instance.myinstance
Run Code Online (Sandbox Code Playgroud)
我想运行它以排除花费最长时间的 rds
Terraform 目前不支持资源排除(也称为反向定位)。
(感谢胡里奥·丹尼尔·雷耶斯的链接。)
| 归档时间: |
|
| 查看次数: |
7408 次 |
| 最近记录: |