Created an EC2 instance using terraform,now I want to modify the instance type without manual intervention. automatically it should change using wrapper script.
Example I launched an AWS ec2 instance using terraform with basic configuration like instance type,number of instance like that. But when I want to change instances count from one to 2 Or to change any configuration I'm doing manually by editing the terraform code .
- I wanted to automate that phase by wrappr script
Main.tf
terraform { required_providers { aws = { source = "hashicorp/aws" } } resource "aws_instance" "" { ami = var.ami instance_type = var.instance_type
network_interface { network_interface_id = var.network_interface_id device_index = 0 } credit_specification { cpu_credits = "unlimited" } }
Var.tf
variable "network_interface_id" { type = string default = "network_id_from_aws" }
variable "ami" { type = string default = "ami-005e54dee72cc1d00" }
variable "instance_type" { type = string default = "t2.micro" }
Here I wanted to modify "instance type" t2. Micro to t2.large. automatically withoutght manually going inside var.tf file