Skip to content

Commit

Permalink
CRaaS V1: extend schema for registry resource (#233)
Browse files Browse the repository at this point in the history
Add `endpoint` attribute to the `selectel_craas_registry_v1` resource.

Update the related acceptance test.

Update the documentation.
  • Loading branch information
kolsean authored Jun 30, 2023
1 parent 91a568f commit 428b87c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions selectel/craas.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import (
)

const (
craasV1Endpoint = "https://cr.selcloud.ru/api/v1"
craasV1TokenUsername = "token"
craasV1Endpoint = "https://cr.selcloud.ru/api/v1"
craasV1RegistryHostName = "cr.selcloud.ru"
craasV1TokenUsername = "token"
)

func waitForCRaaSRegistryV1StableState(
Expand Down
5 changes: 5 additions & 0 deletions selectel/resource_selectel_craas_registry_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ func resourceCRaaSRegistryV1() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"endpoint": {
Type: schema.TypeString,
Computed: true,
},
},
}
}
Expand Down Expand Up @@ -112,6 +116,7 @@ func resourceCRaaSRegistryV1Read(ctx context.Context, d *schema.ResourceData, me

d.Set("name", craasRegistry.Name)
d.Set("status", craasRegistry.Status)
d.Set("endpoint", fmt.Sprintf("%s/%s", craasV1RegistryHostName, craasRegistry.Name))

return nil
}
Expand Down
2 changes: 2 additions & 0 deletions selectel/resource_selectel_craas_registry_v1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func TestAccCRaaSRegistryV1Basic(t *testing.T) {

projectName := acctest.RandomWithPrefix("tf-acc")
registryName := acctest.RandomWithPrefix("tf-acc-reg")
registryEndpoint := fmt.Sprintf("%s/%s", craasV1RegistryHostName, registryName)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccSelectelPreCheck(t) },
Expand All @@ -36,6 +37,7 @@ func TestAccCRaaSRegistryV1Basic(t *testing.T) {
testAccCheckCRaaSRegistryV1Exists("selectel_craas_registry_v1.registry_tf_acc_test_1", &craasRegistry),
resource.TestCheckResourceAttr("selectel_craas_registry_v1.registry_tf_acc_test_1", "name", registryName),
resource.TestCheckResourceAttr("selectel_craas_registry_v1.registry_tf_acc_test_1", "status", "ACTIVE"),
resource.TestCheckResourceAttr("selectel_craas_registry_v1.registry_tf_acc_test_1", "endpoint", registryEndpoint),
),
},
},
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/craas_registry_v1.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ The following attributes are exported:

* `status` - Shows the current status of the registry.

* `endpoint` - Represents the endpoint of the container registry. Ex: `cr.selcloud.ru/my-registry`

## Import

Registry can be imported using the `id`, e.g.
Expand Down

0 comments on commit 428b87c

Please sign in to comment.