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

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


The following commit(s) were added to refs/heads/DLAB-terraform by this push:
     new 81af4f9  fixed issue with billing service
81af4f9 is described below

commit 81af4f912374fa98132571b8fe48975208eebe15
Author: Oleh Martushevskyi <oleh_martushevs...@epam.com>
AuthorDate: Wed Aug 14 14:01:13 2019 +0300

    fixed issue with billing service
---
 .../terraform/aws/endpoint/main/iam.tf             |  2 +-
 .../terraform/aws/endpoint/main/instance.tf        |  2 +-
 .../terraform/aws/endpoint/main/network.tf         | 10 ++---
 .../terraform/aws/endpoint/main/variables.tf       |  2 +-
 .../templates/configmap-billing-conf.yaml          | 16 +++----
 .../main/dlab-billing-chart/values.yaml            | 15 ++++++-
 .../aws/ssn-helm-charts/main/dlab-billing.tf       | 25 ++++++++---
 .../aws/ssn-helm-charts/main/variables.tf          | 51 ++++++++++++++++++++++
 .../aws/ssn-k8s/main/auto_scaling_groups.tf        |  8 ++--
 .../aws/ssn-k8s/main/files/ssn-policy.json.tpl     | 51 ++++++++++------------
 .../terraform/aws/ssn-k8s/main/lb.tf               | 10 ++---
 .../terraform/aws/ssn-k8s/main/role_policy.tf      |  5 +--
 .../terraform/aws/ssn-k8s/main/s3.tf               | 15 ++++++-
 .../terraform/aws/ssn-k8s/main/security_groups.tf  |  2 +-
 .../terraform/aws/ssn-k8s/main/variables.tf        |  2 +-
 .../terraform/aws/ssn-k8s/main/vpc.tf              | 18 ++++----
 infrastructure-provisioning/terraform/bin/dlab.py  | 46 +++++++++++++++++++
 17 files changed, 205 insertions(+), 75 deletions(-)

