rancher / terraform-provider-rancher2

Terraform Rancher2 provider
https://www.terraform.io/docs/providers/rancher2/
Mozilla Public License 2.0
260 stars 226 forks source link

additionalKey missing in hetzner_config in the terraform resource: rancher2_node_template #654

Open Jasstkn opened 3 years ago

Jasstkn commented 3 years ago

Hi! I wonder why additionalKey parameter is missing from rancher2_node_template in terraform? I can choose keys via UI and I can't provide them using terraform.

rawmind0 commented 3 years ago

@Jasstkn , what additionalKey parameter do you mean?? What are you trying to do?? You can provide cloud credentials to node_templates, https://registry.terraform.io/providers/rancher/rancher2/latest/docs/resources/node_template#cloud_credential_id

Jasstkn commented 3 years ago

@Jasstkn , what additionalKey parameter do you mean?? What are you trying to do?? You can provide cloud credentials to node_templates, https://registry.terraform.io/providers/rancher/rancher2/latest/docs/resources/node_template#cloud_credential_id

@rawmind0 hi! I'm trying to pass ssh public keys to those VMs. I can see such option via UI in the node template with Hetzner API:

Screenshot 2021-05-08 at 23 13 09

When I click them in the UI and check API configuration. Here is the output:

{
"annotations": {
"ownerBindingsCreated": "true"
},
"authCertificateAuthority": "",
"authKey": "",
"baseType": "nodeTemplate",
"cloudCredentialId": null,
"created": "2021-04-19T19:18:43Z",
"createdTS": 1618859923000,
"creatorId": "user-XXXX",
"description": "Template to create sandbox worker nodes",
"driver": "hetzner",
"engineEnv": { },
"engineInsecureRegistry": [ ],
"engineInstallURL": "https://releases.rancher.com/install-docker/20.10.sh",
"engineLabel": { },
"engineOpt": { },
"engineRegistryMirror": [ ],
"engineStorageDriver": "",
"hetznerConfig": {
"additionalKey": [ 4 items
"ssh-rsa XXXX",
"ssh-rsa XXXX",
"ssh-rsa XXXX",
"ssh-rsa XXXX"
],
"apiToken": "XXXXXXX",
"existingKeyId": "0",
"existingKeyPath": "",
"firewalls": [ ],
"image": "ubuntu-20.04",
"imageId": "0",
"networks": [
"kubernetes-internal"
],
"serverLabel": [
"cattle.io/creator=norman"
],
"serverLocation": "nbg1",
"serverType": "cx21",
"usePrivateNetwork": false,
"userData": ""
},
"id": "cattle-global-nt:nt-XXXXXX",
"labels": {
"cattle.io/creator": "norman"
},
"links": {
"nodePools": "…/v3/nodePools?nodeTemplateId=cattle-global-nt%3Ant-XXXXXX",
"nodes": "…/v3/nodes?nodeTemplateId=cattle-global-nt%3Ant-XXXXX",
"self": "…/v3/nodeTemplates/cattle-global-nt:nt-XXXXXX",
"update": "…/v3/nodeTemplates/cattle-global-nt:nt-XXXXX"
},
"name": "sandbox_worker",
"nodeTaints": [ ],
"principalId": "local://XXXX",
"state": "active",
"transitioning": "no",
"transitioningMessage": "",
"type": "nodeTemplate",
"useInternalIpAddress": true,
"uuid": "XXXXX"
rawmind0 commented 3 years ago

@Jasstkn ,got it, thanks for the clarification. Not it seems this field is not added to the provider, cc: @alexzimmer96

rawmind0 commented 3 years ago

Same think as commented at https://github.com/rancher/terraform-provider-rancher2/issues/656#issuecomment-838730562 .

additionalKeys field is not set as "public" at golang struct, https://github.com/JonasProgrammer/docker-machine-driver-hetzner/blob/master/driver.go#L48 . It's "public", AdditionalKeyIDs field https://github.com/JonasProgrammer/docker-machine-driver-hetzner/blob/master/driver.go#L49, but expecting []int. May this work for you @Jasstkn ??

Any comment on this @alexzimmer96 ??