What does Terraform not reference when running a terraform apply -refresh-only?
What does Terraform not reference when running a terraform apply -refresh-only?
When running a terraform apply -refresh-only, Terraform updates its state file to reflect the real-time state of resources in the cloud provider without applying any changes defined in configuration files. This means Terraform does not reference the resource definitions in the configuration files during this process.
The -refresh-only flag tells Terraform to skip the resource creation and update steps and only update the state file with the current state of resources in the cloud provider. This means that Terraform will not reference the resource definitions in the configuration files, since it is not applying any changes to the cloud provider based on those definitions.
Basic english. Credentials is not related to this feature as it is required for every options in terraform. For this option, all the other three are referred internally
A. Credentials When running terraform apply -refresh-only, Terraform does not reference credentials. The -refresh-only flag is used to perform a refresh of the state without making any changes to the actual resources in the cloud provider. During this operation, Terraform retrieves the current state of the resources from the cloud provider, updates the state file with the latest information, but it does not perform any actions that require credentials (e.g., creating, modifying, or deleting resources). The -refresh-only flag is useful when you want to synchronize Terraform's understanding of the resources with the real state in the cloud provider without performing any destructive actions. It allows you to update the state file with the latest resource information without making any changes to the infrastructure.
I'll go with C
this command is depreciated seemingly because of credentials. Kinda indicates that it touches the credentials doesn't it.... I'm going with C Warning: This command is deprecated, because its default behavior is unsafe if you have misconfigured credentials for any of your providers. See below for more information and recommended alternatives. https://developer.hashicorp.com/terraform/cli/commands/refresh
The -refresh-only flag ensures that Terraform only performs a refresh of the state without making changes to the infrastructure. During the refresh, Terraform compares the current state of the infrastructure with the resource definitions in the configuration files to identify any differences.
The -refresh-only flag is used to refresh the state of resources without making any changes. It ensures that Terraform has the latest information about the existing resources in the cloud, but it doesn't involve credentials or make any modifications to the resources. Credentials are typically required during resource provisioning or modifications, not during a refresh operation.
https://developer.hashicorp.com/terraform/tutorials/state/refresh