QuestionQ98

Core Terraform workflow

After you create a new Terraform configuration, it passes terraform validate but returns an “Access Denied” error from the cloud provider when you run terraform plan.

Why did validate not detect this problem?

  • A The working directory was not initialized, so the cloud provider plugin wasn’t available to use when running the terraform validate command.
  • B The remote backend wasn’t configured, so terraform validate couldn’t load the state and detect the missing credentials.
  • C terraform validate only checks if a configuration is syntactically correct and internally consistent, and does not communicate with providers.
  • D Variables are only applied and validated during a terraform plan, so validate assumed defaults and returned the success message.
Explanation

terraform validate checks whether a configuration is syntactically valid and internally consistent, but it does not validate remote services such as provider APIs. Cloud-provider authentication and authorization are therefore evaluated during terraform plan, when Terraform needs to interact with the provider.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!