You need to enable JavaScript to run this app.
Container Registry

Container Registry

Copy page
Download PDF
Terraform
Obtaining temporary keys for logging into instances
Copy page
Download PDF
Obtaining temporary keys for logging into instances
This topic describes how to use Terraform to create a temporary key for a CR Standard Edition instance. After obtaining the temporary key, you can log in to the instance and push or pull images into the instance.​
tip​
Temporary keys are valid for one hour. If a key expires, execute the key creation command again to create a new one.​
Prerequisites​
You have completed the preparations for using Terraform in CR. For operation details, see Preparations.​
Procedure​
  1. Log in to the terminal where Terraform is installed.​
  1. Create a folder and a configuration file named main.tf in it.​
  • ​
    variable "common" {​
    type = object({​
    registry = string​
    region = string​
    })​
    default = {​
    # The name of the instance ​
    registry = "enterprise-1" ​
    # The region of the instance ​
    region = "cn-guangzhou" ​
    }​
    }​
    ​
    provider "volcengine" {​
    # The AK of your Volcano Engine root user ​
    access_key = "AKAPO****" ​
    # The SK of your Volcano Engine root user ​
    secret_key = "WXpre****'" ​
    region = var.common.region​
    }​
    ​
    # Query token​
    data "volcengine_cr_authorization_tokens" "label" {​
    registry = var.common.registry​
    output_file = "token"​
    }​
    ​
  1. Initialize the Terraform environment.​
  • ​
    terraform init​
    ​
  1. Perform resource planning.​
  • ​
    terraform plan​
    ​
  1. Create the temporary key.​
  • ​
    terraform apply -auto-approve​
    ​
  1. In the current directory, view the temporary key for logging in to the CR Standard Edition instance.​
  • ​
    cat token​
    ​
What to do next​
After obtaining the temporary key, you can log in to the instance and push or pull images in it. For detailed steps, see Pushing and pulling images.​
Last updated: 2026.10.19 15:46:48