Created
June 15, 2022 16:03
-
-
Save elect86/178e4cdec420a937a9be42981b3cf041 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
rootModule { | |
"main".tf { this:TfFile | |
tls { | |
proxy { | |
url = "https://corporate.proxy.service" | |
from_env = true | |
} | |
} | |
cert_request { | |
private_key_pem = "" | |
} | |
val a by cert_request { | |
private_key_pem = "" | |
} | |
} | |
}.generate(File("terraform")) | |
} | |
fun TfFile.cert_request(id: String = "", configure: CertRequest.() -> Unit): CertRequest { | |
val element = CertRequest("id").apply(configure) | |
add(element) | |
return element | |
} | |
operator fun CertRequest.provideDelegate(ref: Any?, prop: KProperty<*>): CertRequest= this.apply { | |
this.tf_id = prop.name | |
} | |
operator fun CertRequest.getValue(ref: Any?, prop: KProperty<*>): CertRequest = this |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment