Skip to content

Commit 4d3f41e

Browse files
committed
module 1 fini
1 parent 12e27f1 commit 4d3f41e

7 files changed

+92
-0
lines changed

.terraform.lock.hcl

+24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

main.tf

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module "ec2" {
2+
source = "./modules/ec2"
3+
nom_instance = var.nom_instance
4+
type = var.type
5+
user_data = var.user_data
6+
nom_role = var.nom_role
7+
}

modules/ec2/locals.tf

Whitespace-only changes.

modules/ec2/outputs.tf

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
output "id_instance" {
2+
value = aws_instance.ec2.id
3+
}

modules/ec2/resources.tf

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
data "aws_ami" "amazon_linux" {
2+
most_recent = true
3+
owners = ["amazon"]
4+
5+
filter {
6+
name = "name"
7+
values = ["amzn2-ami-hvm-*-x86_64-gp2"]
8+
}
9+
}
10+
11+
resource "aws_instance" "ec2" {
12+
ami = data.aws_ami.amazon_linux.id
13+
instance_type = var.type
14+
iam_instance_profile = "EC2InstanceRole"
15+
user_data = var.user_data
16+
17+
tags = {
18+
Name = var.nom_instance
19+
}
20+
}

modules/ec2/variables.tf

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
variable "nom_instance" {
2+
description = "Nom de l'instance EC2"
3+
type = string
4+
}
5+
6+
variable "type" {
7+
description = "Type de l'instance EC2"
8+
type = string
9+
}
10+
11+
variable "user_data" {
12+
description = "Script de démarrage de l'instance EC2"
13+
type = string
14+
}
15+
16+
variable "nom_role" {
17+
description = "Nom du role de l'instance EC2"
18+
type = string
19+
}

variables.tf

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
variable "nom_instance" {
2+
description = "Nom de l'instance EC2"
3+
type = string
4+
}
5+
6+
variable "type" {
7+
description = "Type de l'instance EC2"
8+
type = string
9+
}
10+
11+
variable "user_data" {
12+
description = "Script de démarrage de l'instance EC2"
13+
type = string
14+
}
15+
16+
variable "nom_role" {
17+
description = "Nom du role de l'instance EC2"
18+
type = string
19+
}

0 commit comments

Comments
 (0)