Skip to content

ionoscloud_container_registry_token leads to 502/504 #836

@jplitza

Description

@jplitza

Description

When creating several ionoscloud_container_registry_token resources in one apply, it seems to overload the API, which returns either 502 or 504.

However, the tokens are actually created! This causes subsequent applies to complain about the name being unavailable.

Expected behavior

Ideally, all resources would be created successfully.

Second best, the resources would be recorded in the state, but marked as tainted. This is what other providers (like aws) do in such a case. Then Terraform would refresh their state before the next run and destroy them if they exist.

Environment

Terraform version:

OpenTofu v1.9.1

Provider version:

+ provider registry.opentofu.org/ionos-cloud/ionoscloud v6.7.7

OS:

Ubuntu 24.04

Configuration Files

How to Reproduce

resource "ionoscloud_container_registry" "test" {
  name = "loadtest"
  location = "de/fra"
}

resource "ionoscloud_container_registry_token" "test" {
  registry_id = ionoscloud_container_registry.registry.id
  name = "test-${each.value}"
  status = "enabled"
  scopes {
    actions = [ "pull" ]
    name = "*"
    type = "repository"
  }
  count = 20
}

Error and Debug Output

│ Error: an error occurred while creating the registry token: 504 Gateway Timeout: <html>
│ <head><title>504 Gateway Time-out</title></head>
│ <body>
│ <center><h1>504 Gateway Time-out</h1></center>
│ <hr><center>nginx</center>
│ </body>
│ </html>

or

╷
│ Error: an error occurred while creating the registry token: 502 Bad Gateway: <html>
│ <head><title>502 Bad Gateway</title></head>
│ <body>
│ <center><h1>502 Bad Gateway</h1></center>
│ <hr><center>nginx</center>
│ </body>
│ </html>
│ 
│ 
│   with ionoscloud_container_registry_token.test[1],
│   on main.tf line 15, in resource "ionoscloud_container_registry_token" "test":
│   15: resource "ionoscloud_container_registry_token" "test" {
│ 
$ tofu state show 'ionoscloud_container_registry_token.test[1]'
No instance found for the given address!
$ ionosctl container-registry token list -r b656d729-34fc-4c40-91fb-e52b5487d1ec | grep test-1
2858fcd3-b0f4-4fb4-9fac-a361f650a43a   test-1        test-1                enabled   b656d729-34fc-4c40-91fb-e52b5487d1ec

Additional Notes

References

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions