You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by dm...@apache.org on 2019/07/17 08:59:43 UTC

[incubator-dlab] 01/02: [DLAB-795] Refactored and added tags to resources

This is an automated email from the ASF dual-hosted git repository.

dmysakovets pushed a commit to branch DLAB-795
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git

commit 6c69ec8644f31dac8b95f78efb0ed4d94de9ef25
Author: Dyoma33 <de...@gmail.com>
AuthorDate: Wed Jul 17 10:47:12 2019 +0300

    [DLAB-795] Refactored and added tags to resources
---
 .../data_engine/main/main.tf                       | 21 -----
 .../aws/computational_resources/emr/main/main.tf   |  0
 .../aws/computational_resources/main/main.tf       | 97 ++++++++++++++++++++++
 .../aws/computational_resources/main/variables.tf  | 57 +++++++++++++
 .../{ami/main => modules/ami}/ami.tf               | 15 ++++
 .../{ami/main => modules/ami}/variables.tf         | 15 +++-
 .../{common/main => modules/common}/iam.tf         | 27 +++---
 .../{common/main => modules/common}/network.tf     | 27 ++++--
 .../{common/main => modules/common}/variables.tf   |  4 +
 .../main => modules/data_engine}/instance.tf       | 22 +++--
 .../main => modules/data_engine}/variables.tf      | 12 +--
 .../{emr/main => modules/emr}/instance.tf          | 12 +--
 .../{emr/main => modules/emr}/variables.tf         |  8 +-
 .../main => modules/notebook}/instance.tf          | 22 ++---
 .../main => modules/notebook}/variables.tf         |  8 +-
 .../computational_resources/notebooks/main/main.tf |  0
 16 files changed, 276 insertions(+), 71 deletions(-)

diff --git a/infrastructure-provisioning/terraform/aws/computational_resources/data_engine/main/main.tf b/infrastructure-provisioning/terraform/aws/computational_resources/data_engine/main/main.tf
deleted file mode 100644
index 39191b2..0000000
--- a/infrastructure-provisioning/terraform/aws/computational_resources/data_engine/main/main.tf
+++ /dev/null
@@ -1,21 +0,0 @@
-# *****************************************************************************
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-# ******************************************************************************
-
diff --git a/infrastructure-provisioning/terraform/aws/computational_resources/emr/main/main.tf b/infrastructure-provisioning/terraform/aws/computational_resources/emr/main/main.tf
deleted file mode 100644
index e69de29..0000000
diff --git a/infrastructure-provisioning/terraform/aws/computational_resources/main/main.tf b/infrastructure-provisioning/terraform/aws/computational_resources/main/main.tf
new file mode 100644
index 0000000..dc64e32
--- /dev/null
+++ b/infrastructure-provisioning/terraform/aws/computational_resources/main/main.tf
@@ -0,0 +1,97 @@
+provider "aws" {
+  access_key = "${var.access_key_id}"
+  secret_key = "${var.secret_access_key}"
+  region     = "${var.region}"
+}
+
+module "common" {
+  source        = "../modules/common"
+  sbn           = "${var.service_base_name}"
+  project_name  = "${var.project_name}"
+  project_tag   = "${var.project_tag}"
+  endpoint_tag  = "${var.endpoint_tag}"
+  user_tag      = "${var.user_tag}"
+  custom_tag    = "${var.custom_tag}"
+  notebook_name = "${var.notebook_name}"
+  region        = "${var.region}"
+  zone          = "${var.zone}"
+  product       = "${var.product_name}"
+  vpc           = "${var.vpc_id}"
+  cidr_range    = "${var.cidr_range}"
+  traefik_cidr  = "${var.traefik_cidr}"
+  instance_type = "${var.instance_type}"
+}
+
+module "notebook" {
+  source           = "../modules/notebook"
+  sbn              = "${var.service_base_name}"
+  project_name     = "${var.project_name}"
+  project_tag      = "${var.project_tag}"
+  endpoint_tag     = "${var.endpoint_tag}"
+  user_tag         = "${var.user_tag}"
+  custom_tag       = "${var.custom_tag}"
+  notebook_name    = "${var.notebook_name}"
+  subnet_id        = "${var.subnet_id}"
+  nb-sg_id         = "${var.nb-sg_id}"
+  iam_profile_name = "${var.iam_profile_name}"
+  product          = "${var.product_name}"
+  ami              = "${var.ami}"
+  instance_type    = "${var.instance_type}"
+  key_name         = "${var.key_name}"
+}
+
+module "data_engine" {
+  source           = "../modules/data_engine"
+  sbn              = "${var.service_base_name}"
+  project_name     = "${var.project_name}"
+  project_tag      = "${var.project_tag}"
+  endpoint_tag     = "${var.endpoint_tag}"
+  user_tag         = "${var.user_tag}"
+  custom_tag       = "${var.custom_tag}"
+  notebook_name    = "${var.notebook_name}"
+  subnet_id        = "${var.subnet_id}"
+  nb-sg_id         = "${var.nb-sg_id}"
+  iam_profile_name = "${var.iam_profile_name}"
+  product          = "${var.product_name}"
+  ami              = "${var.ami}"
+  instance_type    = "${var.instance_type}"
+  key_name         = "${var.key_name}"
+  cluster_name     = "${var.cluster_name}"
+  slave_count      = "${var.slave_count}"
+}
+
+module "emr" {
+  source           = "../modules/emr"
+  sbn              = "${var.service_base_name}"
+  project_name     = "${var.project_name}"
+  project_tag      = "${var.project_tag}"
+  endpoint_tag     = "${var.endpoint_tag}"
+  user_tag         = "${var.user_tag}"
+  custom_tag       = "${var.custom_tag}"
+  notebook_name    = "${var.notebook_name}"
+  subnet_id        = "${var.subnet_id}"
+  nb-sg_id         = "${var.nb-sg_id}"
+  iam_profile_name = "${var.iam_profile_name}"
+  product          = "${var.product_name}"
+  ami              = "${var.ami}"
+  emr_template     = "${var.emr_template}"
+  master_shape     = "${var.master_shape}"
+  slave_shape      = "${var.slave_shape}"
+  key_name         = "${var.key_name}"
+  cluster_name     = "${var.cluster_name}"
+  instance_count   = "${var.instance_count}"
+  bid_price        = "${var.bid_price}"
+}
+
+module "ami" {
+  source             = "../modules/ami"
+  sbn                = "${var.service_base_name}"
+  project_name       = "${var.project_name}"
+  source_instance_id = "${var.source_instance_id}"
+  project_tag        = "${var.project_tag}"
+  notebook_name      = "${var.notebook_name}"
+  product            = "${var.product_name}"
+  endpoint_tag       = "${var.endpoint_tag}"
+  user_tag           = "${var.user_tag}"
+  custom_tag         = "${var.custom_tag}"
+}
\ No newline at end of file
diff --git a/infrastructure-provisioning/terraform/aws/computational_resources/main/variables.tf b/infrastructure-provisioning/terraform/aws/computational_resources/main/variables.tf
new file mode 100644
index 0000000..13f0d25
--- /dev/null
+++ b/infrastructure-provisioning/terraform/aws/computational_resources/main/variables.tf
@@ -0,0 +1,57 @@
+variable "access_key_id" {}
+
+variable "secret_access_key" {}
+
+variable "service_base_name" {}
+
+variable "project_name" {}
+
+variable "project_tag" {}
+
+variable "endpoint_tag" {}
+
+variable "user_tag" {}
+
+variable "custom_tag" {}
+
+variable "notebook_name" {}
+
+variable "region" {}
+
+variable "zone" {}
+
+variable "product_name" {}
+
+variable "vpc_id" {}
+
+variable "subnet_id" {}
+
+variable "nb-sg_id" {}
+
+variable "iam_profile_name" {}
+
+variable "cidr_range" {}
+
+variable "traefik_cidr" {}
+
+variable "ami" {}
+
+variable "instance_type" {}
+
+variable "key_name" {}
+
+variable "cluster_name" {}
+
+variable "slave_count" {}
+
+variable "emr_template" {}
+
+variable "master_shape" {}
+
+variable "slave_shape" {}
+
+variable "instance_count" {}
+
+variable "bid_price" {}
+
+variable "source_instance_id" {}
\ No newline at end of file
diff --git a/infrastructure-provisioning/terraform/aws/computational_resources/ami/main/ami.tf b/infrastructure-provisioning/terraform/aws/computational_resources/modules/ami/ami.tf
similarity index 71%
rename from infrastructure-provisioning/terraform/aws/computational_resources/ami/main/ami.tf
rename to infrastructure-provisioning/terraform/aws/computational_resources/modules/ami/ami.tf
index 4d39a32..30d150f 100644
--- a/infrastructure-provisioning/terraform/aws/computational_resources/ami/main/ami.tf
+++ b/infrastructure-provisioning/terraform/aws/computational_resources/modules/ami/ami.tf
@@ -19,7 +19,22 @@
 #
 # ******************************************************************************
 
