VK Cloud logo

Testing manifests with the deployment system

After locally testing the Terraform manifests and before uploading the service package to the store, it is recommended to test the plans/<PLAN_NAME>/deployment/deploy.tf manifests with the deployment system. This will make sure that all described resources can be created by the deployment system.

The testing process will require:

  • A key for API access. The key is displayed in the cloud platform management console on the project settings page (the tab with information about API access).
  • The domain name of the cloud platform — https://cloud.vk.ru.

To test a Terraform manifest with the deployment system:

  1. In the cloud platform management console, enable two-factor authentication (2FA) and API access (for more details, see the section Managing 2FA).

  2. Perform the API requests:

    1. Upload the manifest to the deployment system.
    2. Check the current configuration of the uploaded manifest.
    3. Create a service instance.
    4. Delete the service instance.

    The API request parameters are described in the following sections.

Uploading a Terraform manifest to the deployment system

To upload the plans/<PLAN_NAME>/deployment/deploy.tf manifest to the deployment system, make a request with the parameters given in table 1.

Table 1 — Manifest upload request parameters

Parameter

Value

Request method

POST

Request path

https://<CLOUD_HOST>/marketplace/api/infra-api/api/v1-public/hoe/config/<MANIFEST_NAME>

Here:

  • <CLOUD_HOST> — the domain name of the cloud platform.
  • <MANIFEST_NAME> — the manifest name

Request body (--data-binary)

The contents of the plans/<PLAN_NAME>/deployment/deploy.tf manifest.

If additional provider resources are required for testing, add them to the request body

x-auth-token

<AUTH_TOKEN> — the key for API access

Example of a manifest upload request
curl -v -X POST https://cloud.vk.ru/marketplace/api/infra-api/api/v1-public/hoe/config/test_1.0 \-H 'x-auth-token: <AUTH_TOKEN>' \--data-binary "@deploy.tf"

HTTP response codes are given in table 2.

Table 2 — HTTP response codes

Code

Description

201

The manifest has been uploaded or updated

400, 500

Request execution error

401

Authorization error

When sending a request with a manifest name that already exists in the deployment system, the configuration of that manifest will be updated.

Manifests are uploaded within a single user account.

All previously uploaded manifest configurations are stored in the deployment system to ensure correct Terraform operation. The service instance is deployed with the current manifest configuration, which can be viewed using the GET request /hoe/config/<MANIFEST_NAME> (for more details, see the section Checking the current Terraform manifest configuration).

Checking the current Terraform manifest configuration

To check the current Terraform manifest configuration stored in the deployment system, make a request with the parameters given in table 3.

Table 3 — Request parameters for checking the current manifest configuration

Parameter

Value

Request method

GET

Request path

https://<CLOUD_HOST>/marketplace/api/infra-api/api/v1-public/hoe/config/<MANIFEST_NAME>

Here:

  • <CLOUD_HOST> — the domain name of the cloud platform.
  • <MANIFEST_NAME> — the manifest name

x-auth-token

<AUTH_TOKEN> — the key for API access

Example of a request to check the current manifest configuration
curl https://cloud.vk.ru/marketplace/api/infra-api/api/v1-public/hoe/config/test_1.0 \-H 'x-auth-token: <AUTH_TOKEN>'

HTTP response codes are given in table 4.

Table 4 — HTTP response codes

Code

Description

200

The request has been completed.

The response contains the current configuration of the specified Terraform manifest

401

Authorization error

404

Manifest not found

500

Request execution error

Creating a service instance

To create a service instance, make a request with the parameters given in table 5. The resources of the current Terraform manifest configuration will be created.

Table 5 — Service instance creation request parameters

Parameter

Value

Request method

POST

Request path

https://<CLOUD_HOST>/marketplace/api/infra-api/api/v1-public/hoe/object

Here <CLOUD_HOST> is the domain name of the cloud platform

Content-Type

application/json

Request body (--data)

Specify the following parameters:

  • uuid — the service instance identifier generated using the UUID4 generator.
  • config — the manifest name.
  • vars — external input variables of the manifest. Setting values for these variables in the request body imitates user actions in the tariff plan configuration wizard.

x-auth-token

<AUTH_TOKEN> — the key for API access

Example of a service instance creation request
curl -v -X POST https://cloud.vk.ru/marketplace/api/infra-api/api/v1-public/hoe/object \-H "Content-Type: application/json" \-H 'x-auth-token: <AUTH_TOKEN>' \--data '{  "uuid": "675f6f08-XXXX-f02311f795d7",  "config": "test_1.0",  "vars": {    "sub_network": "a793470c-XXXX-67af6c178c8e",    "image_uuid": "163ff752-XXXX-b0001e3e65d3",    "volume_type": "ceph-ssd",    "flavor_uuid": "6e61564f-XXXX-08df5fd84514"  }  }'

Here:

  • sub_network — the subnet ID.
  • image_uuid — the service image ID.
  • volume_type — the disk type.
  • flavor_uuid — the VM flavor ID.

HTTP response codes are given in table 6.

Table 6 — HTTP response codes

Code

Description

201

The service instance has been created

400, 500

Request execution error

401

Authorization error

Deleting a service instance

