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

user_data cloud-init key does not appear to support base64 encoded gzipped payload

Open mikroskeem opened this issue 3 years ago • 4 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v1.2.9
on darwin_arm64
+ provider registry.terraform.io/hashicorp/cloudinit v2.2.0
+ provider registry.terraform.io/scaleway/scaleway v2.4.0

Affected Resource(s)

  • https://registry.terraform.io/providers/scaleway/scaleway/2.4.0

Terraform Configuration Files

terraform {
  required_version = ">= 1.0"

  required_providers {
    cloudinit = {
      source = "hashicorp/cloudinit"
    }
  }
}

data "cloudinit_config" "config" {
  gzip          = true
  base64_encode = true

  part {
    filename     = "base-cloud-config.yml"
    content_type = "text/cloud-config"
    content = <<EOF
      #cloud-config
      system_info:
        default_user:
          name: "testing"
    EOF
  }
}

resource "scaleway_instance_user_data" "user_data" {
  server_id = ...
  key       = "cloud-init"
  value     = data.config.config.rendered
}

Debug Output

To be done - need to strip out sensitive information first.

Panic Output

N/A

Expected Behavior

Given base64-d and gzipped cloud-init configuration to be applied properly.

Actual Behavior

cloud-init configuration does not apply to the machine.

If I set gzip = false in cloud_init data resource, then it starts working. While this is not an issue with this particular example I am showing above, then this becomes a problem with larger multi-part configurations I actually want to deploy in production.

Steps to Reproduce

  1. Declare a VM using Terraform - left out from the example for now.
  2. terraform apply

Important Factoids

  • Same happens when base64 & gzipped payload is copied to Scaleway UI - so it doesn't appear to be a problem with the Terraform provider itself?

References

N/A

mikroskeem avatar Oct 07 '22 14:10 mikroskeem

Hi, thanks you for reporting, I will report it

Codelax avatar Oct 07 '22 15:10 Codelax

But please note that this is effectively not an issue with our provider but a missing feature in instance api. I've reported it to the relevant team, but I cannot guarantee any ETA.

Codelax avatar Oct 07 '22 15:10 Codelax

Hi, has there been any changes to the cloud-init support recently? It appears that uncompressed base64 encoded multi-part cloud-init configuration stopped working as well today.

mikroskeem avatar Oct 14 '22 17:10 mikroskeem

Now when I pass multipart data raw without base64, then it starts working.

mikroskeem avatar Oct 14 '22 18:10 mikroskeem

It should not have been working with base64, you can use raw while waiting for instance product to add this functionality to its cloudinit datasource. There has been no changes recently, cloudinit datasource is opensource and you can look it up on cloudinit repo to find recent changes. Update maybe slow to arrive as updating it on cloudinit repo will take a while to release and be integrated in latest linux distributions. I close this issue as this is not an issue with terraform provider

Codelax avatar Oct 25 '22 09:10 Codelax