+locals {
+  ami_name = "${var.sbn}-ami"
+}
+
 resource "aws_ami_from_instance" "ami" {
   name               = "${var.project_tag}-${var.notebook_name}-ami"
   source_instance_id = "${var.source_instance_id}"
+  tags {
+    Name             = "${local.ami_name}"
+    "${var.sbn}-Tag" = "${local.ami_name}"
+    Product          = "${var.product}"
+    Project_name     = "${var.project_name}"
+    Project_tag      = "${var.project_tag}"
+    Endpoint_tag     = "${var.endpoint_tag}"
+    "user:tag"       = "${var.sbn}:${local.ami_name}"
+    User_tag         = "${var.user_tag}"
+    Custom_tag       = "${var.custom_tag}"
+  }
 }
\ No newline at end of file
diff --git a/infrastructure-provisioning/terraform/aws/computational_resources/ami/main/variables.tf b/infrastructure-provisioning/terraform/aws/computational_resources/modules/ami/variables.tf
similarity index 85%
rename from infrastructure-provisioning/terraform/aws/computational_resources/ami/main/variables.tf
rename to infrastructure-provisioning/terraform/aws/computational_resources/modules/ami/variables.tf
index 8dff8af..0402960 100644
--- a/infrastructure-provisioning/terraform/aws/computational_resources/ami/main/variables.tf
+++ b/infrastructure-provisioning/terraform/aws/computational_resources/modules/ami/variables.tf
@@ -19,8 +19,21 @@
 #
 # ******************************************************************************
 
+
+variable "project_name" {}
+
+variable "sbn" {}
+
 variable "source_instance_id" {}
 
 variable "project_tag" {}
 
-variable "notebook_name" {}
\ No newline at end of file
+variable "notebook_name" {}
+
+variable "product" {}
+
+variable "endpoint_tag" {}
+
+variable "user_tag" {}
+
+variable "custom_tag" {}
\ No newline at end of file
diff --git a/infrastructure-provisioning/terraform/aws/computational_resources/common/main/iam.tf b/infrastructure-provisioning/terraform/aws/computational_resources/modules/common/iam.tf
similarity index 77%
rename from infrastructure-provisioning/terraform/aws/computational_resources/common/main/iam.tf
rename to infrastructure-provisioning/terraform/aws/computational_resources/modules/common/iam.tf
index f292948..dff7f3f 100644
--- a/infrastructure-provisioning/terraform/aws/computational_resources/common/main/iam.tf
+++ b/infrastructure-provisioning/terraform/aws/computational_resources/modules/common/iam.tf
@@ -20,9 +20,9 @@
 # ******************************************************************************
 
 locals {
-  role_name    = "${var.project_tag}-nb-de-Role"
-  role_profile = "${var.project_tag}-nb-Profile"
-  policy_name  = "${var.project_tag}-strict_to_S3-Policy"
+  role_name    = "${var.sbn}-nb-de-Role"
+  role_profile = "${var.sbn}-nb-Profile"
+  policy_name  = "${var.sbn}-strict_to_S3-Policy"
 }
 
 resource "aws_iam_role" "nb_de_role" {
@@ -44,9 +44,16 @@ resource "aws_iam_role" "nb_de_role" {
 EOF
 
   tags = {
-    product = "${var.product}"
-    Name = "${local.role_name}"
-    environment_tag = "${var.project_tag}"
+    Name            = "${local.role_name}"
+    Environment_tag = "${var.sbn}"
+    "${var.sbn}-Tag" = "${local.role_name}"
+    Product          = "${var.product}"
+    Project_name     = "${var.project_name}"
+    Project_tag      = "${var.project_tag}"
+    Endpoint_tag     = "${var.endpoint_tag}"
+    "user:tag"       = "${var.sbn}:${local.role_name}"
+    User_tag         = "${var.user_tag}"
+    Custom_tag       = "${var.custom_tag}"
   }
 }
 
@@ -76,7 +83,7 @@ resource "aws_iam_policy" "strict_S3_policy" {
                 "s3:PutEncryptionConfiguration"
             ],
             "Resource": [
-                "arn:aws:s3:::${var.project_tag}*"
+                "arn:aws:s3:::${var.sbn}*"
             ]
         },
         {
@@ -85,7 +92,7 @@ resource "aws_iam_policy" "strict_S3_policy" {
                 "s3:GetObject",
                 "s3:HeadObject"
             ],
-            "Resource": "arn:aws:s3:::${var.project_tag}-ssn-bucket/*"
+            "Resource": "arn:aws:s3:::${var.sbn}-ssn-bucket/*"
         },
         {
             "Effect": "Allow",
@@ -96,8 +103,8 @@ resource "aws_iam_policy" "strict_S3_policy" {
                 "s3:DeleteObject"
             ],
             "Resource": [
-                "arn:aws:s3:::${var.project_tag}-bucket/*",
-                "arn:aws:s3:::${var.project_tag}-shared-bucket/*"
+                "arn:aws:s3:::${var.sbn}-bucket/*",
+                "arn:aws:s3:::${var.sbn}-shared-bucket/*"
             ]
         }
     ]
