File tree 7 files changed +92
-0
lines changed
7 files changed +92
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
1
+ output "id_instance" {
2
+ value = aws_instance. ec2 . id
3
+ }
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments