Terraform 有没有办法为Teraform添加注释以显示在';地形应用';日志?

Terraform 有没有办法为Teraform添加注释以显示在';地形应用';日志?,terraform,terraform-provider-aws,terraform0.12+,Terraform,Terraform Provider Aws,Terraform0.12+,我希望能够添加一个定制的注释,如“请在AWS控制台中手动更新xxx并重新运行Terraform apply”。忽略此消息(如果不适用) 类似于此,是否有办法在Terraform脚本中配置此功能?您可以在根模块中使用,然后在运行Terraform apply时将其输出到终端 举个简单的例子: resource "null_resource" "foo" { } output "next_steps" { value = "

我希望能够添加一个定制的注释,如“请在AWS控制台中手动更新xxx并重新运行Terraform apply”。忽略此消息(如果不适用)

类似于此,是否有办法在Terraform脚本中配置此功能?

您可以在根模块中使用,然后在运行
Terraform apply
时将其输出到终端

举个简单的例子:

resource "null_resource" "foo" {

}

output "next_steps" {
  value = "Please update xxx manually in AWS console and re-run Terraform apply. Ignore this message if not applicable"
}
使用
地形应用创建时将输出以下内容:

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # null_resource.foo will be created
  + resource "null_resource" "foo" {
      + id = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + next_steps = "Please update xxx manually in AWS console and re-run Terraform apply. Ignore this message if not applicable"

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

null_resource.foo: Creating...
null_resource.foo: Creation complete after 0s [id=347317219666477450]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Outputs:

next_steps = "Please update xxx manually in AWS console and re-run Terraform apply. Ignore this message if not applicable"
如果重新运行
terraform apply
,您将看到:

null_resource.foo: Refreshing state... [id=347317219666477450]

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

next_steps = "Please update xxx manually in AWS console and re-run Terraform apply. Ignore this message if not applicable"