Open mvaude opened 1 year ago
Not the most elegant solution but maybe we could try to utilise null_resorce? Is possible to notify Sauron via command line? Please let me know what you think.
First we need to test if are they running the terraform commands from windows or linux. I have found this online. The pathexpand
function will return the full path and on Linux, this full path will always begin with /
or root
whereas on Windows this starts with a drive letter.
locals {
test = pathexpand("~/${path.module}/main.tf")
command_map = substr(local.test,0,1) == "/"? {
command = "sleep 20",
intrepreter = "bash"
}:{
command = "start-sleep 20",
intrepreter = "powershell"
}
}
resource "null_resource" "localexec" {
provisioner "local-exec" {
command = local.command_map.command
interpreter = [local.command_map.intrepreter]
}
triggers = {
trigger = local.command_map.command
}
}
Great idea @tibor-szalai we need to mimic the behavior of a Cloud Formation custom resource
It might be possible using curl or a helper script with cfn-response module.
After some Sauron infra and code inspection, we discover that the message send to the topic should look like:
{
RequestType: "Create",
ResourceProperties : {
AccountId : "",
RoleArn: ""
}
Challenge
With CF stack, Sauron is notified when the stack is run.
How can we handle in other IaC tool? (terraform and pulumi)