Changing dependency structure

CD_ASBC-B2VAUTH
Patryk Gudalewicz 2023-01-11 11:05:07 +01:00
parent 1fff2c2636
commit 240c65af11
22 changed files with 79 additions and 65 deletions

View File

@ -5,7 +5,4 @@ terraform {
source = "dynatrace-oss/dynatrace"
}
}
}
variable "mzid" {
type = string
}

View File

@ -5,7 +5,4 @@ terraform {
source = "dynatrace-oss/dynatrace"
}
}
}
variable "mzid" {
type = string
}

View File

@ -1,12 +1,20 @@
module "management_zone" {
source = "./management_zone"
}
module "alerting" {
source = "./alerting"
mzid = "${module.management_zone.mzid}"
depends_on = [module.management_zone]
}
module "dashboard" {
source = "./dashboard"
mzid = "${module.management_zone.mzid}"
depends_on = [module.management_zone]
}
module "custom_service" {
source = "./custom_service"
}
module "processgroup_naming" {
source = "./processgroup_naming"
}
module "service_naming" {
source = "./service_naming"
}

View File

@ -5,7 +5,4 @@ terraform {
source = "dynatrace-oss/dynatrace"
}
}
}
variable "mzid" {
type = string
}

View File

@ -5,7 +5,4 @@ terraform {
source = "dynatrace-oss/dynatrace"
}
}
}
variable "mzid" {
type = string
}

View File

@ -1,12 +1,20 @@
module "management_zone" {
source = "./management_zone"
}
module "alerting" {
source = "./alerting"
mzid = "${module.management_zone.mzid}"
depends_on = [module.management_zone]
}
module "dashboard" {
source = "./dashboard"
mzid = "${module.management_zone.mzid}"
depends_on = [module.management_zone]
}
module "custom_service" {
source = "./custom_service"
}
module "processgroup_naming" {
source = "./processgroup_naming"
}
module "service_naming" {
source = "./service_naming"
}

View File

@ -5,7 +5,4 @@ terraform {
source = "dynatrace-oss/dynatrace"
}
}
}
variable "mzid" {
type = string
}

View File

@ -5,7 +5,4 @@ terraform {
source = "dynatrace-oss/dynatrace"
}
}
}
variable "mzid" {
type = string
}

View File

@ -1,12 +1,20 @@
module "management_zone" {
source = "./management_zone"
}
module "alerting" {
source = "./alerting"
mzid = "${module.management_zone.mzid}"
depends_on = [module.management_zone]
}
module "dashboard" {
source = "./dashboard"
mzid = "${module.management_zone.mzid}"
depends_on = [module.management_zone]
}
module "custom_service" {
source = "./custom_service"
}
module "processgroup_naming" {
source = "./processgroup_naming"
}
module "service_naming" {
source = "./service_naming"
}

View File

@ -5,7 +5,4 @@ terraform {
source = "dynatrace-oss/dynatrace"
}
}
}
variable "mzid" {
type = string
}

View File

@ -5,7 +5,4 @@ terraform {
source = "dynatrace-oss/dynatrace"
}
}
}
variable "mzid" {
type = string
}

View File

@ -1,12 +1,20 @@
module "management_zone" {
source = "./management_zone"
}
module "alerting" {
source = "./alerting"
mzid = "${module.management_zone.mzid}"
depends_on = [module.management_zone]
}
module "dashboard" {
source = "./dashboard"
mzid = "${module.management_zone.mzid}"
depends_on = [module.management_zone]
}
module "custom_service" {
source = "./custom_service"
}
module "processgroup_naming" {
source = "./processgroup_naming"
}
module "service_naming" {
source = "./service_naming"
}

View File

@ -5,7 +5,4 @@ terraform {
source = "dynatrace-oss/dynatrace"
}
}
}
variable "mzid" {
type = string
}

View File

@ -5,7 +5,4 @@ terraform {
source = "dynatrace-oss/dynatrace"
}
}
}
variable "mzid" {
type = string
}

View File

@ -1,12 +1,20 @@
module "management_zone" {
source = "./management_zone"
}
module "alerting" {
source = "./alerting"
mzid = "${module.management_zone.mzid}"
depends_on = [module.management_zone]
}
module "dashboard" {
source = "./dashboard"
mzid = "${module.management_zone.mzid}"
depends_on = [module.management_zone]
}
module "custom_service" {
source = "./custom_service"
}
module "processgroup_naming" {
source = "./processgroup_naming"
}
module "service_naming" {
source = "./service_naming"
}

View File

@ -5,7 +5,4 @@ terraform {
source = "dynatrace-oss/dynatrace"
}
}
}
variable "mzid" {
type = string
}

View File

@ -5,7 +5,4 @@ terraform {
source = "dynatrace-oss/dynatrace"
}
}
}
variable "mzid" {
type = string
}

View File

@ -1,12 +1,20 @@
module "management_zone" {
source = "./management_zone"
}
module "alerting" {
source = "./alerting"
mzid = "${module.management_zone.mzid}"
depends_on = [module.management_zone]
}
module "dashboard" {
source = "./dashboard"
mzid = "${module.management_zone.mzid}"
depends_on = [module.management_zone]
}
module "custom_service" {
source = "./custom_service"
}
module "processgroup_naming" {
source = "./processgroup_naming"
}
module "service_naming" {
source = "./service_naming"
}

View File

@ -1,6 +1,6 @@
resource "dynatrace_alerting" "<APPNAME>_<APPENV>" {
name = "<APPNAME> <APPENV>"
management_zone = var.mzid
management_zone = data.dynatrace_management_zone.<APPNAME>.id
rules {
rule {
delay_in_minutes = 0

View File

@ -22,7 +22,7 @@ resource "dynatrace_dashboard" "<APPNAME>_<APPENV>" {
filter {
management_zone {
name = "<APPNAME>"
id = var.mzid
id = data.dynatrace_management_zone.<APPNAME>.id
}
}
filter_config {
@ -87,7 +87,7 @@ resource "dynatrace_dashboard" "<APPNAME>_<APPENV>" {
filter {
management_zone {
name = "<APPNAME>"
id = var.mzid
id = data.dynatrace_management_zone.<APPNAME>.id
}
}
}
@ -104,7 +104,7 @@ resource "dynatrace_dashboard" "<APPNAME>_<APPENV>" {
filter {
management_zone {
name = "<APPNAME>"
id = var.mzid
id = data.dynatrace_management_zone.<APPNAME>.id
}
}
}
@ -136,7 +136,7 @@ resource "dynatrace_dashboard" "<APPNAME>_<APPENV>" {
filter {
management_zone {
name = "<APPNAME>"
id = var.mzid
id = data.dynatrace_management_zone.<APPNAME>.id
}
}
filter_config {
@ -231,7 +231,7 @@ resource "dynatrace_dashboard" "<APPNAME>_<APPENV>" {
filter {
management_zone {
name = "<APPNAME>"
id = var.mzid
id = data.dynatrace_management_zone.<APPNAME>.id
}
}
filter_config {
@ -267,7 +267,7 @@ resource "dynatrace_dashboard" "<APPNAME>_<APPENV>" {
filter {
management_zone {
name = "<APPNAME>"
id = var.mzid
id = data.dynatrace_management_zone.<APPNAME>.id
}
}
filter_config {
@ -303,7 +303,7 @@ resource "dynatrace_dashboard" "<APPNAME>_<APPENV>" {
filter {
management_zone {
name = "<APPNAME>"
id = var.mzid
id = data.dynatrace_management_zone.<APPNAME>.id
}
}
filter_config {

View File

@ -16,7 +16,4 @@ resource "dynatrace_management_zone" "<APPNAME>" {
enabled = true
selector = "type(SERVICE),databaseName.exists(),toRelationship.calls(type(SERVICE),tag(\"compass-id:<COMPASSID>\"))"
}
}
output "mzid" {
value = "${dynatrace_management_zone.<APPNAME>.id}"
}

View File

@ -33,6 +33,9 @@ def main(slo_path):
#print('./'+item+'/'+configoption+'/'+args.appname+'.tf')
with open('./'+item+'/'+configoption+'/'+args.appname+'.tf', 'w') as file:
file.write(data)
datastring = "data \"dynatrace_management_zone\" \""+args.appname+"\"{ name=\""+args.appname+"\" }\n"
with open('./'+item+'/'+configoption+'/data_source.tf', 'a') as file:
file.write(datastring)
for envconfigoption in envconfigoptions:
for env in envs.get("environments"):
with open('./_templates/_template_'+envconfigoption+'.tf') as file:
@ -43,6 +46,8 @@ def main(slo_path):
#print('./'+item+'/'+envconfigoption+'/'+args.appname+'_'+env+'.tf')
with open('./'+item+'/'+envconfigoption+'/'+args.appname+'_'+env+'.tf', 'w') as file:
file.write(data)
with open('./'+item+'/'+envconfigoption+'/data_source.tf', 'a') as file:
file.write(datastring)
else:
print("ERROR: No appname/compassid specified")