You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
just ordinary use of TF. You want to know that your module has run and
maybe some other info
As an example, I have a module which optionally creates a zip archive. I would
like to know whether a zip file has been created/updated. Here is the transcript
I see from tf apply:
data.external.lambda_archive: Refreshing state...
aws_api_gateway_rest_api.send_to_sensu_api: Refreshing state... (ID: t5agem92zk)
aws_iam_role.lambda_send_to_sensu_role: Refreshing state... (ID: lambda_send_to_sensu_role)
data.aws_vpc.prod: Refreshing state...
aws_lambda_function.lambda_send_to_sensu: Refreshing state... (ID: lambda_send_to_sensu)
aws_iam_role_policy.lambda_send_to_sensu_role_policy: Refreshing state... (ID: lambda_send_to_sensu_role:lambda_send_to_sensu_role_policy)
aws_api_gateway_usage_plan.send_to_sensu_api: Refreshing state... (ID: 4vot2i)
aws_api_gateway_resource.send_to_sensu_api: Refreshing state... (ID: qfb052)
aws_api_gateway_method.send_to_sensu_api: Refreshing state... (ID: agm-t5agem92zk-qfb052-POST)
aws_api_gateway_method_settings.s: Refreshing state... (ID: t5agem92zk-prod-send/POST)
aws_api_gateway_integration.send_to_sensu_api: Refreshing state... (ID: agi-t5agem92zk-qfb052-POST)
aws_api_gateway_deployment.prod_deploy: Refreshing state... (ID: 4jnb11)
data.aws_subnet.prod_b: Refreshing state...
data.aws_subnet.prod_a: Refreshing state...
aws_lambda_function.lambda_send_to_sensu: Modifying... (ID: lambda_send_to_sensu)
environment.0.variables.sensu_url: "https://sensu-api.ctmsp.com:443" => "https://sensu-api.ctmsp.com"
last_modified: "2019-01-17T22:45:52.640+0000" => "<computed>"
source_code_hash: "9aSnvYrg1EmTHt6AFDg64tdHmZkWpMksOxDa3rAD6Vk=" => "Sc9223KCa4J/8QaF/X0xW4iH69JC5pGTKhQprEloG/0="
aws_lambda_function.lambda_send_to_sensu: Still modifying... (ID: lambda_send_to_sensu, 10s elapsed)
aws_lambda_function.lambda_send_to_sensu: Modifications complete after 13s (ID: lambda_send_to_sensu)
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.```
In the above you will notice the transition from Refreshing state to Modifying. At that
point, before the modification to aws_lambda_function, the module has been
executed and the zip file updated. I can verify that by file timestamp. However, I
would like to see that in the transcript. And, I want to see it in sequence, because I
want to know the zip file has been updated before it is uploaded to AWS Lambda.
I have attached my module code as main.tf.txt
[main.tf.txt](https://github.com/hashicorp/terraform/files/2773394/main.tf.txt)
### Attempted Solutions
- none, after reading documentation thoroughly, again
### Proposal
Here are some different ideas I came up with for implementation:
1) For the *output* statement, add a new field, such as *logging*, setting
this to true would cause the output to be a logging output when the module is
executed, not at the end of the apply session, but immediately, along with bold
font and the module path. It would be like any other logging statements. Add an
option to indicate whether it should be bold font or not.
2) Add a *log* statement, which may be used inside the module configuration
to indicate what one wants logged. Example: `log "my message with
${my value}"`. For extra credit, this statement could be embedded in any
resource, provisioner, data source. When the work of the resource, etc. is
happening, the log message will be generated. For double extra credit, this log
statement could have a condition clause after the message, so the logging
happens if the condition is true.
3) Amend the data source *external* so that output from the external command
can be used to indicate any desired logging. Like a json string:
{ "log": "my message bla bla" }.
The text was updated successfully, but these errors were encountered:
Current Terraform Version
Use-cases
maybe some other info
As an example, I have a module which optionally creates a zip archive. I would
like to know whether a zip file has been created/updated. Here is the transcript
I see from tf apply:
The text was updated successfully, but these errors were encountered: