Question regarding creating Azure VMSS by using provider-jet-azure - v0.10.0-preview

115 views
Skip to first unread message

Lior Yantovski

unread,
Jun 23, 2022, 6:00:00 PM6/23/22
to crossplane-dev

Hi,

 I am trying to create Azure VMSS by using provider-jet-azure - v0.10.0-preview:

https://doc.crds.dev/github.com/crossplane-contrib/provider-jet-azure/compute.azure.jet.crossplane.io/LinuxVirtualMachineScaleSet/v1al...@v0.10.0-preview

 And I have issue to create resource with custom_data like we have in Terraform module :

https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/linux_virtual_machine_scale_set#custom_data

Based on TF docs we can use base64 encoded file (for example cloud-init.tpl file).

 When in provider-jet-azure - v0.10.0-preview I should provide custom_data as secret (by the way not clear why it should be secret and not path to file or ConfigMap):

ddd.png


 I am trying to create secret with base64 encoded file and I am getting an error:

Message:               create failed: cannot apply: apply failed: creating Linux Virtual Machine Scale Set "ly107h-vmss" (Resource Group "ly107h-rg"): compute.VirtualMachineScaleSetsClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: Code="InvalidParameter" Message="Custom data in OSProfile must be in Base64 encoding and with a maximum length of 87380 characters." Target="customData": : File name: main.tf.json

 

$ base64 cloudinit.tpl > cloudinit.tpl.base64

$  kubectl create secret generic cloudinit-secret -n crossplane-system --from-file=cloudinit=./cloudinit.tpl.base64

 $ cat linuxvirtualmachinescaleset.yaml

---

apiVersion: compute.azure.jet.crossplane.io/v1alpha1

kind: LinuxVirtualMachineScaleSet

metadata:

  name: ly107h-vmss

spec:

  forProvider:

#    adminSshKey:

#    - publicKey: ${file("~/.ssh/id_rsa.pub")}

#      username: adminuser

    adminUsername: adminuser

    adminPasswordSecretRef:

      key: adminpass

      name: vmss-secret

      namespace: crossplane-system

    instances: 1

    location: EAST US 2

    name: ly107h-vmss

    disablePasswordAuthentication: false

    customDataSecretRef:

      key: cloudinit

      name: cloudinit-secret

      namespace: crossplane-system

    networkInterface:

    - ipConfiguration:

      - name: internal

        primary: true

        subnetId: "/subscriptions/*************************/resourceGroups/ly107h-rg/providers/Microsoft.Network/virtualNetworks/ly107hvnet/subnets/ly107hsubnet"

      name: example

      primary: true

    osDisk:

    - caching: ReadWrite

      storageAccountType: Standard_LRS

    resourceGroupName: ly107h-rg

    sku: Standard_F2

    sourceImageReference:

    - offer: UbuntuServer

      publisher: Canonical

      sku: 16.04-LTS

      version: latest

  providerConfigRef:

    name: azure-jet-provider-config

 

Please assist or forward my question to technical specialist that can provide help.

Will be highly appreciated.

 Thanks,

Lior Yantovski

Reply all
Reply to author
Forward
0 new messages