Skip to content

Commit

Permalink
add create of namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Nov 17, 2023
1 parent c290506 commit 920b8d2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
5 changes: 3 additions & 2 deletions examples/extras/xray/variables.xray.auto.tfvars
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
xray_namespace = "aws-cloudwatch"
xray_name = "aws-xray"
xray_namespace = "aws-cloudwatch"
create_xray_namespace = true
xray_name = "aws-xray"
xray_charts = {
"xray" = {
name = "aws-xray"
Expand Down
6 changes: 6 additions & 0 deletions examples/extras/xray/variables.xray.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ variable "xray_namespace" {
default = "default"
}

variable "create_xray_namespace" {
description = "Flag to enable or disable creation of namespace"
type = bool
default = false
}

variable "xray_name" {
description = "Service account name"
type = string
Expand Down
9 changes: 8 additions & 1 deletion examples/extras/xray/xray.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ locals {
xray_images_output = { for k, v in module.images_xray.images : v.name => v }
}

resource "kubernetes_namespace" "namespace" {
count = var.create_xray_namespace ? 1 : 0
metadata {
name = var.xray_namespace
}
}

module "images_xray" {
source = "git@github.e.it.census.gov:terraform-modules/aws-ecr-copy-images.git?ref=tf-upgrade"

Expand Down Expand Up @@ -61,7 +68,7 @@ resource "helm_release" "xray" {
repository = var.xray_charts["xray"].use_remote ? var.xray_charts["xray"].repository : "${path.module}/charts"
version = var.xray_charts["xray"].use_remote ? var.xray_charts["xray"].version : null
depends_on = [module.images_xray]
depends_on = [module.images_xray, kubernetes_namespace.namespace]
set {
name = "image.repository"
value = split(":", local.xray_images_output["aws-xray-daemon"].dest_full_path)[0]
Expand Down

0 comments on commit 920b8d2

Please sign in to comment.