To delete the service instance created as a result of executing the Terraform manifest, make a request with the parameters given in table 7.

Table 7 — Service instance deletion request parameters

Parameter

Value

Request method

DELETE

Request path

https://<CLOUD_HOST>/marketplace/api/infra-api/api/v1-public/hoe/object/<OBJECT_UUID>

Here:

  • <CLOUD_HOST> — the domain name of the cloud platform.
  • <OBJECT_UUID> — the service instance deployment identifier. The value corresponds to the uuid parameter in the service instance deployment request

x-auth-token

<AUTH_TOKEN> — the key for API access

Example of a service instance deletion request
curl -v -X DELETE https://cloud.vk.ru/marketplace/api/infra-api/api/v1-public/hoe/object/675f6f08-XXXX-f02311f795d7 \-H 'x-auth-token: <AUTH_TOKEN>'

HTTP response codes are given in table 8.

Table 8 — HTTP response codes

Code

Description

201

The service instance has been deleted

400, 500

Request execution error

401

Authorization error

404

Manifest not found

Checking the service instance state

To check the service instance state, make a request with the parameters given in table 9.

Table 9 — Service instance state check request parameters

Parameter

Value

Request method

GET

Request path

https://<CLOUD_HOST>/marketplace/api/infra-api/api/v1-public/hoe/object/<OBJECT_UUID>

Here:

  • <CLOUD_HOST> — the domain name of the cloud platform.
  • <OBJECT_UUID> — the service instance deployment identifier. The value corresponds to the uuid parameter in the service instance deployment request

x-auth-token

<AUTH_TOKEN> — the key for API access

Example of a service instance state check request
curl https://cloud.vk.ru/marketplace/api/infra-api/api/v1-public/hoe/object/675f6f08-XXXX-f02311f795d7 \-H 'x-auth-token: <AUTH_TOKEN>'

HTTP response codes are given in table 10.

Table 10 — HTTP response codes

Code

Description

200

The request has been completed.

The response contains the service instance status (status). Possible statuses:

  • applying — the manifest is being executed, resources are in the process of being created.
  • running — the manifest has been executed, the service instance has been created.
  • failed — the manifest has completed with an error, the service instance has not been created.
  • deleted — the service instance has been deleted

401

Authorization error

404

Service instance identifier not found

500

Request execution error

Example of a response to a request made after service instance deletion
{    "uuid": "675f6f08-XXXX-f02311f795d7",    "target_status": "deleted",    "vars": {},    "out": "{}",    "status": "deleted",    "conf_name": "user@vk.team",    "conf_hash": "75587baeXXXX",    "pid": "b66dde3dXXXX",    "create_at": "2023-04-26T13:57:54.849565Z",    "update_at": "2023-04-26T14:02:42.667399Z",    "full_deployed": false,    "attempts": 0,    "max_attempts": 15}

Here:

  • uuid — the service instance deployment identifier.
  • target_status — the target status of the service instance (deleted or running).
  • vars — the input variables of the manifest.
  • out — the output parameters of the manifest.
  • status — the current status of the service instance.
  • conf_name — the name of the user who deployed the service.
  • conf_hash — the configuration hash of the service instance.
  • pid — the identifier of the project of the user who deployed the service (OpenStack PID).
  • create_at — the date and time when the service instance was created.
  • update_at — the date and time of the last service instance update by the deployment system.
  • full_deployed — whether the service instance has been successfully deployed (for the deleted status the value is false).
  • attempts — the number of retries performed when deploying the service instance.
  • max_attempts — the maximum number of retries.

Viewing service instance logs

To view the service instance log, make a request with the parameters given in table 11.

Table 11 — Service instance log output request parameters

Parameter

Value

Request method

GET

Request path

https://<CLOUD_HOST>/marketplace/api/infra-api/api/v1-public/logs/instance/<OBJECT_UUID>

Here:

  • <CLOUD_HOST> — the domain name of the cloud platform.
  • <OBJECT_UUID> — the service instance deployment identifier. The value corresponds to the uuid parameter in the service instance deployment request

x-auth-token

<AUTH_TOKEN> — the key for API access

Example of a service instance log output request
curl https://cloud.vk.ru/marketplace/api/infra-api/api/v1-public/logs/instance/675f6f08-XXXX-f02311f795d7 \-H 'x-auth-token: <AUTH_TOKEN>'

HTTP response codes are given in table 12.

Table 12 — HTTP response codes

Code

Description

200

The request has been completed.

The response to the request contains the service instance logs in the message parameter

401

Authorization error

404

Service instance identifier not found

500

Request execution error

Example of a response to the request
[  {    "message": " Apply complete! Resources: 1 added, 0 changed, 0 destroyed. ",    "src": "terraform",    "level": "debug",    "created_at": "2024-05-30T08:32:24Z",    "uuid": "675f6f08-XXXX-f02311f795d7",    "broker_id": ""  }]

Viewing agent logs and results

To view the agent logs and results:

  1. Connect to the VM where the agent is installed via a remote access protocol (for more details, see the section Connecting to a VM) or using the VNC console in the cloud platform management console.

  2. To view the logs, run the journalctl -u sower command.

  3. To view the results, go to the /etc/sower/result directory.

Was this article helpful?