diff --git a/infrastructure-provisioning/terraform/aws/endpoint/main/iam.tf 
b/infrastructure-provisioning/terraform/aws/endpoint/main/iam.tf
index 4c12baf..348a44c 100644
--- a/infrastructure-provisioning/terraform/aws/endpoint/main/iam.tf
+++ b/infrastructure-provisioning/terraform/aws/endpoint/main/iam.tf
@@ -34,7 +34,7 @@ resource "aws_iam_role" "endpoint_role" {
   assume_role_policy = file("./files/assume-policy.json")
   tags = {
     Name = "${local.endpoint_role_name}"
-    "${local.billing_tag[0]}" = local.billing_tag[1]
+    "${local.additional_tag[0]}" = local.additional_tag[1]
     "${var.tag_resource_id}" = 
"${var.service_base_name}:${local.endpoint_role_name}"
     "${var.service_base_name}-Tag" = local.endpoint_role_name
   }
diff --git 
a/infrastructure-provisioning/terraform/aws/endpoint/main/instance.tf 
b/infrastructure-provisioning/terraform/aws/endpoint/main/instance.tf
index 1643753..20a7016 100644
--- a/infrastructure-provisioning/terraform/aws/endpoint/main/instance.tf
+++ b/infrastructure-provisioning/terraform/aws/endpoint/main/instance.tf
@@ -37,7 +37,7 @@ resource "aws_instance" "endpoint" {
   }
   tags = {
     Name                           = local.endpoint_instance_name
-    "${local.billing_tag[0]}"      = local.billing_tag[1]
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
     "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.endpoint_instance_name}"
     "${var.service_base_name}-Tag" = local.endpoint_instance_name
   }
diff --git a/infrastructure-provisioning/terraform/aws/endpoint/main/network.tf 
b/infrastructure-provisioning/terraform/aws/endpoint/main/network.tf
index c7b1d38..d3b47ce 100644
--- a/infrastructure-provisioning/terraform/aws/endpoint/main/network.tf
+++ b/infrastructure-provisioning/terraform/aws/endpoint/main/network.tf
@@ -23,7 +23,7 @@ locals {
   endpoint_subnet_name       = "${var.service_base_name}-subnet"
   endpoint_sg_name           = "${var.service_base_name}-sg"
   endpoint_vpc_name = "${var.service_base_name}-endpoint-vpc"
-  billing_tag       = split(":", var.billing_tag)
+  additional_tag       = split(":", var.additional_tag)
   endpoint_igw_name = "${var.service_base_name}-endpoint-igw"
 }
 
@@ -36,7 +36,7 @@ resource "aws_vpc" "vpc_create" {
   enable_dns_support   = true
   tags                 = {
     Name                           = local.endpoint_vpc_name
-    "${local.billing_tag[0]}"      = local.billing_tag[1]
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
     "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.endpoint_vpc_name}"
     "${var.service_base_name}-Tag" = local.endpoint_vpc_name
   }
@@ -51,7 +51,7 @@ resource "aws_internet_gateway" "gw" {
   count  = var.vpc_id == "" ? 1 : 0
   tags   = {
     Name                           = local.endpoint_igw_name
-    "${local.billing_tag[0]}"      = local.billing_tag[1]
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
     "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.endpoint_igw_name}"
     "${var.service_base_name}-Tag" = local.endpoint_igw_name
   }
@@ -63,7 +63,7 @@ resource "aws_subnet" "endpoint_subnet" {
   availability_zone = "${var.region}${var.zone}"
   tags              = {
     Name                           = local.endpoint_subnet_name
-    "${local.billing_tag[0]}"      = local.billing_tag[1]
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
     "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.endpoint_subnet_name}"
     "${var.service_base_name}-Tag" = local.endpoint_subnet_name
   }
@@ -114,7 +114,7 @@ resource "aws_security_group" "endpoint_sec_group" {
 
   tags = {
     Name                           = local.endpoint_sg_name
-    "${local.billing_tag[0]}"      = local.billing_tag[1]
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
     "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.endpoint_sg_name}"
     "${var.service_base_name}-Tag" = local.endpoint_sg_name
   }
diff --git 
a/infrastructure-provisioning/terraform/aws/endpoint/main/variables.tf 
b/infrastructure-provisioning/terraform/aws/endpoint/main/variables.tf
index 69daa86..7997bef 100644
--- a/infrastructure-provisioning/terraform/aws/endpoint/main/variables.tf
+++ b/infrastructure-provisioning/terraform/aws/endpoint/main/variables.tf
@@ -56,7 +56,7 @@ variable "endpoint_eip_allocation_id" {}
 
 variable "endpoint_id" {}
 
-variable "billing_tag" {
+variable "additional_tag" {
   default = "product:dlab"
 }
 
diff --git 
a/infrastructure-provisioning/terraform/aws/ssn-helm-charts/main/dlab-billing-chart/templates/configmap-billing-conf.yaml
 
b/infrastructure-provisioning/terraform/aws/ssn-helm-charts/main/dlab-billing-chart/templates/configmap-billing-conf.yaml
index 8d6c1c1..f8fc9a5 100644
--- 
a/infrastructure-provisioning/terraform/aws/ssn-helm-charts/main/dlab-billing-chart/templates/configmap-billing-conf.yaml
+++ 
b/infrastructure-provisioning/terraform/aws/ssn-helm-charts/main/dlab-billing-chart/templates/configmap-billing-conf.yaml
@@ -47,10 +47,10 @@ data:
     # Adapter for reading source data. Known types: file, s3file
     adapterIn:
       - type: s3file
-        bucket: dlab-billing-reports
-        path:
-        awsJobEnabled: false
-        accountId: 203753054073
+        bucket: {{ .Values.billing.bucket }}
+        path: {{ .Values.billing.path }}
+        awsJobEnabled: {{ .Values.billing.aws_job_enabled }}
+        accountId: {{ .Values.billing.account_id }}
         accessKeyId:
         secretAccessKey:
 
@@ -69,7 +69,7 @@ data:
     filter:
       - type: aws
         currencyCode: USD
-        columnDlabTag: user:{{ .Values.billing.tag_resource_id }}
+        columnDlabTag: {{ .Values.billing.tag }}
         serviceBaseName: {{ .Values.billing.service_base_name }}
 
 
@@ -79,9 +79,9 @@ data:
         headerLineNo: 1
         skipLines: 1
         columnMapping: >-
-          dlab_id=user:user:tag;usage_date=UsageStartDate;product=ProductName;
-          usage_type=UsageType;usage=UsageQuantity;cost=BlendedCost;
-          resource_id=ResourceId;tags=Operation,ItemDescription
+          dlab_id={{ .Values.billing.dlab_id }};usage_date={{ 
.Values.billing.usage_date }};product={{ .Values.billing.product }};
+          usage_type={{ .Values.billing.usage_type 
}}billing_usage_type;usage={{ .Values.billing.usage }};cost={{ 
.Values.billing.cost }};
+          resource_id={{ .Values.billing.resource_id }};tags={{ 
.Values.billing.tags }}
         aggregate: day
 
 
diff --git 
a/infrastructure-provisioning/terraform/aws/ssn-helm-charts/main/dlab-billing-chart/values.yaml
 
b/infrastructure-provisioning/terraform/aws/ssn-helm-charts/main/dlab-billing-chart/values.yaml
index 44a4e65..f09e4c6 100644
--- 
a/infrastructure-provisioning/terraform/aws/ssn-helm-charts/main/dlab-billing-chart/values.yaml
+++ 
b/infrastructure-provisioning/terraform/aws/ssn-helm-charts/main/dlab-billing-chart/values.yaml
@@ -60,4 +60,17 @@ billing:
     username: ${mongo_user}
     db_name: ${mongo_db_name}
   service_base_name: ${service_base_name}
-  tag_resource_id: ${tag_resource_id}
\ No newline at end of file
+  tag_resource_id: ${tag_resource_id}
+  bucket: ${billing_bucket}
+  path: ${billing_bucket_path}
+  aws_job_enabled: ${billing_aws_job_enabled}
+  account_id: ${billing_aws_account_id}
+  tag: ${billing_tag}
+  dlab_id: ${billing_dlab_id}
+  usage_date: ${billing_usage_date}
+  product: ${billing_product}
+  usage_type: ${billing_usage_type}
+  usage: ${billing_usage}
+  cost: ${billing_cost}
+  resource_id: ${billing_resource_id}
+  tags: ${billing_tags}
\ No newline at end of file
diff --git 
a/infrastructure-provisioning/terraform/aws/ssn-helm-charts/main/dlab-billing.tf
 
b/infrastructure-provisioning/terraform/aws/ssn-helm-charts/main/dlab-billing.tf
index 4324cd5..e712406 100644
--- 
a/infrastructure-provisioning/terraform/aws/ssn-helm-charts/main/dlab-billing.tf
+++ 
b/infrastructure-provisioning/terraform/aws/ssn-helm-charts/main/dlab-billing.tf
@@ -22,12 +22,25 @@
 data "template_file" "dlab_billing_values" {
   template = file("./dlab-billing-chart/values.yaml")
   vars = {
-    mongo_db_name       = var.mongo_dbname
-    mongo_user          = var.mongo_db_username
-    mongo_port          = var.mongo_service_port
-    mongo_service_name  = var.mongo_service_name
-    service_base_name   = var.service_base_name
-    tag_resource_id     = var.tag_resource_id
+    mongo_db_name           = var.mongo_dbname
+    mongo_user              = var.mongo_db_username
+    mongo_port              = var.mongo_service_port
+    mongo_service_name      = var.mongo_service_name
+    service_base_name       = var.service_base_name
+    tag_resource_id         = var.tag_resource_id
+    billing_bucket          = var.billing_bucket
+    billing_bucket_path     = var.billing_bucket_path
+    billing_aws_job_enabled = var.billing_aws_job_enabled
+    billing_aws_account_id  = var.billing_aws_account_id
+    billing_tag             = var.billing_tag
+    billing_dlab_id         = var.billing_dlab_id
+    billing_usage_date      = var.billing_usage_date
+    billing_product         = var.billing_product
+    billing_usage_type      = var.billing_usage_type
+    billing_usage           = var.billing_usage
+    billing_cost            = var.billing_cost
+    billing_resource_id     = var.billing_resource_id
+    billing_tags            = var.billing_tags
   }
 }
 
diff --git 
a/infrastructure-provisioning/terraform/aws/ssn-helm-charts/main/variables.tf 
b/infrastructure-provisioning/terraform/aws/ssn-helm-charts/main/variables.tf
index ebba169..1c2c027 100644
--- 
a/infrastructure-provisioning/terraform/aws/ssn-helm-charts/main/variables.tf
+++ 
b/infrastructure-provisioning/terraform/aws/ssn-helm-charts/main/variables.tf
@@ -122,6 +122,57 @@ variable "ssn_k8s_masters_shape" {}
 
 variable "tag_resource_id" {}
 
+variable "billing_bucket" {
+    default = ""
+}
+
+variable "billing_bucket_path" {
+    default = ""
+}
+
+variable "billing_aws_job_enabled" {
+    default = "false"
+}
+
+variable "billing_aws_account_id" {
+    default = ""
+}
+
+variable "billing_tag" {
+    default = "dlab"
+}
+
+variable "billing_dlab_id" {
+    default = "resource_tags_user_user_tag"
+}
+
+variable "billing_usage_date" {
+    default = "line_item_usage_start_date"
+}
+
+variable "billing_product" {
+    default = "product_product_name"
+}
+
+variable "billing_usage_type" {
+    default = "line_item_usage_type"
+}
+
+variable "billing_usage" {
+    default = "line_item_usage_amount"
+}
+
+variable "billing_cost" {
+    default = "line_item_blended_cost"
+}
+
+variable "billing_resource_id" {
+    default = "line_item_resource_id"
+}
+
+variable "billing_tags" {
+    default = "line_item_operation,line_item_line_item_description"
+}
 //variable "nginx_http_port" {
 //    default = "31080"
 //    description = "Sets the nodePort that maps to the Ingress' port 80"
diff --git 
a/infrastructure-provisioning/terraform/aws/ssn-k8s/main/auto_scaling_groups.tf 
b/infrastructure-provisioning/terraform/aws/ssn-k8s/main/auto_scaling_groups.tf
index c20da65..61faed3 100644
--- 
a/infrastructure-provisioning/terraform/aws/ssn-k8s/main/auto_scaling_groups.tf
+++ 
b/infrastructure-provisioning/terraform/aws/ssn-k8s/main/auto_scaling_groups.tf
@@ -119,8 +119,8 @@ resource "aws_autoscaling_group" 
"ssn_k8s_autoscaling_group_masters" {
       propagate_at_launch = true
     },
     {
-      key                 = local.billing_tag[0]
-      value               = local.billing_tag[1]
+      key                 = local.additional_tag[0]
+      value               = local.additional_tag[1]
       propagate_at_launch = true
     },
     {
@@ -154,8 +154,8 @@ resource "aws_autoscaling_group" 
"ssn_k8s_autoscaling_group_workers" {
       propagate_at_launch = true
     },
     {
-      key                 = local.billing_tag[0]
-      value               = local.billing_tag[1]
+      key                 = local.additional_tag[0]
+      value               = local.additional_tag[1]
       propagate_at_launch = true
     },
     {
diff --git 
a/infrastructure-provisioning/terraform/aws/ssn-k8s/main/files/ssn-policy.json.tpl
 
b/infrastructure-provisioning/terraform/aws/ssn-k8s/main/files/ssn-policy.json.tpl
index 3532064..d0d058a 100644
--- 
a/infrastructure-provisioning/terraform/aws/ssn-k8s/main/files/ssn-policy.json.tpl
+++ 
b/infrastructure-provisioning/terraform/aws/ssn-k8s/main/files/ssn-policy.json.tpl
@@ -2,33 +2,23 @@
   "Version": "2012-10-17",
   "Statement": [
     {
-      "Effect": "Allow",
-      "Action": "s3:ListAllMyBuckets",
-      "Resource": "arn:aws:s3:::*"
-    },
-    {
-      "Effect": "Allow",
-      "Action": [
-        "s3:ListBucket",
-        "s3:GetBucketLocation",
-        "s3:PutBucketPolicy",
-        "s3:PutEncryptionConfiguration"
-      ],
-      "Resource": [
-        "${bucket_arn}"
-         ]
-    },
-    {
-      "Effect": "Allow",
-      "Action": [
-        "s3:HeadObject",
-        "s3:PutObject",
-        "s3:GetObject",
-        "s3:DeleteObject"
-      ],
-      "Resource": [
-        "${bucket_arn}/*"
-      ]
+        "Action": [
+            "s3:CreateBucket",
+            "s3:ListAllMyBuckets",
+            "s3:GetBucketLocation",
+            "s3:GetBucketTagging",
+            "s3:PutBucketTagging",
+            "s3:PutBucketPolicy",
+            "s3:GetBucketPolicy",
+            "s3:DeleteBucket",
+            "s3:DeleteObject",
+            "s3:GetObject",
+            "s3:ListBucket",
+            "s3:PutObject",
+            "s3:PutEncryptionConfiguration"
+        ],
+        "Effect": "Allow",
+        "Resource": "*"
     },
     {
         "Effect": "Allow",
@@ -38,6 +28,13 @@
             "elasticloadbalancing:DescribeTargetHealth"
         ],
         "Resource": "*"
+    },
+    {
+        "Action": [
+            "pricing:GetProducts"
+        ],
+        "Effect": "Allow",
+        "Resource": "*"
     }
   ]
 }
\ No newline at end of file
diff --git a/infrastructure-provisioning/terraform/aws/ssn-k8s/main/lb.tf 
b/infrastructure-provisioning/terraform/aws/ssn-k8s/main/lb.tf
index 1c858d5..266340c 100644
--- a/infrastructure-provisioning/terraform/aws/ssn-k8s/main/lb.tf
+++ b/infrastructure-provisioning/terraform/aws/ssn-k8s/main/lb.tf
@@ -34,7 +34,7 @@ resource "aws_lb" "ssn_k8s_nlb" {
                                 local.subnet_c_id])
   tags               = {
     Name                           = local.ssn_nlb_name
-    "${local.billing_tag[0]}"      = local.billing_tag[1]
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
     "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.ssn_nlb_name}"
     "${var.service_base_name}-Tag" = local.ssn_nlb_name
   }
@@ -50,7 +50,7 @@ resource "aws_lb" "ssn_k8s_alb" {
 
   tags               = {
     Name                           = local.ssn_alb_name
-    "${local.billing_tag[0]}"      = local.billing_tag[1]
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
     "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.ssn_alb_name}"
     "${var.service_base_name}-Tag" = local.ssn_alb_name
   }
@@ -63,7 +63,7 @@ resource "aws_lb_target_group" "ssn_k8s_nlb_api_target_group" 
{
   vpc_id   = data.aws_vpc.ssn_k8s_vpc_data.id
   tags     = {
     Name                           = local.ssn_k8s_nlb_api_tg_name
-    "${local.billing_tag[0]}"      = local.billing_tag[1]
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
     "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.ssn_k8s_nlb_api_tg_name}"
     "${var.service_base_name}-Tag" = local.ssn_k8s_nlb_api_tg_name
   }
@@ -76,7 +76,7 @@ resource "aws_lb_target_group" "ssn_k8s_nlb_ss_target_group" {
   vpc_id   = data.aws_vpc.ssn_k8s_vpc_data.id
   tags     = {
     Name                           = local.ssn_k8s_nlb_ss_tg_name
-    "${local.billing_tag[0]}"      = local.billing_tag[1]
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
     "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.ssn_k8s_nlb_ss_tg_name}"
     "${var.service_base_name}-Tag" = local.ssn_k8s_nlb_ss_tg_name
   }
@@ -89,7 +89,7 @@ resource "aws_lb_target_group" "ssn_k8s_alb_target_group" {
   vpc_id   = data.aws_vpc.ssn_k8s_vpc_data.id
   tags = {
     Name                           = local.ssn_k8s_alb_tg_name
-    "${local.billing_tag[0]}"      = local.billing_tag[1]
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
     "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.ssn_k8s_alb_tg_name}"
     "${var.service_base_name}-Tag" = local.ssn_k8s_alb_tg_name
   }
diff --git 
a/infrastructure-provisioning/terraform/aws/ssn-k8s/main/role_policy.tf 
b/infrastructure-provisioning/terraform/aws/ssn-k8s/main/role_policy.tf
index 90718ef..ed85b5d 100644
--- a/infrastructure-provisioning/terraform/aws/ssn-k8s/main/role_policy.tf
+++ b/infrastructure-provisioning/terraform/aws/ssn-k8s/main/role_policy.tf
@@ -26,9 +26,6 @@ locals {
 
 data "template_file" "ssn_k8s_s3_policy" {
   template = file("./files/ssn-policy.json.tpl")
-  vars     = {
-    bucket_arn = aws_s3_bucket.ssn_k8s_bucket.arn
-  }
 }
 
 resource "aws_iam_policy" "ssn_k8s_policy" {
@@ -42,7 +39,7 @@ resource "aws_iam_role" "ssn_k8s_role" {
   assume_role_policy = file("./files/assume-policy.json")
   tags               = {
     Name                           = local.ssn_role_name
-    "${local.billing_tag[0]}"      = local.billing_tag[1]
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
     "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.ssn_role_name}"
     "${var.service_base_name}-Tag" = local.ssn_role_name
   }
diff --git a/infrastructure-provisioning/terraform/aws/ssn-k8s/main/s3.tf 
b/infrastructure-provisioning/terraform/aws/ssn-k8s/main/s3.tf
index 103f818..3026189 100644
--- a/infrastructure-provisioning/terraform/aws/ssn-k8s/main/s3.tf
+++ b/infrastructure-provisioning/terraform/aws/ssn-k8s/main/s3.tf
@@ -21,6 +21,7 @@
 
 locals {
   ssn_s3_name = "${var.service_base_name}-ssn-bucket"
+  ssn_s3_shared_name = "${var.service_base_name}-shared-bucket"
 }
 
 resource "aws_s3_bucket" "ssn_k8s_bucket" {
@@ -28,10 +29,22 @@ resource "aws_s3_bucket" "ssn_k8s_bucket" {
   acl    = "private"
   tags   = {
     Name                           = local.ssn_s3_name
-    "${local.billing_tag[0]}"      = local.billing_tag[1]
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
     "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.ssn_s3_name}"
     "${var.service_base_name}-Tag" = local.ssn_s3_name
   }
   force_destroy = true
 }
 
+resource "aws_s3_bucket" "ssn_k8s_shared_bucket" {
+  bucket = local.ssn_s3_shared_name
+  acl    = "private"
+  tags   = {
+    Name                           = local.ssn_s3_shared_name
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
+    "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.ssn_s3_shared_name}"
+    "${var.service_base_name}-Tag" = local.ssn_s3_shared_name
+  }
+  force_destroy = true
+}
+
diff --git 
a/infrastructure-provisioning/terraform/aws/ssn-k8s/main/security_groups.tf 
b/infrastructure-provisioning/terraform/aws/ssn-k8s/main/security_groups.tf
index 6486116..3f363a7 100644
--- a/infrastructure-provisioning/terraform/aws/ssn-k8s/main/security_groups.tf
+++ b/infrastructure-provisioning/terraform/aws/ssn-k8s/main/security_groups.tf
@@ -78,7 +78,7 @@ resource "aws_security_group" "ssn_k8s_sg" {
 
   tags = {
     Name                           = local.ssn_sg_name
-    "${local.billing_tag[0]}"      = local.billing_tag[1]
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
     "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.ssn_sg_name}"
     "${var.service_base_name}-Tag" = local.ssn_sg_name
   }
diff --git 
a/infrastructure-provisioning/terraform/aws/ssn-k8s/main/variables.tf 
b/infrastructure-provisioning/terraform/aws/ssn-k8s/main/variables.tf
index ab86415..cde1694 100644
--- a/infrastructure-provisioning/terraform/aws/ssn-k8s/main/variables.tf
+++ b/infrastructure-provisioning/terraform/aws/ssn-k8s/main/variables.tf
@@ -52,7 +52,7 @@ variable "project_tag" {
   default = ""
 }
 
-variable "billing_tag" {
+variable "additional_tag" {
   default = "product:dlab"
 }
 
diff --git a/infrastructure-provisioning/terraform/aws/ssn-k8s/main/vpc.tf 
b/infrastructure-provisioning/terraform/aws/ssn-k8s/main/vpc.tf
index 26d1e9a..e768823 100644
--- a/infrastructure-provisioning/terraform/aws/ssn-k8s/main/vpc.tf
+++ b/infrastructure-provisioning/terraform/aws/ssn-k8s/main/vpc.tf
@@ -20,7 +20,7 @@
 # 
******************************************************************************
 
 locals {
-  billing_tag       = split(":", var.billing_tag)
+  additional_tag       = split(":", var.additional_tag)
   ssn_vpc_name      = "${var.service_base_name}-ssn-vpc"
   ssn_igw_name      = "${var.service_base_name}-ssn-igw"
   ssn_subnet_a_name = "${var.service_base_name}-ssn-subnet-az-a"
@@ -40,7 +40,7 @@ resource "aws_vpc" "ssn_k8s_vpc" {
 
   tags = {
     Name                           = local.ssn_vpc_name
-    "${local.billing_tag[0]}"      = local.billing_tag[1]
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
     "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.ssn_vpc_name}"
     "${var.service_base_name}-Tag" = local.ssn_vpc_name
   }
@@ -52,7 +52,7 @@ resource "aws_internet_gateway" "ssn_k8s_igw" {
 
   tags = {
     Name                           = local.ssn_igw_name
-    "${local.billing_tag[0]}"      = local.billing_tag[1]
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
     "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.ssn_igw_name}"
     "${var.service_base_name}-Tag" = local.ssn_igw_name
   }
@@ -78,7 +78,7 @@ resource "aws_subnet" "ssn_k8s_subnet_a" {
 
   tags = {
     Name                           = local.ssn_subnet_a_name
-    "${local.billing_tag[0]}"      = local.billing_tag[1]
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
     "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.ssn_subnet_a_name}"
     "${var.service_base_name}-Tag" = local.ssn_subnet_a_name
   }
@@ -93,7 +93,7 @@ resource "aws_subnet" "ssn_k8s_subnet_b" {
 
   tags = {
     Name                           = local.ssn_subnet_b_name
-    "${local.billing_tag[0]}"      = local.billing_tag[1]
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
     "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.ssn_subnet_b_name}"
     "${var.service_base_name}-Tag" = local.ssn_subnet_b_name
   }
@@ -108,7 +108,7 @@ resource "aws_subnet" "ssn_k8s_subnet_c" {
 
   tags = {
     Name                           = local.ssn_subnet_c_name
-    "${local.billing_tag[0]}"      = local.billing_tag[1]
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
     "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.ssn_subnet_c_name}"
     "${var.service_base_name}-Tag" = local.ssn_subnet_c_name
   }
@@ -131,7 +131,7 @@ resource "aws_eip" "k8s-endpoint-eip" {
   vpc      = true
   tags = {
     Name                           = local.endpoint_ip_name
-    "${local.billing_tag[0]}"      = local.billing_tag[1]
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
     "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.endpoint_ip_name}"
     "${var.service_base_name}-Tag" = local.endpoint_ip_name
   }
@@ -142,7 +142,7 @@ resource "aws_route_table" "ssn-k8s-users-route-table" {
   tags = {
     Name                           = local.endpoint_rt_name
     "${var.service_base_name}-Tag" = var.service_base_name
-    "${local.billing_tag[0]}"      = local.billing_tag[1]
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
     "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.endpoint_rt_name}"
   }
 }
@@ -152,7 +152,7 @@ resource "aws_vpc_endpoint" "ssn-k8s-users-s3-endpoint" {
   service_name = "com.amazonaws.${var.region}.s3"
   tags = {
     Name                           = local.endpoint_s3_name
-    "${local.billing_tag[0]}"      = local.billing_tag[1]
+    "${local.additional_tag[0]}"      = local.additional_tag[1]
     "${var.tag_resource_id}"       = 
"${var.service_base_name}:${local.endpoint_s3_name}"
     "${var.service_base_name}-Tag" = local.endpoint_s3_name
   }
diff --git a/infrastructure-provisioning/terraform/bin/dlab.py 
b/infrastructure-provisioning/terraform/bin/dlab.py
index cb4e4cf..693733a 100644
--- a/infrastructure-provisioning/terraform/bin/dlab.py
+++ b/infrastructure-provisioning/terraform/bin/dlab.py
@@ -495,6 +495,50 @@ class AWSK8sSourceBuilder(AbstractDeployBuilder):
          .add_str('--ssn_vpc_id', 'ssn vpc id', group='helm_charts')
          .add_str('--tag_resource_id', 'Tag resource ID.',
                   default='user:tag', group=('k8s', 'helm_charts'))
+         .add_str('--additional_tag', 'Additional tag.',
+                  default='product:dlab', group='k8s')
+         .add_str('--billing_bucket', 'Billing bucket name', 
group='helm_charts')
+         .add_str('--billing_bucket_path',
+                  'The path to billing reports directory in S3 bucket', 
default='',
+                  group='helm_charts')
+         .add_str('--billing_aws_job_enabled',
+                  'Billing format. Available options: true (aws), 
false(epam)', default='false',
+                  group='helm_charts')
+         .add_str('--billing_aws_account_id',
+                  'The ID of Amazon account', default='',
+                  group='helm_charts')
+         .add_str('--billing_dlab_id',
+                  'Column name in report file that contains dlab id tag',
+                  default='resource_tags_user_user_tag',
+                  group='helm_charts')
+         .add_str('--billing_usage_date',
+                  'Column name in report file that contains usage date tag',
+                  default='line_item_usage_start_date',
+                  group='helm_charts')
+         .add_str('--billing_product',
+                  'Column name in report file that contains product name tag',
+                  default='product_product_name',
+                  group='helm_charts')
+         .add_str('--billing_usage_type',
+                  'Column name in report file that contains usage type tag',
+                  default='line_item_usage_type',
+                  group='helm_charts')
+         .add_str('--billing_usage',
+                  'Column name in report file that contains usage tag',
+                  default='line_item_usage_amount',
+                  group='helm_charts')
+         .add_str('--billing_cost',
+                  'Column name in report file that contains cost tag',
+                  default='line_item_blended_cost',
+                  group='helm_charts')
+         .add_str('--billing_resource_id',
+                  'Column name in report file that contains dlab resource id 
tag',
+                  default='line_item_resource_id',
+                  group='helm_charts')
+         .add_str('--billing_tags',
+                  'Column name in report file that contains tags',
+                  
default='line_item_operation,line_item_line_item_description',
+                  group='helm_charts')
          )
         return params.build()
 
@@ -727,6 +771,8 @@ class AWSEndpointBuilder(AbstractDeployBuilder):
                   group='endpoint')
          .add_str('--product', 'Product name.', default='dlab',
                   group='endpoint')
+         .add_str('--additional_tag', 'Additional tag.',
+                  default='product:dlab', group='endpoint')
          )
         return params.build()
 


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

Reply via email to