diff --git a/infrastructure-provisioning/terraform/aws/computational_resources/common/main/network.tf b/infrastructure-provisioning/terraform/aws/computational_resources/modules/common/network.tf
similarity index 63%
rename from infrastructure-provisioning/terraform/aws/computational_resources/common/main/network.tf
rename to infrastructure-provisioning/terraform/aws/computational_resources/modules/common/network.tf
index aedebe3..7c9b713 100644
--- a/infrastructure-provisioning/terraform/aws/computational_resources/common/main/network.tf
+++ b/infrastructure-provisioning/terraform/aws/computational_resources/modules/common/network.tf
@@ -20,8 +20,8 @@
 # ******************************************************************************
 
 locals {
-  subnet_name = "${var.project_tag}-subnet"
-  sg_name     = "${var.project_tag}-nb-sg" #sg - security group
+  subnet_name = "${var.sbn}-subnet"
+  sg_name     = "${var.sbn}-nb-sg" #sg - security group
 }
 
 resource "aws_subnet" "subnet" {
@@ -29,9 +29,15 @@ resource "aws_subnet" "subnet" {
   cidr_block = "${var.cidr_range}"
 
   tags = {
-    Name    = "${local.subnet_name}"
-    Env-Tag = "${local.subnet_name}"
-    product = "${var.product}"
+    Name             = "${local.subnet_name}"
+    "${var.sbn}-Tag" = "${local.subnet_name}"
+    Product          = "${var.product}"
+    Project_name     = "${var.project_name}"
+    Project_tag      = "${var.project_tag}"
+    Endpoint_tag     = "${var.endpoint_tag}"
+    "user:tag"       = "${var.sbn}:${local.subnet_name}"
+    User_tag         = "${var.user_tag}"
+    Custom_tag       = "${var.custom_tag}"
   }
 }
 
@@ -61,7 +67,14 @@ resource "aws_security_group" "nb-sg" {
   }
 
   tags = {
-    Name    = "${local.sg_name}"
-    product = "${var.product}"
+    Name             = "${local.sg_name}"
+    "${var.sbn}-Tag" = "${local.sg_name}"
+    Product          = "${var.product}"
+    Project_name     = "${var.project_name}"
+    Project_tag      = "${var.project_tag}"
+    Endpoint_tag     = "${var.endpoint_tag}"
+    "user:tag"       = "${var.sbn}:${local.sg_name}"
+    User_tag         = "${var.user_tag}"
+    Custom_tag       = "${var.custom_tag}"
   }
 }
