Terraform uses the value from the environment variable TF_LOG to define the LOG level. Available values are TRACE, DEBUG, INFO, WARN or ERROR. Additionally, you can specify a destination file for the log by setting the environment variable TF_LOG_PATH to the full path of the desired destination.
Set the debug variables and execute the Terraform plan to see the output:
$export TF_LOG=DEBUG $# Optional export TF_LOG_PATH=~/debug.txt $terraform plan 2020/07/31 20:19:01 [WARN] Log levels other than TRACE are currently unreliable, and are supported only for backward compatibility. Use TF_LOG=TRACE to see Terraform's internal logs. ---- 2020/07/31 20:19:01 [INFO] Terraform version: 0.12.26 2020/07/31 20:19:01 [INFO] Go runtime version: go1.12.13 2020/07/31 20:19:01 [INFO] CLI args: []string{"/usr/bin/terraform", "plan"} 2020/07/31 20:19:01 [DEBUG] Attempting to open CLI config file: /home/jruiz/.terraformrc 2020/07/31 20:19:01 [DEBUG] File doesn't exist, but doesn't need to. Ignoring. 2020/07/31 20:19:01 [INFO] CLI command args: []string{"plan"} 2020/07/31 20:19:01 [WARN] Log levels other than TRACE are currently unreliable, and are supported only for backward compatibility. Use TF_LOG=TRACE to see Terraform's internal logs. ---- 2020/07/31 20:19:01 [DEBUG] New state was assigned lineage "cc420085-6d12-cb64-c041-a0ed135c58ed" 2020/07/31 20:19:01 [DEBUG] checking for provider in "." 2020/07/31 20:19:01 [DEBUG] checking for provider in "/usr/bin" 2020/07/31 20:19:01 [DEBUG] checking for provider in ".terraform/plugins/linux_amd64" 2020/07/31 20:19:01 [DEBUG] found provider "terraform-provider-aws_v2.67.0_x4" 2020/07/31 20:19:01 [DEBUG] found provider "terraform-provider-external_v1.2.0_x4" 2020/07/31 20:19:01 [DEBUG] found valid plugin: "aws", "2.67.0", "/home/jruiz/git/github/terraform-aws-ec2-rds-basic-free/.terraform/plugins/linux_amd64/terraform-provider-aws_v2.67.0_x4" 2020/07/31 20:19:01 [DEBUG] found valid plugin: "external", "1.2.0", "/home/jruiz/git/github/terraform-aws-ec2-rds-basic-free/.terraform/plugins/linux_amd64/terraform-provider-external_v1.2.0_x4" 2020/07/31 20:19:01 [DEBUG] checking for provisioner in "." 2020/07/31 20:19:01 [DEBUG] checking for provisioner in "/usr/bin" 2020/07/31 20:19:01 [DEBUG] checking for provisioner in ".terraform/plugins/linux_amd64" 2020/07/31 20:19:01 [INFO] backend/local: starting Plan operation ... 2020/07/31 20:19:30 [DEBUG] ProviderTransformer: "module.aws_sg_rds_mariadb_pro_pub_01.aws_security_group.default" (*terraform.NodeValidatableResource) needs provider.aws 6.aws_subnet.default - *terraform.NodeValidatableResource provider.aws - *terraform.NodeApplyableProvider module.aws_sn_zb_pro_pub_36.output.id - *terraform.NodeApplyableOutput module.aws_sn_zb_pro_pub_36.var.az - *terraform.NodeApplyableModuleVariable module.aws_sn_zb_pro_pub_36.var.cidr - *terraform.NodeApplyableModuleVariable module.aws_sn_zb_pro_pub_36.var.description - *terraform.NodeApplyableModuleVariable module.aws_sn_zb_pro_pub_36.var.name - *terraform.NodeApplyableModuleVariable module.aws_sn_zb_pro_pub_36.var.public - *terraform.NodeApplyableModuleVariable module.aws_sn_zb_pro_pub_36.var.vpc_id - *terraform.NodeApplyableModuleVariable module.aws_sr_ec2_default_internet_to_ssh.aws_security_group_rule.default - *terraform.NodeValidatableResource .... 2020/07/31 20:19:30 [DEBUG] ProviderTransformer: "module.aws_sg_rds_mariadb_pro_pub_01.aws_security_group.default" (*terraform.NodeValidatableResource) needs provider.aws 6.aws_subnet.default - *terraform.NodeValidatableResource provider.aws - *terraform.NodeApplyableProvider module.aws_sn_zb_pro_pub_36.output.id - *terraform.NodeApplyableOutput module.aws_sn_zb_pro_pub_36.var.az - *terraform.NodeApplyableModuleVariable module.aws_sn_zb_pro_pub_36.var.cidr - *terraform.NodeApplyableModuleVariable module.aws_sn_zb_pro_pub_36.var.description - *terraform.NodeApplyableModuleVariable module.aws_sn_zb_pro_pub_36.var.name - *terraform.NodeApplyableModuleVariable module.aws_sn_zb_pro_pub_36.var.public - *terraform.NodeApplyableModuleVariable module.aws_sn_zb_pro_pub_36.var.vpc_id - *terraform.NodeApplyableModuleVariable module.aws_sr_ec2_default_internet_to_ssh.aws_security_group_rule.default - *terraform.NodeValidatableResource ...
Use the terraform state command to inspect the current state of your infrastructure. This can help you identify any issues with resource creation or modification.
terraform state list
The Terraform console command allows you to interactively evaluate expressions and query data from your Terraform configuration and state. Access the console and evaluate expressions or inspect resources.
terraform console module.aws_sn_zb_pro_pub_36.var.vpc_id
The command is used to generate a visual representation of a configuration or an execution plan.
terraform graph | dot -Tsvg > graph.svg