Steps to replicate the issue (include links if applicable):
Familiarity with Terraform/OpenTofu is assumed.
Create a new folder and place the following file inside:
terraform {
required_providers {
cloudvps = {
source = "terraform.wmcloud.org/registry/cloudvps"
version = "~> 0.3"
}
}
required_version = "~> 1.9.0"
}
provider "cloudvps" {
os_project_id = "account-creation-assistance"
}
resource "cloudvps_puppet_prefix" "testinstances" {
name = "accounts-testinstance"
hiera = <<-EOT
profile::systemd::timesyncd::ntp_servers:
- ntp.ubuntu.com
EOT
}Create a new application credential in Horizon and download the openrc file. Source it into your terminal.
tofu init and tofu plan -out tfplan. You should get a plan output that looks something like this:
# cloudvps_puppet_prefix.testinstances will be created
+ resource "cloudvps_puppet_prefix" "testinstances" {
+ hiera = <<-EOT
profile::systemd::timesyncd::ntp_servers:
- ntp.ubuntu.com
EOT
+ id = (known after apply)
+ name = "accounts-testinstance"
}
Plan: 1 to add, 0 to change, 0 to destroy.Finally, tofu apply tfplan to apply the changes and trigger the error.
What happens?:
cloudvps_puppet_prefix.testinstances: Creating...
╷
│ Error: Unable to update prefix
│
│ with cloudvps_puppet_prefix.testinstances,
│ on testinstances.tf line 64, in resource "cloudvps_puppet_prefix" "testinstances":
│ 64: resource "cloudvps_puppet_prefix" "testinstances" {
│
│ Unable to update prefix 21866: Expected HTTP response code [200] when
│ accessing [PUT
│ https://puppet-enc.cloudinfra.wmcloud.org/v1/account-creation-assistance/prefix/id/21866],
│ but got 500 instead: <!doctype html>
│ <html lang=en>
│ <title>500 Internal Server Error</title>
│ <h1>Internal Server Error</h1>
│ <p>The server encountered an internal error and was unable to complete your
│ request. Either the server is overloaded or there is an error in the
│ application.</p>
╵
Error: OpenTofu exited with code 1.
Error: Process completed with exit code 1.The prefix is created in Horizon, but the Hiera configuration isn't applied.
What should have happened instead?:
The provider should have created the Puppet prefix with the Hiera configuration correctly defined. If there is a genuine problem with the Hiera configuration given, then a proper error should be returned.
In either case, since the prefix itself is created, I would expect the resource to be added to state in some form.
Software version:
$ terraform -version OpenTofu v1.9.1 on linux_amd64 + provider terraform.wmcloud.org/registry/cloudvps v0.3.0
Other information (browser name/version, screenshots, etc.):