Terraform to attach a security group to an EC2 instance
Terraform to attach a security group to an EC2 instance
```hcl
provider "aws" {
region = "us-east-1" # Update with your desired region
}
After saving the above code in a `.tf` file, you can run `terraform init`,
`terraform plan`, and `terraform apply` commands in the directory where the file is
located to create the EC2 instance with the specified security group attached.