File tree Expand file tree Collapse file tree 3 files changed +16
-7
lines changed Expand file tree Collapse file tree 3 files changed +16
-7
lines changed Original file line number Diff line number Diff line change 11locals {
2- namespace = data. kubernetes_namespace . this . metadata . 0 . name
3- account_id = data. aws_caller_identity . current . account_id
2+ namespace_name = coalesce (var. namespace_name , var. name )
3+ namespace = data. kubernetes_namespace . this . metadata . 0 . name
4+ account_id = data. aws_caller_identity . current . account_id
45}
Original file line number Diff line number Diff line change @@ -2,22 +2,24 @@ resource "kubernetes_namespace" "this" {
22 count = var. namespace_deploy ? 1 : 0
33
44 metadata {
5- name = var . name
5+ name = local . namespace_name
66
77 labels = {
8- name = var.name
8+ name = local.namespace_name
99 description = var.description
1010 }
1111 }
1212}
1313
14+ // Retrieving this data will ensure that the target Kubernetes namespace exists
15+ // before proceeding
1416data "kubernetes_namespace" "this" {
1517 metadata {
16- name = var . name
18+ name = local . namespace_name
1719 }
1820
1921 depends_on = [
20- kubernetes_namespace . this
22+ kubernetes_namespace . this ,
2123 ]
2224}
2325
Original file line number Diff line number Diff line change @@ -23,10 +23,16 @@ variable "iam_deploy" {
2323
2424variable "name" {
2525 default = " velero"
26- description = " Namespace name"
26+ description = " Installation name"
2727 type = string
2828}
2929
30+ variable "namespace_name" {
31+ description = " Kubernetes namespace name. If left unset, the `name` variable will be used instead."
32+ type = string
33+ optional = true
34+ }
35+
3036variable "description" {
3137 default = " velero-back-up-and-restore"
3238 description = " Namespace description"
You can’t perform that action at this time.
0 commit comments