HomeSecurity & IdentitySecret ManagerAPI/CLI
Creating and migrating a secret into a folder using the CLI and Go
Update content

Creating and migrating a secret into a folder using the CLI and Go

Reviewed on 03 October 2023Published on 03 October 2023

This documentation allows you to create a secret called ultra-confidential, a folder called /confidential-folder and to migrate the ultra-confidential secret into /confidential-folder using the Scaleway CLI and the Go programming language.

Security & Identity (IAM):

You may need certain IAM permissions to carry out some actions described on this page. This means:

  • you are the Owner of the Scaleway Organization in which the actions will be carried out, or
  • you are an IAM user of the Organization, with a policy granting you the necessary permission sets
Requirements:
  1. Open a terminal and run the following command to clone the repository containing the code you need to complete the procedure:

    git clone git@github.com:scaleway/tutorial-sem-folder-migrate.git
  2. In the same terminal, paste the following commands to export your environment variables. Make sure you add your own variables.

    export SCW_ACCESS_KEY=<Scaleway access key>
    export SCW_SECRET_KEY=<Scaleway secret key>
    export SCW_DEFAULT_ORGANIZATION_ID=<Scaleway default Organization>
    export SCW_DEFAULT_PROJECT_ID=<Scaleway default Project>
    export SCW_DEFAULT_REGION="fr-par"
    export SCW_API_URL="https://api.scaleway.com"
  3. Use the following command to access the tutorial-sem-folder-migrate directory:

    cd tutorial-sem-folder-migrate
  4. Run go run ./main.go to launch the creation of your secret, your folder and the migration process.

Tip:

Refer to the dedicated documentation to learn how to migrate existing secrets into folders using the CLI and Go.