File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11provider "aws" {
22 region = " us-east-1"
33}
4-
5- resource "aws_key_pair" "deployer" {
6- key_name = " ec2"
7- public_key = var. public_key
8- }
9-
104resource "aws_instance" "react_app" {
115 ami = var. ami_id
126 instance_type = var. instance_type
13- key_name = aws_key_pair . deployer . key_name
7+ key_name = var . key_name
148 associate_public_ip_address = true
159
1610 tags = {
Original file line number Diff line number Diff line change 1- variable "public_key" {
2- type = string
3- description = " public SSH key"
4- }
5-
61variable "ami_id" {
72 description = " AMI ID for EC2 (Ubuntu)"
83 default = " ami-020cba7c55df1f615"
@@ -11,4 +6,10 @@ variable "ami_id" {
116variable "instance_type" {
127 description = " EC2 instance type"
138 default = " t2.nano"
9+ }
10+
11+ variable "key_name" {
12+ description = " Key pair name in AWS"
13+ default = " ec2"
14+
1415}
You can’t perform that action at this time.
0 commit comments