Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

[feature request] support cloud providers #75

Open
doreplado opened this issue May 15, 2018 · 4 comments
Open

[feature request] support cloud providers #75

doreplado opened this issue May 15, 2018 · 4 comments

Comments

@doreplado
Copy link

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"
  }
}
@raphink
Copy link
Contributor

raphink commented May 16, 2018

That would be doable indeed. That said, we haven't implemented it because we prefer to manage provisioning with the proper Terraform resources, as managing it with Rancher will make it harder to patch/remove such resources.

@doreplado
Copy link
Author

Isn't the provider using the Rancher API to begin with?

I'm probably not understanding correctly, but I thought if you're using the API and you do a remove call, it'll still remove the cloud resource. Basically you're just defining extra information about the host that the API supports that the terraform provider doesn't currently expose?

@doreplado
Copy link
Author

nevermind, I think I understand your point. I think its less about removal and more about modification and tracking the state of the individual descriptors in that appended "blob"?

@raphink
Copy link
Contributor

raphink commented May 16, 2018

Yes indeed, that's the idea. Provisioning a host through Rancher kind of prevents you from managing its lifecycle.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants