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, 7 months agoNunyabiznes
Highly Voted 3 months agogargaditya
Most Recent 3 months agoMolly1994
7 months agoenook
11 months, 2 weeks agogofavad926
1 year, 3 months agoJayanth
1 year, 5 months agoBusi57
1 year, 5 months agogspb
1 year, 8 months agoSaifwsm
1 year, 8 months agoE_aws
1 year, 12 months agoE_aws
1 year, 12 months agoterraform
1 year, 12 months agoSm1ley
2 years, 1 month agoalifie
2 years, 2 months agoEltooth
2 years, 6 months agomk1708
2 years, 6 months agocytron
2 years, 6 months ago