【问题标题】:Can we get AWS EC2 status 1/2 or 2/2 status in terraform output?我们可以在 terraform 输出中获得 AWS EC2 状态 1/2 或 2/2 状态吗?
【发布时间】:2021-03-30 15:21:27
【问题描述】:

我们能否在 terraform 输出中获得 AWS EC2 状态 1/2 或 2/2 状态?我们可以通过 cron 运行 terraform destroy 吗?

【问题讨论】:

  • 这个问题是怎么解决的?您是否设法添加外部资源?
  • @marcin 如何在 python 脚本中使用 aws cli 命令?因为我是 python 和 terraform 的新手,例如 aws ec2 describe-instance-status --instance-id i-0f8d06b73782a9020
  • @marcin 我提出了一个新问题。stackoverflow.com/questions/66882605/…。你能帮帮我吗。

标签: amazon-web-services terraform terraform-provider-aws


【解决方案1】:

数据源aws_instance 不提供此类信息。因此,您可以通过external 创建自定义数据源。

自定义/外部数据源将调用您自己的程序或脚本来查询 EC2 实例状态,例如使用describe-instance-status 并返回到 TF 以供进一步使用。

是的,您可以通过 cron 运行 TF。

【讨论】:

    猜你喜欢
    • 2021-06-27
    • 1970-01-01
    • 1970-01-01
    • 2018-10-31
    • 1970-01-01
    • 2021-02-28
    • 2021-01-16
    • 2014-10-31
    • 1970-01-01
    相关资源
    最近更新 更多