Hi,
I am using the below configuration, to create the was resources. But I see, except instance, all the other resources, such as VPC, Subnet are not getting created. Can anybody, let me know, what’s the issue in the below configuration.
terraform {
required_providers {
aws = {
source = “hashicorp/aws”
version = “3.70.0”
}
}
}
provider “aws” {
region = “us-east-2”
access_key = “#######”
secret_key = “#########”
# Configuration options
}
resource “aws_vpc” “myvpc” {
cidr_block = “10.0.0.0/16”
instance_tenancy = “default”
}
resource “aws_subnet” “pubilcsubnet” {
vpc_id = aws_vpc.myvpc.id
cidr_block = “10.0.1.0/24”
availability_zone = “us-east-2”
}
resource “aws_instance” “sweb” {
ami = “ami-002068ed284fb165b”
instance_type = “t2.micro”
associate_public_ip_address = true
network_interface {
network_interface_id = aws_network_interface.snetworkinterface.id
device_index = 0
}
}
resource “aws_network_interface” “snetworkinterface” {
subnet_id = aws_subnet.pubilcsubnet.id
private_ips = [“10.0.0.50”]
security_groups = [aws_security_group.web.id]
}