Skip to content

fix(compute): allow unlisted template IDs - #888

Open
natalie-o-perret wants to merge 15 commits into
masterfrom
fix/unlisted-template-ids
Open

fix(compute): allow unlisted template IDs#888
natalie-o-perret wants to merge 15 commits into
masterfrom
fix/unlisted-template-ids

Conversation

@natalie-o-perret

@natalie-o-perret natalie-o-perret commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Description

Some valid public template IDs, including templates used by A1, are intentionally omitted from ListTemplates. Compute commands currently treat that list as an existence check and reject those IDs before the authoritative API sees them.

This change passes UUID template references directly to the create and update APIs while retaining list lookup for template names. It covers instance create/reset and instance pool create/update.

It preserves #882's template-size handling by trying GetTemplate for UUID metadata while treating lookup failure as unavailable metadata, not proof that the UUID is invalid.

Checklist

(For exoscale contributors)

  • Changelog updated (under Unreleased block, and add the Pull Request #number for each bit you add to the CHANGELOG.md)
  • Testing

Testing

After merging current master, go fmt ./... and go mod tidy plus go mod vendor left the tree unchanged. make lint, go vet ./..., golangci-lint run --timeout 4m, make build, make test-verbose, API-free go test -v from tests/e2e, and govulncheck ./... passed. govulncheck reported zero reachable vulnerabilities.

Local fake: valid unlisted UUID

Before: merged master rejects the UUID

A local fake API omitted fixture template aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa from ListTemplates while allowing direct metadata lookup and instance creation with that UUID. The build from merged master at f9f3ec55 rejected it before calling the create API:

$ ./bin/exo compute instance create --zone ch-gva-2 \
    --ssh-key fake-key \
    --template aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa \
    pr888-unlisted-template

error: no template "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa" found with visibility public in zone ch-gva-2

After: PR head creates the instance

The build from this PR at 0045d794 completed the same command and sent the UUID to the create API:

$ ./bin/exo compute instance create --zone ch-gva-2 \
    --ssh-key fake-key \
    --template aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa \
    pr888-unlisted-template

Creating instance "pr888-unlisted-template"... 0s

|            COMPUTE INSTANCE             |                                      |
|-----------------------------------------|--------------------------------------|
| ID                                      | 11111111-1111-1111-1111-111111111111 |
| Name                                    | pr888-unlisted-template              |
| Creation Date                           | 2026-08-10 13:30:00 +0000 UTC        |
| Instance Type                           | standard.medium                      |
| Template                                | A1 Hidden Template                   |
| Zone                                    | ch-gva-2                             |
| Anti-Affinity Groups                    | n/a                                  |
| Deploy Target                           | -                                    |
| Security Groups                         | n/a                                  |
| Private Instance                        | No                                   |
| Private Networks                        | n/a                                  |
| Elastic IPs                             | n/a                                  |
| Public IP                               | inet4                                |
| IP Address                              | 192.0.2.10                           |
| IPv6 Address                            | -                                    |
| SSH Key                                 | fake-key                             |
| Disk Size                               | 50 GiB                               |
| State                                   | running                              |
| Labels                                  | n/a                                  |
| Secure Boot                             | false                                |
| Tpm                                     | false                                |
| Reverse DNS                             |                                      |
| Application-Consistent Snapshot enabled | false                                |

The fake recorded only GET /template?visibility=public before the failure on master. At PR head it recorded GET /template/aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa followed by POST /instance with that template ID. No cloud resources were created.

Actual API: nonexistent UUID

Both builds were also run against actual infrastructure in ch-gva-2 with the same nonexistent UUID and a temporary SSH key.

Merged master rejected the UUID during list lookup:

$ ./bin/exo compute instance create --zone ch-gva-2 \
    --instance-type standard.tiny \
    --ssh-key pr888-live-nonexistent-20260810 \
    --template aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa \
    pr888-live-nonexistent-20260810

error: no template "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa" found with visibility public in zone ch-gva-2

PR head passed the UUID to the actual create API, which remained authoritative and rejected it:

$ ./bin/exo compute instance create --zone ch-gva-2 \
    --instance-type standard.tiny \
    --ssh-key pr888-live-nonexistent-20260810 \
    --template aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa \
    pr888-live-nonexistent-20260810

Creating instance "pr888-live-nonexistent-20260810"... 0s
error: Not Found: Template not found

No instance was created. The temporary SSH key was deleted, and the final instance, instance-pool, and SSH-key lists were empty. This live check verifies that UUID validation moves to the authoritative API; it is not a live A1 success case because no real unlisted A1 template UUID was available.


Note

AI assistance: conflict resolution, test scaffolding, PR description.

@natalie-o-perret
natalie-o-perret changed the base branch from master to fix/template-disk-size-default August 4, 2026 17:21
@natalie-o-perret
natalie-o-perret marked this pull request as draft August 4, 2026 17:29
@natalie-o-perret

Copy link
Copy Markdown
Contributor Author

[SC-191635]

…into fix/unlisted-template-ids

# Conflicts:
#	cmd/compute/instance/instance_create.go
#	cmd/compute/instance_pool/instance_pool_create.go
…into fix/unlisted-template-ids

# Conflicts:
#	cmd/compute/instance/instance_create.go
#	cmd/compute/instance_pool/instance_pool_create.go
…into fix/unlisted-template-ids

# Conflicts:
#	CHANGELOG.md
…into fix/unlisted-template-ids

# Conflicts:
#	CHANGELOG.md
#	cmd/compute/instance/instance_create.go
#	cmd/compute/instance_pool/instance_pool_create.go
Base automatically changed from fix/template-disk-size-default to master August 10, 2026 12:32
…te-ids

# Conflicts:
#	CHANGELOG.md
#	cmd/compute/instance/instance_create.go
#	cmd/compute/instance_pool/instance_pool_create.go
@natalie-o-perret
natalie-o-perret marked this pull request as ready for review August 10, 2026 13:13
@natalie-o-perret
natalie-o-perret requested a review from a team August 10, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant