terraform-provider-rancher icon indicating copy to clipboard operation
terraform-provider-rancher copied to clipboard

[feature request] support cloud providers

Open doreplado opened this issue 6 years ago • 4 comments

I looked through resource_rancher_host.go and was trying to figure out if this provider supports the various cloud providers for host provisioning that rancher supports.

Based on my research it doesn't yet.

Is there a way we could easily support the various cloud providers by making an optional appended system map to the host resource and pass in the json for the rancher-api to leverage the cloud provider?

Something like:

# Manage an existing Rancher host
resource rancher_host "foo" {
  name           = "foo"
  description    = "The foo node"
  environment_id = "1a5"
  hostname       = "foo.example.com"
  labels {
    role = "database"
  }
 provider {
    "amazonec2Config": {
        "accessKey": "XXXXXXXXXXXXXXXX",
        "ami": "ami-5c66ea23",
        "blockDurationMinutes": "0",
        "deviceName": "/dev/sda1",
        "endpoint": "",
        "iamInstanceProfile": "my-iam-profile",
        "instanceType": "t2.xlarge",
        "keypairName": "",
        "privateAddressOnly": true,
        "region": "us-east-1",
        "retries": "5",
        "rootSize": "100",
        "secretKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "securityGroup": [
            "some-secgroup"
        ],
        "sessionToken": "",
        "spotPrice": "0.50",
        "sshKeypath": "",
        "sshUser": "ubuntu",
        "subnetId": "subnet-ffffffff",
        "tags": "",
        "type": "amazonec2Config",
        "userdata": "",
        "volumeType": "gp2",
        "vpcId": "vpc-99999999",
        "zone": "b"
    },
    "engineInstallUrl": "https://releases.rancher .com/install-docker/17.09.sh",
    "engineStorageDriver": "overlay2",
    "hostname": "foo.example.com",
    "labels": {},
    "type": "host"
  }
}

doreplado avatar May 15 '18 22:05 doreplado