Skip to content

Commit

Permalink
feat: move stack related names from context for compatibility with te…
Browse files Browse the repository at this point in the history
…rraform-null-label resource (#151)
  • Loading branch information
mtweeman authored Sep 29, 2024
1 parent 5029989 commit 5449b64
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 51 deletions.
10 changes: 5 additions & 5 deletions components/terraform/alb/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ provider "oci" {
}

provider "context" {
enabled = var.context.enabled
enabled = var.enabled
delimiter = "-"
property_order = [
"namespace",
Expand All @@ -33,9 +33,9 @@ provider "context" {
}
tags_key_case = "title"
values = {
namespace = var.context.namespace
stage = var.context.stage
environment = var.context.environment
name = var.context.name
namespace = var.namespace
stage = var.stage
environment = var.environment
name = var.name
}
}
26 changes: 18 additions & 8 deletions components/terraform/alb/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,24 @@ variable "compartment_ocid" {
type = string
}

variable "context" {
type = object({
enabled = bool
namespace = string
stage = string
environment = string
name = string
})
variable "enabled" {
type = bool
}

variable "namespace" {
type = string
}

variable "stage" {
type = string
}

variable "environment" {
type = string
}

variable "name" {
type = string
}

variable "vault_cert_private_key" {
Expand Down
10 changes: 5 additions & 5 deletions components/terraform/vcn/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ provider "oci" {
}

provider "context" {
enabled = var.context.enabled
enabled = var.enabled
delimiter = "-"
property_order = [
"namespace",
Expand All @@ -33,9 +33,9 @@ provider "context" {
}
tags_key_case = "title"
values = {
namespace = var.context.namespace
stage = var.context.stage
environment = var.context.environment
name = var.context.name
namespace = var.namespace
stage = var.stage
environment = var.environment
name = var.name
}
}
26 changes: 18 additions & 8 deletions components/terraform/vcn/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,24 @@ variable "region" {
type = string
}

variable "context" {
type = object({
enabled = bool
namespace = string
stage = string
environment = string
name = string
})
variable "enabled" {
type = bool
}

variable "namespace" {
type = string
}

variable "stage" {
type = string
}

variable "environment" {
type = string
}

variable "name" {
type = string
}

variable "compartment_ocid" {
Expand Down
2 changes: 1 addition & 1 deletion rootfs/usr/local/etc/atmos/atmos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ stacks:
- "orgs/**/*"
excluded_paths:
- "**/_defaults.yaml"
name_template: "{{.vars.context.namespace}}-{{.vars.context.tenant}}-{{.vars.context.stage}}-{{.vars.context.environment}}"
name_template: "{{.vars.namespace}}-{{.vars.tenant}}-{{.vars.stage}}-{{.vars.environment}}"
name_pattern: "{namespace}-{tenant}-{stage}-{environment}" # data "utils_component_config" not compatible with name_template in .atmos.yaml config file

logs:
Expand Down
3 changes: 1 addition & 2 deletions stacks/catalog/alb/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ components:
terraform:
alb:
vars:
context:
enabled: true
enabled: true
3 changes: 1 addition & 2 deletions stacks/catalog/vcn/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ components:
terraform:
vcn:
vars:
context:
enabled: true
enabled: true
3 changes: 1 addition & 2 deletions stacks/mixins/region/fra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ import:

vars:
region: eu-frankfurt-1
context:
environment: fra
environment: fra
3 changes: 1 addition & 2 deletions stacks/mixins/stage/dev.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
vars:
context:
stage: dev
stage: dev
3 changes: 1 addition & 2 deletions stacks/mixins/stage/prod.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
vars:
context:
stage: prod
stage: prod
3 changes: 1 addition & 2 deletions stacks/mixins/stage/stage.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
vars:
context:
stage: stage
stage: stage
3 changes: 1 addition & 2 deletions stacks/mixins/tenant/core.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
vars:
context:
tenant: core
tenant: core
3 changes: 1 addition & 2 deletions stacks/mixins/tenant/plat.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
vars:
context:
tenant: plat
tenant: plat
3 changes: 1 addition & 2 deletions stacks/orgs/hs/_defaults.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
vars:
context:
namespace: hs
namespace: hs
8 changes: 2 additions & 6 deletions stacks/orgs/hs/plat/prod/fra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ components:
metadata:
component: vcn
vars:
context:
name: network
name: network
vcn:
name: vcn
ipv4_cidr_blocks:
Expand All @@ -29,10 +28,7 @@ components:
metadata:
component: alb
vars:
context:
name: alb
alb:
name: alb
name: alb
vault_ca_cert: |
-----BEGIN CERTIFICATE-----
MIIFFzCCAv+gAwIBAgIUI28rXTkTMeRm+EQuTTQTBS79J+YwDQYJKoZIhvcNAQEL
Expand Down

0 comments on commit 5449b64

Please sign in to comment.