How to find default values for optional fields

Terraform documentation lacks definition of default values for optional fields. For example aws_neptune_cluster.enable_cloudwatch_logs_exports

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/neptune_cluster#enable_cloudwatch_logs_exports

How can I find default values for any optional field?

For aws_neptune_cluster’s enable_cloudwatch_logs_exports argument (a list of strings) specifically, it does not have a default value defined, which means that the attribute is not provided to the AWS API and would thus be left to whatever default behavior it has. I usually would double check the API Reference to see if there is more information. In this case there isn’t, so I am going to guess that non of the log types are exported the CloudWatch Logs.

In general, if there is a specific default value set by the resource, it would be documented in the resource documentation. Otherwise it depends on the data type and the associated zero values (especially for resources that still use the Terraform Plugin SDK), as well as handling in the resource code. I could be missing some nuances and contexts, but this is my general experience working with the AWS Terraform Provider for a while as an end-user and contributor.

Hope this helps.