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

Documentation Updates #238

Merged
merged 12 commits into from
Sep 26, 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
77 changes: 32 additions & 45 deletions website/docs/index.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ layout: "selectel"
page_title: "Provider: Selectel"
sidebar_current: "docs-selectel-index"
description: |-
The Selectel provider is used to interact with the Selectel resources. The provider requires service user.
Use the Selectel provider to manage Selectel products.
---

# Selectel provider

The Selectel provider is used to interact with the Selectel resources. The provider
requires service user that can be created on [users' management](https://my.selectel.ru/profile/users_management/users) page.
Use the Selectel provider to manage [Selectel products](https://docs.selectel.ru/).

To interact with resources that are available via OpenStack API, you can also use [OpenStack Terraform provider](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/latest).
To manage resources available via OpenStack API, use [OpenStack Terraform provider](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/latest).

## Example Usage

Expand All @@ -20,15 +19,9 @@ terraform {
required_providers {
selectel = {
source = "selectel/selectel"
version = "~> 3.11.0"
version = "~> 4.0.1"
}
}

# Configure the Selectel Provider
provider "selectel" {
domain_name = "999999"
username = "example_user"
password = "example_password"
}

# Create a Cloud Platform project
Expand All @@ -37,56 +30,50 @@ resource "selectel_vpc_project_v2" "project_1" {
}
```

## Authentication
## Authentication (4.0.0 and later)

```hcl
# Configure the Selectel provider

provider "selectel" {
domain_name = "123456"
username = "user"
password = "password"
}
```

## Argument Reference (4.0.0 and later)

The following arguments are supported:
* `domain_name` - (Required) Selectel account ID. The account ID is in the top right corner of the [Control panel](https://my.selectel.ru/). For import, use the value in the `OS_DOMAIN_NAME` environment variable. Learn more about [Registration](https://docs.selectel.ru/control-panel-actions/account/registration/).

* `username` - (Required) Service user username. Reference to OpenStack-like `OS_USERNAME` environment variable.
* `password` - (Required) Service user password. Reference to OpenStack-like `OS_PASSWORD` environment variable.
* `domain_name` - (Required) Your domain name i.e. your account id. Reference to OpenStack-like `OS_DOMAIN_NAME` environment variable.
* `username` - (Required) Name of the service user. To get the name, in the top right corner of the [Control panel](https://my.selectel.ru/profile/users_management/users?type=service), go to the account menu ⟶ **Profile and Settings** ⟶ **User management** ⟶ the **Service users** tab ⟶ copy the name of the required user. For import, use the value in the `OS_USERNAME` environment variable. Learn more about [Service users](https://docs.selectel.ru/control-panel-actions/users-and-roles/user-types-and-roles/) and [how to create service user](https://docs.selectel.ru/control-panel-actions/users-and-roles/add-user/#добавить-сервисного-пользователя).

* `user_domain_name` - (Optional) A specific field for users who were created in a different domain
but assigned a role in a different domain. You probably don't need to use this field in public cloud.
Reference to OpenStack-like `OS_USER_DOMAIN_NAME` environment variable.
* `password` - (Required, Sensitive) Password of the service user. For import, use the value in the `OS_PASSWORD` environment variable.

* `auth_url` - (Optional) Keystone address to authenticate via user credentials.
If omitted, the provider will use default endpoint automatically.
Reference to OpenStack-like `OS_AUTH_URL` environment variable.
* `user_domain_name` - (Optional) Selectel account ID. Use only for users that were created and assigned a role in a different account. Applicable only to public cloud. The account ID is in the top right corner of the [Control panel](https://my.selectel.ru/). For import, use the value in the `OS_USER_DOMAIN_NAME` environment variable.

* `project_id` - (Optional) The Selectel VPC project. Used only to import
resources that need an auth token in the project scope. If omitted,
the `SEL_PROJECT_ID` environment variable is used.
* `auth_url`- (Optional) Keystone Identity authentication URL for authentication via user credentials. If skipped, the provider uses the default endpoint. For import, use the value in the `OS_AUTH_URL` environment variable.

* `region` - (Optional) The Selectel VPC region. Used only to import resources
associated with the specific region. If omitted, the `SEL_REGION` environment
variable is used.
* `project_id` - (Optional) Unique identifier of the Cloud Platform project. Use only to import resources that are associated with the specific project. To get the ID, in the [Control panel](https://my.selectel.ru/vpc/), go to the **Cloud Platform** ⟶ project name ⟶ copy the ID of the required project. As an alternative, you can retrieve project ID from the [selectel_vpc_project_v2](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/vpc_project_v2) resource. If skipped, use the `SEL_PROJECT_ID` environment variable. Learn more about [Cloud Platform projects](https://docs.selectel.ru/cloud/servers/about/projects/).

* `region` - (Optional) Pool, for example, `ru-3`. Use only to import resources from the specific pool. If skipped, use the `SEL_REGION` environment variable. Learn more about available pools in the [Availability matrix](https://docs.selectel.ru/control-panel-actions/availability-matrix/).

## Additional Logging
To enable debug logging, set the `TF_LOG` environment variable to `DEBUG`:
## Authentication (up to 3.11.0)

```hcl
# Configure the Selectel provider

provider "selectel" {
token = "<selectel_token>"
token = "Kfpfdf7fjdv0_123456"
}
```

## Argument Reference (up to 3.11.0)

## Argument Reference

* `token` - (Required) Selectel token. To get the token, in the top right corner of the [Control panel](https://my.selectel.ru/profile/apikeys), go to the account menu ⟶ **Profile and Settings** ⟶ **API keys** ⟶ copy the token. Learn more about [Selectel token](https://developers.selectel.ru/docs/control-panel/authorization/#получить-токен-selectel). If skipped, use the `SEL_TOKEN` environment variable.
* `token` - (Required) Selectel token. To get the token, in the top right corner of the [Control panel](https://my.selectel.ru/profile/apikeys), go to the account menu ⟶ **Profile and Settings** ⟶ **API keys** ⟶ copy the token. Learn more about [Selectel token](https://developers.selectel.ru/docs/control-panel/authorization/#получить-токен-selectel).

* `endpoint` - (Optional) Selectel API endpoint. Use only for test environments. If skipped, the provider automatically uses the official Selectel endpoint.

* `project_id` - (Optional) Unique identifier of the Cloud Platform project. Use only to import resources that are associated with the specific project. To get the ID, in the [Control panel](https://my.selectel.ru/vpc/), go to the **Cloud Platform** ⟶ project name ⟶ copy the ID of the required project. As an alternative, you can retrieve project ID from the [selectel_vpc_project_v2](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/vpc_project_v2) resource. Learn more about [Cloud Platform projects](https://docs.selectel.ru/cloud/servers/about/projects/). If skipped, use the `SEL_PROJECT_ID` environment variable.

* `region` - (Optional) Pool, for example, `ru-3`. Use only to import resources from the specific pool. Learn more about available pools in the [Availability matrix](https://docs.selectel.ru/control-panel-actions/availability-matrix/). If skipped, use the `SEL_REGION` environment variable.

In order to run the Acceptance Tests for development you need to set
auth credentials environment variables:

```shell
$ export OS_DOMAIN_NAME=999999
$ export OS_USERNAME=example_user
$ export OS_PASSWORD=example_password
$ env TF_ACC=1 go test -v ./selectel/...
```

30 changes: 11 additions & 19 deletions website/docs/r/craas_registry_v1.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ resource "selectel_craas_registry_v1" "registry_1" {

* `name` - (Required) Registry name. Changing this creates a new registry. The name can contain lowercase latin characters, digits, and hyphens. The name starts with a letter and ends with a letter or a digit. It cannot exceed 20 symbols. Learn more about [Registries in Container Registry](https://docs.selectel.ru/cloud/craas/registry/).

* `project_id` - (Required) Unique identifier of the associated Cloud Platform project. Changing this creates a new registry. Retrieved from the [selectel_vpc_project_v2](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/vpc_project_v2) resource. Learn more about [Cloud Platform projects](https://docs.selectel.ru/cloud/servers/about/projects/).
* `project_id` - (Required) Unique identifier of the associated Cloud Platform project. Changing this creates a new registry. Retrieved from the [selectel_vpc_project_v2](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/vpc_project_v2) resource. Learn more about [Cloud Platform projects](https://docs.selectel.ru/cloud/craas/about/projects/).

## Attributes Reference

Expand All @@ -36,29 +36,21 @@ resource "selectel_craas_registry_v1" "registry_1" {
You can import a registry:

```shell
<<<<<<< HEAD
export OS_DOMAIN_NAME=<account_id>
export OS_USERNAME=<username>
export OS_PASSWORD=<password>
export SEL_PROJECT_ID=<selectel_project_id>
terraform import selectel_craas_registry_v1.registry_1 <registry_id>
=======
$ export OS_DOMAIN_NAME=999999
$ export OS_USERNAME=example_user
$ export OS_PASSWORD=example_password
$ export SEL_PROJECT_ID=SELECTEL_VPC_PROJECT_ID
$ terraform import selectel_craas_registry_v1.registry_1 939506d6-7621-4581-b673-eacf3db30f5b
>>>>>>> ceb748d (Move domains resources to keystone auth)
```

where `<registry_id>` is a unique identifier of the registry, for example, `939506d6-7621-4581-b673-eacf3db30f5b`. To get the registry ID, use [Selectel Cloud Management API](https://developers.selectel.ru/docs/selectel-cloud-platform/craas_api/).

### Environment Variables

For import, you must set environment variables:
where:

* `SEL_TOKEN=<selectel_api_token>`
* `<account_id>` — Selectel account ID. The account ID is in the top right corner of the [Control panel](https://my.selectel.ru/). Learn more about [Registration](https://docs.selectel.ru/control-panel-actions/account/registration/).

* `SEL_PROJECT_ID=<selectel_project_id>`
* `<username>` — Name of the service user. To get the name, in the top right corner of the [Control panel](https://my.selectel.ru/profile/users_management/users?type=service), go to the account menu ⟶ **Profile and Settings** ⟶ **User management** ⟶ the **Service users** tab ⟶ copy the name of the required user. Learn more about [Service users](https://docs.selectel.ru/control-panel-actions/users-and-roles/user-types-and-roles/).

where:
* `<password>` — Password of the service user.

* `<selectel_api_token>` — Selectel token. To get the token, in the top right corner of the [Control panel](https://my.selectel.ru/profile/apikeys), go to the account menu ⟶ **Profile and Settings** ⟶ **API keys** ⟶ copy the token. Learn more about [Selectel token](https://developers.selectel.ru/docs/control-panel/authorization/#получить-токен-selectel).
* `<selectel_project_id>` — Unique identifier of the associated Cloud Platform project. To get the project ID, in the [Control panel](https://my.selectel.ru/vpc/), go to **Cloud Platform** ⟶ project name ⟶ copy the ID of the required project. Learn more about [Cloud Platform projects](https://docs.selectel.ru/cloud/craas/about/projects/).

* `<selectel_project_id>` — Unique identifier of the associated Cloud Platform project. To get the project ID, in the [Control panel](https://my.selectel.ru/vpc/), go to Cloud Platform ⟶ project name ⟶ copy the ID of the required project. Learn more about [Cloud Platform projects](https://docs.selectel.ru/cloud/managed-kubernetes/about/projects/).
* `<registry_id>` — Unique identifier of the registry, for example, `939506d6-7621-4581-b673-eacf3db30f5b`. To get the registry ID, use [Selectel Cloud Management API](https://developers.selectel.ru/docs/selectel-cloud-platform/craas_api/).
2 changes: 1 addition & 1 deletion website/docs/r/craas_token_v1.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ echo $REGISTRY_TOKEN | docker login cr.selcloud.ru --username $REGISTRY_USERNAME

## Argument Reference

* `project_id` - (Required) Unique identifier of the associated Cloud Platform project. Changing this creates a new token. Retrieved from the [selectel_vpc_project_v2](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/vpc_project_v2) resource. Learn more about [Cloud Platform projects](https://docs.selectel.ru/cloud/servers/about/projects/).
* `project_id` - (Required) Unique identifier of the associated Cloud Platform project. Changing this creates a new token. Retrieved from the [selectel_vpc_project_v2](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/vpc_project_v2) resource. Learn more about [Cloud Platform projects](https://docs.selectel.ru/cloud/craas/about/projects/).

* `token_ttl` - (Optional) Token lifetime. Changing this creates a new token. Available values are `1y` for a year and `12h` for 12 hours. The default value is `1y`.

Expand Down
21 changes: 2 additions & 19 deletions website/docs/r/dbaas_grant_v1.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ resource "selectel_dbaas_grant_v1" "grant_1" {

## Argument Reference

* `project_id` - (Required) Unique identifier of the associated Cloud Platform project. Changing this creates a new privilege for the user. Retrieved from the [selectel_vpc_project_v2](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/vpc_project_v2) resource. Learn more about [Cloud Platform projects](https://docs.selectel.ru/cloud/servers/about/projects/).
* `project_id` - (Required) Unique identifier of the associated Cloud Platform project. Changing this creates a new privilege for the user. Retrieved from the [selectel_vpc_project_v2](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/vpc_project_v2) resource. Learn more about [Cloud Platform projects](https://docs.selectel.ru/cloud/managed-databases/about/projects/).

* `region` - (Required) Pool where the database is located, for example, `ru-3`. Changing this creates a new privilege for the user.

Expand All @@ -50,21 +50,4 @@ resource "selectel_dbaas_grant_v1" "grant_1" {

## Attributes Reference

* `status` - Status of the user privilege.

* The following attributes are exported:

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

## Import

Grant can be imported using the `id`, e.g.

```shell
$ export OS_DOMAIN_NAME=999999
$ export OS_USERNAME=example_user
$ export OS_PASSWORD=example_password
$ export SEL_PROJECT_ID=SELECTEL_VPC_PROJECT_ID
$ export SEL_REGION=SELECTEL_VPC_REGION
$ terraform import selectel_dbaas_grant_v1.grant_1 b311ce58-2658-46b5-b733-7a0f418703f2
```
* `status` - Status of the user privilege.
Loading