Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRaaS V1: extend schema for registry resource #233

Merged
merged 1 commit into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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