In Terraform, a provider is responsible for managing resources of a particular type or a specific cloud service. In the given example, the resource type is aws_vpc which belongs to the AWS cloud platform, so the provider is specified as aws.
Therefore, the correct code snippet with the provider block would be:
provider "aws" {
region = "us-west-2"
}
resource "aws_vpc" "main" {
name = "test"
}
Each resource block describes one or more infrastructure objects, such as virtual networks, compute instances, or higher-level components such as DNS records.
A resource block declares a resource of a given type ("aws_instance") with a given local name ("web"). The name is used to refer to this resource from elsewhere in the same Terraform module, but has no significance outside that module's scope.
The resource type and name together serve as an identifier for a given resource and so must be unique within a module.
Terraform usually automatically determines which provider to use based on a resource type's name. (By convention, resource type names start with their provider's preferred local name.)
eg.
resource "aws_instance" "web" {
ami = "ami-a1b2c3d4"
instance_type = "t2.micro"
}
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
softarts
Highly Voted 2 years, 6 months agoNunyabiznes
Highly Voted 1 month, 4 weeks agogargaditya
Most Recent 1 month, 4 weeks agoMolly1994
5 months, 3 weeks agoenook
10 months, 1 week agogofavad926
1 year, 1 month agoJayanth
1 year, 3 months agoBusi57
1 year, 4 months agogspb
1 year, 6 months agoSaifwsm
1 year, 7 months agoE_aws
1 year, 10 months agoE_aws
1 year, 10 months agoterraform
1 year, 10 months agoSm1ley
2 years agoalifie
2 years, 1 month agoEltooth
2 years, 4 months agomk1708
2 years, 5 months agocytron
2 years, 5 months ago