Providers

▪ Plugins Terraform uses to manage the resources

▪ Providers expose resources for specific infrastructure platform (e.g. AWS)

Responsible for understanding API of that platform

▪ Just code that knows how to talk to specific technology or platform

Provision AWS EC2 Instance Using Terraform

Create a working directory for this Terraform demo.

geekflare@geekflare:~$ mkdir terraform_demo

Go to the directory and create a terraform configuration file where you define the provider and resources to launch an AWS EC2 instance.

geekflare@geekflare:~$ cd terraform_demo/
geekflare@geekflare:~/terraform_demo$ gedit awsec2.tf

provider "aws" {
access_key = "B5KG6Fe5GUKIATUF5UD"
secret_key = "R4gb65y56GBF6765ejYSJA4YtaZ+T6GY7H"
region = "us-west-2"
}

resource "aws_instance" "terraform_demo" {
ami = "ami-0a634ae95e11c6f91"
instance_type = "t2.micro"
}

terraform init

Now, the first step is to initialize terraform.

geekflare@geekflare:~/terraform_demo$ terraform init

Initializing the backend...

Last updated