From d5c8bb24a0d7f38c3406263bc41b0b68bbf5f1e8 Mon Sep 17 00:00:00 2001 From: Cedric Girard Date: Wed, 13 May 2020 10:45:51 +0200 Subject: [PATCH] module variable --- module1/module1.tf | 7 +++++-- project4/base.tf | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/module1/module1.tf b/module1/module1.tf index e4c8ec4..afb435f 100644 --- a/module1/module1.tf +++ b/module1/module1.tf @@ -2,11 +2,14 @@ provider "aws" { region = "eu-west-2" } -resource "aws_instance" "cedric-instance1" { +variable "instance_name" {} + +resource "aws_instance" "instance1" { ami = "ami-01a6e31ac994bbc09" instance_type = "t2.micro" key_name = "cedric" tags = { - Name = "cedric-module-instance1" + Name = "${var.instance_name}" } } + diff --git a/project4/base.tf b/project4/base.tf index be928a2..5890572 100644 --- a/project4/base.tf +++ b/project4/base.tf @@ -1,3 +1,4 @@ module "my_module" { source = "../module1" + instance_name = "cedric-instance1" }