Terraform script

0 votes

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 .

  1. 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

Jan 19, 2023 in AWS by Tejashwini
• 3,820 points

edited 5 days ago 14 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP