I have seen many examples on how to use Terraform to launch AWS resources. I have also seen many claims that Terraform is cloud agnostic.
What I have not seen is an
@ydaetskcoR I love your idea of the provider specific modules (which follow an interface). But the change I would propose is that they can be called from the main.tf file directly with a variable there to determine the module source.
So I would keep:
modules/google/dns/record/main.tf
modules/aws/dns/record/main.tf
I would not use modules/generic/dns/record/main.tf
And add:
main.tf
variable "cloud_provider" = { default = "aws" }
module "dns" {
source = "modules/${var.cloud_provider}/dns/record/main.tf"
domain_name_record = "${var.domain_name_record}"
domain_name_zone = "${var.domain_name_zone}"
domain_name_target = "${var.domain_name_target}"
}
Unfortunately Terraform doesn't support variable module source.
See: https://github.com/hashicorp/terraform/issues/1439
I'm considering ways to add a plugin or perhaps even a higher level template abstraction.