Skip to content

Commit

Permalink
Support for Kypo 23.12 (#61)
Browse files Browse the repository at this point in the history
* Remove KYPO client_id from tests

* Test updated kypo-go-client

* Await creation of sandbox allocation request

* Bump kypo-go-client
  • Loading branch information
vydrazde authored Dec 21, 2023
1 parent 202c269 commit 0ecc966
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/hashicorp/terraform-plugin-go v0.20.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-testing v1.6.0
github.com/vydrazde/kypo-go-client v0.0.0-20231217200146-31f2dac2e92b
github.com/vydrazde/kypo-go-client v0.0.0-20231221213600-5f90f013e7b3
golang.org/x/exp v0.0.0-20231214170342-aacd6d4b4611
)

Expand Down
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAh
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
github.com/vydrazde/kypo-go-client v0.0.0-20231217200146-31f2dac2e92b h1:5yI40Xzyfh2J3BRFSsnms5RRGSdJRS6VEOS175XwWlA=
github.com/vydrazde/kypo-go-client v0.0.0-20231217200146-31f2dac2e92b/go.mod h1:N756jaC76zZZVHs0yXsURRQ315Aby7eXhwWE3F9Pkac=
github.com/vydrazde/kypo-go-client v0.0.0-20231221183929-b00e429cced4 h1:5Z1IJrpT3Cr7r9pnJMukNTI/ARwweQOb3OIlZE3kmA0=
github.com/vydrazde/kypo-go-client v0.0.0-20231221183929-b00e429cced4/go.mod h1:N756jaC76zZZVHs0yXsURRQ315Aby7eXhwWE3F9Pkac=
github.com/vydrazde/kypo-go-client v0.0.0-20231221202223-35acdb8f3277 h1:8vHYkmLlJM4Su0hJ5apNMVE+Ry8v5uhDEorVXDwQPd0=
github.com/vydrazde/kypo-go-client v0.0.0-20231221202223-35acdb8f3277/go.mod h1:N756jaC76zZZVHs0yXsURRQ315Aby7eXhwWE3F9Pkac=
github.com/vydrazde/kypo-go-client v0.0.0-20231221204616-9d0b6eaa5871 h1:Ey4z+/GoVewgwKeN0EcuE19bJiFNRiHk4TtBqhue/pg=
github.com/vydrazde/kypo-go-client v0.0.0-20231221204616-9d0b6eaa5871/go.mod h1:N756jaC76zZZVHs0yXsURRQ315Aby7eXhwWE3F9Pkac=
github.com/vydrazde/kypo-go-client v0.0.0-20231221211455-5c78c8324d91 h1:dFKdPzpHiNhVB1F58KiBHOfCawqQchqE95lAg/2E/qo=
github.com/vydrazde/kypo-go-client v0.0.0-20231221211455-5c78c8324d91/go.mod h1:N756jaC76zZZVHs0yXsURRQ315Aby7eXhwWE3F9Pkac=
github.com/vydrazde/kypo-go-client v0.0.0-20231221213600-5f90f013e7b3 h1:nAAtF6SDEUguhdotLZqxEbeCMUtXWs/4WvlBfMw+m4E=
github.com/vydrazde/kypo-go-client v0.0.0-20231221213600-5f90f013e7b3/go.mod h1:N756jaC76zZZVHs0yXsURRQ315Aby7eXhwWE3F9Pkac=
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/zclconf/go-cty v1.14.1 h1:t9fyA35fwjjUMcmL5hLER+e/rEPqrbCK1/OSE4SI9KA=
Expand Down
1 change: 0 additions & 1 deletion internal/provider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const (
providerConfig = `
provider "kypo" {
endpoint = "https://images.crp.kypo.muni.cz"
client_id = "bzhwmbxgyxALbAdMjYOgpolQzkiQHGwWRXxm"
}
`
gitlabProviderConfig = `
Expand Down
8 changes: 7 additions & 1 deletion internal/provider/sandbox_allocation_unit_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,13 @@ func (r *sandboxAllocationUnitResource) Create(ctx context.Context, req resource
return
}

allocationRequest, err := r.client.PollRequestFinished(ctx, allocationUnit.AllocationRequest.Id, pollTimeCreate, "allocation")
err = r.client.AwaitAllocationRequestCreate(ctx, allocationUnit.Id, pollTimeCreate)
if err != nil {
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to create sandbox allocation request, got error: %s", err))
return
}

allocationRequest, err := r.client.PollRequestFinished(ctx, allocationUnit.Id, pollTimeCreate, "allocation")
if err != nil {
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("awaiting allocation request failed, got error: %s", err))
return
Expand Down

0 comments on commit 0ecc966

Please sign in to comment.