I have been experimenting with terraform and AWS, doing something like:
...
provider "aws" {
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
region = "${var.region}"
}
resource "aws_instance" "bastion" {
ami = "${var.image}"
instance_type = "${var.inst_type}"
key_name = "My Keys"
subnet_id = "${aws_subnet.my_public_subnet.id}"
vpc_security_group_ids = [
"${aws_security_group.my_vpc_security_group.id}"
]
tags={
Name="${var.inst_name}"
}
}
...
But now I'd like to move one step away from AWS, and write something that isn't tied to AWS, but which would work for all cloud providers, ideally. Is there a way to achieve this? I would really appreciate a couple of pointers in the right direction.
===EDIT===
Maybe I need to explain a bit further: I am not after a full generalisation of everything in eg. the AWS API. However, since most, if not all, cloud environments let you create VMs with Linux, and also have some way of setting up some initial configuration via terraform, it ought to be possible to parametrize the provider specific parts, so that I can write the essential infrastructure structure code and specify whether I use AWS, Azure, Google etc as a set of parameters. My problem is that I haven't worked long enough with terraform to see how to do that.