diff options
Diffstat (limited to 'src/main/resources/io/trygvis/rules/terraform/terraform.drl')
-rw-r--r-- | src/main/resources/io/trygvis/rules/terraform/terraform.drl | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/src/main/resources/io/trygvis/rules/terraform/terraform.drl b/src/main/resources/io/trygvis/rules/terraform/terraform.drl deleted file mode 100644 index 40b9f7c..0000000 --- a/src/main/resources/io/trygvis/rules/terraform/terraform.drl +++ /dev/null @@ -1,60 +0,0 @@ -package io.trygvis.rules.terraform - -import io.trygvis.rules.dba.Cluster -import io.trygvis.rules.dba.Container -import io.trygvis.rules.machine.Machine -import io.trygvis.rules.dns.DnsEntry -import io.trygvis.rules.dns.DnsEntryTerraformExpression -import java.util.Map; - -global io.trygvis.rules.engine.TemplateEngine te; - -declare ScalewayMachine - machine : Machine - key : String -end - -rule "Terraform for Machine" -when - $machine: Machine() -then - ScalewayMachine scw = new ScalewayMachine(); - - scw.setKey($machine.name); - scw.setMachine($machine); - - insert(scw); -end - -rule "Create DNS entry for Terraform Machine" -when - $machine : Machine(fqdn != null) - not(DnsEntry(fqdn == $machine.fqdn)) -then - var a = DnsEntry.a($machine.fqdn); - insert(a); - - var ipv4 = "scaleway_instance_ip.%s.address".formatted($machine.name); - insert(new DnsEntryTerraformExpression(a, $machine.name, ipv4)); -end - -rule "TF for TerraformMachine" -when - $m: Machine() - $scw: ScalewayMachine(machine == $m) -then - var path = "platform/terraform/%s.tf".formatted($scw.getKey()); - te.template("terraform-machine", path, Map.of("m", $m, "scw", $scw)); -end - -rule "Terraform for DNS" -when - $entry: DnsEntry() - $tf : DnsEntryTerraformExpression(entry == $entry) -then - var path = "dns/%s.tf".formatted($tf.key); - te.template("terraform-record-set", path, Map.of( - "entry", $entry, - "tf", $tf) - ); -end |