\ No newline at end of file
diff --git a/infrastructure-provisioning/terraform/aws/computational_resources/common/main/variables.tf b/infrastructure-provisioning/terraform/aws/computational_resources/modules/common/variables.tf
similarity index 94%
rename from infrastructure-provisioning/terraform/aws/computational_resources/common/main/variables.tf
rename to infrastructure-provisioning/terraform/aws/computational_resources/modules/common/variables.tf
index 12cd779..169b77e 100644
--- a/infrastructure-provisioning/terraform/aws/computational_resources/common/main/variables.tf
+++ b/infrastructure-provisioning/terraform/aws/computational_resources/modules/common/variables.tf
@@ -19,6 +19,10 @@
 #
 # ******************************************************************************
 
+variable "project_name" {}
+
+variable "sbn" {}
+
 variable "project_tag" {}
 
 variable "endpoint_tag" {}
diff --git a/infrastructure-provisioning/terraform/aws/computational_resources/data_engine/main/instance.tf b/infrastructure-provisioning/terraform/aws/computational_resources/modules/data_engine/instance.tf
similarity index 73%
rename from infrastructure-provisioning/terraform/aws/computational_resources/data_engine/main/instance.tf
rename to infrastructure-provisioning/terraform/aws/computational_resources/modules/data_engine/instance.tf
index ad5c17a..6d7d3fe 100644
--- a/infrastructure-provisioning/terraform/aws/computational_resources/data_engine/main/instance.tf
+++ b/infrastructure-provisioning/terraform/aws/computational_resources/modules/data_engine/instance.tf
@@ -20,8 +20,8 @@
 # ******************************************************************************
 
 locals {
-  cluster_name                = "${var.project_tag}-de-${var.notebook_name}-${var.cluster_name}"
-  notebook_name = "${var.project_tag}-nb-${var.notebook_name}"
+  cluster_name  = "${var.sbn}-de-${var.notebook_name}-${var.cluster_name}"
+  notebook_name = "${var.sbn}-nb-${var.notebook_name}"
 }
 
 resource "aws_instance" "master" {
@@ -30,15 +30,18 @@ resource "aws_instance" "master" {
   key_name             = "${var.key_name}"
   subnet_id            = "${var.subnet_id}"
   security_groups      = ["${var.nb-sg_id}"]
-  iam_instance_profile = "${var.note_profile_name}"
+  iam_instance_profile = "${var.iam_profile_name}"
   tags = {
     Name                     = "${local.cluster_name}-m"
     Type                     = "master"
     dataengine_notebook_name = "${local.notebook_name}"
-    "${var.project_tag}-Tag" = "${local.cluster_name}-m"
+    "${var.sbn}-Tag"         = "${local.cluster_name}-m"
+    Product                  = "${var.product}"
+    Project_name             = "${var.project_name}"
+    Project_tag              = "${var.project_tag}"
     User_tag                 = "${var.user_tag}"
     Endpoint_Tag             = "${var.endpoint_tag}"
-    "user:tag"               = "${var.project_tag}:${local.cluster_name}"
+    "user:tag"               = "${var.sbn}:${local.cluster_name}"
     Custom_Tag               = "${var.custom_tag}"
   }
 }
@@ -51,15 +54,18 @@ resource "aws_instance" "slave" {
   key_name             = "${var.key_name}"
   subnet_id            = "${var.subnet_id}"
   security_groups      = ["${var.nb-sg_id}"]
-  iam_instance_profile = "${var.note_profile_name}"
+  iam_instance_profile = "${var.iam_profile_name}"
   tags = {
     Name                     = "${local.cluster_name}-s${count.index + 1}"
     Type                     = "slave"
     dataengine_notebook_name = "${local.notebook_name}"
-    "${var.project_tag}-Tag" = "${local.cluster_name}-s${count.index + 1}"
+    "${var.sbn}-Tag"         = "${local.cluster_name}-s${count.index + 1}"
+    Product                  = "${var.product}"
+    Project_name             = "${var.project_name}"
+    Project_tag              = "${var.project_tag}"
     User_tag                 = "${var.user_tag}"
     Endpoint_Tag             = "${var.endpoint_tag}"
-    "user:tag"               = "${var.project_tag}:${local.cluster_name}"
+    "user:tag"               = "${var.sbn}:${local.cluster_name}"
     Custom_Tag               = "${var.custom_tag}"
   }
 }
\ No newline at end of file
diff --git a/infrastructure-provisioning/terraform/aws/computational_resources/data_engine/main/variables.tf b/infrastructure-provisioning/terraform/aws/computational_resources/modules/data_engine/variables.tf
similarity index 91%
rename from infrastructure-provisioning/terraform/aws/computational_resources/data_engine/main/variables.tf
rename to infrastructure-provisioning/terraform/aws/computational_resources/modules/data_engine/variables.tf
index 6e36f09..c83a942 100644
--- a/infrastructure-provisioning/terraform/aws/computational_resources/data_engine/main/variables.tf
+++ b/infrastructure-provisioning/terraform/aws/computational_resources/modules/data_engine/variables.tf
@@ -19,6 +19,10 @@
 #
 # ******************************************************************************
 
+variable "project_name" {}
+
+variable "sbn" {}
+
 variable "project_tag" {}
 
 variable "endpoint_tag" {}
@@ -31,7 +35,7 @@ variable "notebook_name" {}
 
 variable "product" {}
 
-variable "note_ami" {}
+variable "ami" {}
 
 variable "instance_type" {}
 
@@ -41,10 +45,8 @@ variable "subnet_id" {}
 
 variable "nb-sg_id" {}
 
-variable "note_profile_name" {}
+variable "iam_profile_name" {}
 
 variable "cluster_name" {}
 
-variable "slave_count" {}
-
-variable "ami" {}
\ No newline at end of file
+variable "slave_count" {}
\ No newline at end of file
diff --git a/infrastructure-provisioning/terraform/aws/computational_resources/emr/main/instance.tf b/infrastructure-provisioning/terraform/aws/computational_resources/modules/emr/instance.tf
similarity index 85%
rename from infrastructure-provisioning/terraform/aws/computational_resources/emr/main/instance.tf
rename to infrastructure-provisioning/terraform/aws/computational_resources/modules/emr/instance.tf
index 97d17f9..630834b 100644
--- a/infrastructure-provisioning/terraform/aws/computational_resources/emr/main/instance.tf
+++ b/infrastructure-provisioning/terraform/aws/computational_resources/modules/emr/instance.tf
@@ -20,8 +20,8 @@
 # ******************************************************************************
 
 locals {
-  cluster_name  = "${var.project_tag}-des-${var.notebook_name}-${var.cluster_name}"
-  notebook_name = "${var.project_tag}-nb-${var.notebook_name}"
+  cluster_name  = "${var.sbn}-des-${var.notebook_name}-${var.cluster_name}"
+  notebook_name = "${var.sbn}-nb-${var.notebook_name}"
 }
 
 resource "aws_emr_cluster" "cluster" {
@@ -62,11 +62,13 @@ resource "aws_emr_cluster" "cluster" {
     ComputationalName        = "${var.cluster_name}"
     Name                     = "${local.cluster_name}"
     Notebook                 = "${local.notebook_name}"
-    product                  = "${var.product}"
-    "${var.project_tag}-Tag" = "${local.cluster_name}"
+    Product                  = "${var.product}"
+    "${var.sbn}-Tag"         = "${local.cluster_name}"
+    Project_name             = "${var.project_name}"
+    Project_tag              = "${var.project_tag}"
     User_tag                 = "${var.user_tag}"
     Endpoint_Tag             = "${var.endpoint_tag}"
-    "user:tag"               = "${var.project_tag}:${local.cluster_name}"
+    "user:tag"               = "${var.sbn}:${local.cluster_name}"
     Custom_Tag               = "${var.custom_tag}"
   }
 
diff --git a/infrastructure-provisioning/terraform/aws/computational_resources/emr/main/variables.tf b/infrastructure-provisioning/terraform/aws/computational_resources/modules/emr/variables.tf
similarity index 93%
rename from infrastructure-provisioning/terraform/aws/computational_resources/emr/main/variables.tf
rename to infrastructure-provisioning/terraform/aws/computational_resources/modules/emr/variables.tf
index def16a6..c8c2ae1 100644
--- a/infrastructure-provisioning/terraform/aws/computational_resources/emr/main/variables.tf
+++ b/infrastructure-provisioning/terraform/aws/computational_resources/modules/emr/variables.tf
@@ -19,6 +19,10 @@
 #
 # ******************************************************************************
 
+variable "project_name" {}
+
+variable "sbn" {}
+
 variable "project_tag" {}
 
 variable "endpoint_tag" {}
@@ -31,7 +35,7 @@ variable "notebook_name" {}
 
 variable "product" {}
 
-variable "note_ami" {}
+variable "ami" {}
 
 variable "emr_template" {}
 
@@ -45,7 +49,7 @@ variable "subnet_id" {}
 
 variable "nb-sg_id" {}
 
-variable "note_profile_name" {}
+variable "iam_profile_name" {}
 
 variable "cluster_name" {}
 
diff --git a/infrastructure-provisioning/terraform/aws/computational_resources/notebooks/main/instance.tf b/infrastructure-provisioning/terraform/aws/computational_resources/modules/notebook/instance.tf
similarity index 68%
rename from infrastructure-provisioning/terraform/aws/computational_resources/notebooks/main/instance.tf
rename to infrastructure-provisioning/terraform/aws/computational_resources/modules/notebook/instance.tf
index a9a2737..11e8038 100644
--- a/infrastructure-provisioning/terraform/aws/computational_resources/notebooks/main/instance.tf
+++ b/infrastructure-provisioning/terraform/aws/computational_resources/modules/notebook/instance.tf
@@ -20,23 +20,25 @@
 # ******************************************************************************
 
 locals {
-  node_name = "${var.project_tag}-nb-${var.notebook_name}"
+  node_name = "${var.sbn}-nb-${var.notebook_name}"
 }
 
 resource "aws_instance" "notebook" {
-  ami                  = "${var.note_ami}"
+  ami                  = "${var.ami}"
   instance_type        = "${var.instance_type}"
   key_name             = "${var.key_name}"
   subnet_id            = "${var.subnet_id}"
   security_groups      = ["${var.nb-sg_id}"]
-  iam_instance_profile = "${var.note_profile_name}"
+  iam_instance_profile = "${var.iam_profile_name}"
   tags = {
-    Name                     = "${local.node_name}"
-    "${var.project_tag}-Tag" = "${local.node_name}"
-    Endpoint_Tag             = "${var.endpoint_tag}"
-    "user:tag"               = "${var.project_tag}:${local.node_name}"
-    product                  = "${var.product}"
-    User_Tag                 = "${var.user_tag}"
-    Custom_Tag               = "${var.custom_tag}"
+    Name             = "${local.node_name}"
+    "${var.sbn}-Tag" = "${local.node_name}"
+    Project_name     = "${var.project_name}"
+    Project_tag      = "${var.project_tag}"
+    Endpoint_Tag     = "${var.endpoint_tag}"
+    "user:tag"       = "${var.sbn}:${local.node_name}"
+    Product          = "${var.product}"
+    User_Tag         = "${var.user_tag}"
+    Custom_Tag       = "${var.custom_tag}"
   }
 }
\ No newline at end of file
diff --git a/infrastructure-provisioning/terraform/aws/computational_resources/notebooks/main/variables.tf b/infrastructure-provisioning/terraform/aws/computational_resources/modules/notebook/variables.tf
similarity index 92%
rename from infrastructure-provisioning/terraform/aws/computational_resources/notebooks/main/variables.tf
rename to infrastructure-provisioning/terraform/aws/computational_resources/modules/notebook/variables.tf
index 975ea80..50c5487 100644
--- a/infrastructure-provisioning/terraform/aws/computational_resources/notebooks/main/variables.tf
+++ b/infrastructure-provisioning/terraform/aws/computational_resources/modules/notebook/variables.tf
@@ -19,6 +19,10 @@
 #
 # ******************************************************************************
 
+variable "project_name" {}
+
+variable "sbn" {}
+
 variable "project_tag" {}
 
 variable "endpoint_tag" {}
@@ -31,7 +35,7 @@ variable "notebook_name" {}
 
 variable "product" {}
 
-variable "note_ami" {}
+variable "ami" {}
 
 variable "instance_type" {}
 
@@ -41,4 +45,4 @@ variable "subnet_id" {}
 
 variable "nb-sg_id" {}
 
-variable "note_profile_name" {}
\ No newline at end of file
+variable "iam_profile_name" {}
\ No newline at end of file
diff --git a/infrastructure-provisioning/terraform/aws/computational_resources/notebooks/main/main.tf b/infrastructure-provisioning/terraform/aws/computational_resources/notebooks/main/main.tf
deleted file mode 100644
index e69de29..0000000


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org