Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v012 is finished #23

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
locals {
service_name = "teset"
owner = "DevOps Team"
created_by = "terraform22"
}
53 changes: 29 additions & 24 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,30 +1,15 @@
module "ec2_babak" {
source = "./module/ec2"

instance_name = "v011"
key_name = "dvh"
}


module "ec2_babak2" {
source = "./module/ec2"

instance_name = "v011_2"
key_name = "dvh"
resource "aws_instance" "babak" {
ami = var.ami_id
instance_type = var.instance_type
key_name = var.key_name
count = 4
tags = {
Name = "babak-${var.env_name[count.index]}"
Created_By = local.created_by
}
}



# resource "aws_instance" "babak" {
# ami = var.ami_id
# instance_type = var.instance_type
# key_name = var.key_name

# tags = {
# Name = var.machine_name
# Created_By = "terraform"
# }
# }
# resource "aws_instance" "babak2" {
# ami = "ami-08cd358d745620807"

Expand All @@ -35,6 +20,26 @@ module "ec2_babak2" {
# Name = "Airflow"
# }
# }


# module "ec2_babak" {
# source = "./module/ec2"

# instance_name = "v011"
# key_name = "dvh"
# }


# module "ec2_babak2" {
# source = "./module/ec2"

# instance_name = "v011_2"
# key_name = "dvh"
# }




# terraform import aws_instance.babak3 i-01836e088c5f7f783
# resource "aws_instance" "babak3" {
# ami = "ami-086b3de06dafe36c5"
Expand Down
12 changes: 6 additions & 6 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
output "ec2_babak_puplic_dns" {
value = module.ec2_babak.ec2_public_dns
}
output "ec2_babak_puplic_ip" {
value = module.ec2_babak.ec2_public_ip
}
# output "ec2_babak_puplic_dns" {
# value = module.ec2_babak.ec2_public_dns
# }
# output "ec2_babak_puplic_ip" {
# value = module.ec2_babak.ec2_public_ip
# }
1 change: 1 addition & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ variable "ami_id" {
variable "instance_type" {}
variable "key_name" {}
variable "machine_name" {}
variable "env_name" {default=["build","stage","dev","prod"]}