A secure string is not a valid option to keep secrets out of Terraform configuration files. A secure string is a feature of AWS Systems Manager Parameter Store that allows you to store sensitive data encrypted with a KMS key. However, Terraform does not support secure strings natively and requires a custom data source to retrieve them. The other options are valid ways to keep secrets out of Terraform configuration files. A Terraform provider can expose secrets as data sources that can be referenced in the configuration. Environment variables can be used to set values for input variables that contain secrets. A -var flag can be used to pass values for input variables that contain secrets from the command line or a file. References = [AWS Systems Manager Parameter Store], [Terraform AWS Provider Issue #55], [Terraform Providers], [Terraform Input Variables]
Question # 75
Which Terraform command checks that your configuration syntax is correct?
The terraform validate command is used to check that your Terraform configuration files are syntactically valid and internally consistent. It is a useful command for ensuring your Terraform code is error-free before applying any changes to your infrastructure.
Question # 76
terraform validate uses provider APIs to verify your infrastructure settings.
terraform validateonlychecks the configuration’s syntax and internal consistency—itdoes notinteract with provider APIs or check if the infrastructure settings are correct.
It ensures that the Terraform code is syntactically correct and follows proper HCL structure.
However, it doesnotverify if resources are valid according to the provider API or if the credentials are correct.
To verify actual infrastructure settings, use terraform plan, which interacts with the provider APIs.
Official Terraform Documentation Reference:
terraform validate - HashiCorp Documentation
Question # 77
If you update the version constraint in your Terraform configuration, Terraform will update your lock file the next time you run terraform Init.
If you update the version constraint in your Terraform configuration, Terraform will update your lock file the next time you run terraform init3. This will ensure that you use the same provider versions across different machines and runs.