How do you configure a provider such as AWS?
BeginnerConceptProviders, Resources and Data Sources
Answer
Declare it in required_providers and add a provider block for settings like region. Credentials should come from the environment, shared config, SSO or an assumed role, never from literals in code.
provider "aws" {
region = "ap-south-1"
default_tags { tags = { ManagedBy = "terraform" } }
}
More on Providers, Resources and Data Sources
What is a resource block and how is it addressed?BeginnerWhat is the difference between a resource and a data source?BeginnerHow do you use the same provider with multiple regions or accounts?IntermediateIn what order does the AWS provider look for credentials?IntermediateWhat does `default_tags` in the AWS provider do and what are its pitfalls?IntermediateWhat is the difference between arguments and attributes?Beginner