Kyvos now supports automated resource creation for GCP using Terraform.
To create Kyvos resources, read the following:
Prerequisites to run Terraform from GCP cloud shell
Users need a valid Google Cloud Platform account. This account will be used to authenticate Terraform to interact with GCP resources.
The user typically needs the following permissions:
Editor Role
Secret Manager Admin
Storage Object Admin
storage.buckets.get
storage.buckets.update
storage.objects.update
Google Console users should have the privilege to launch Google resources like Instances, Dataproc cluster, Google Storage, and Disks in the Project.
Logged-in users should have the privilege to launch Gcloud in GCP.
If a user intends to utilize an existing service account for deployments, it must possess specific permissions as outlined in kyvos documentation .
If a user intends to utilize an existing VPC for deployments, it must possess specific permissions as outlined in the kyvos documentation
If a user intends to utilize an existing bucket for deployments, it must possess specific permissions as outlined in the kyvos documentation
Prerequisites to run Terraform form local machine
Download and install Terraform on your local machine.
Execute terraform init command to verify successful installation of Terraform.
Jq should be installed on your local machine.
User needs a GCP account to create and manage resources. Ensure you have the necessary permissions.
Configure GCP on your local machine
Automated resource creation using Terraform from GCP
To create resources using Terraform from GCP, perform the following steps.
To execute Terraform on Google Cloud Platform's Cloud Shell, activate Cloud Shell, then click Open Editor to create the necessary folders
Create a directory named terraform and add subdirectories and files according to the following specifications:
Access the kyvosparams.tfvars file located in the conf directory, and configure the parameters as needed for your deployment
In the Cloud Shell interface on Google Cloud Platform, open a new terminal by clicking on the terminal icon located on the left-hand side.
Note
After opening the terminal in Cloud Shell, ensure that Cloud Shell is configured to operate within the same project where you intend to deploy your resources.
From the terminal, navigate to the directory where your files are stored. For example, use cd terraform. Once navigate to the bin folder, execute the ./deploy.sh command. This command will initialize Terraform, generate a plan, and apply the configuration as specified in the kyvosparams.tfvars file.
Review the output to ensure Terraform will create, modify, or delete the resources as expected.
If you need to interrupt the script while it's running, press Ctrl+Z.
If you need to make modifications to the kyvosparams.tfvars file, do so accordingly.
Upon successful execution of this command, Terraform will display the outputs as specified in the configuration.
Terraform will generate an output.json file containing all outputs, which Kyvos Manager will utilize for configurations.
To destroy your entire deployment, simply execute the ./deploy.sh destroy command.
Note
After successfully executing the configuration, Terraform will automatically generate a .tfstate file. To create a new file using the same configuration files, first destroy the existing deployment configured in those files.
To change the sourceImage or kmSourceImage, navigate to the source folder, open the variable.tf file, and update the default value as needed.
Automated resource creation using Terraform from Local Machine
To create resources using Terraform from Local Machine, perform the following steps.
Open a terminal or command prompt on your local machine.
Navigate to your Terraform configuration directory (where your .tf files are located).
Make sure to establish a directory named "terraform" and inside it, construct subdirectories and files as specified above.
Access the kyvosparams.tfvars file located in the conf directory, and configure the parameters as needed for your deployment
Cd inside the "bin" folder, execute the command ./deploy.sh. This command will initialize Terraform, generate a plan, and apply the configuration as specified in the kyvosparams.tfvars file.
Review the output to ensure Terraform will create, modify, or delete the resources as expected.
If you need to interrupt the script while it's running, press Ctrl+Z.
If you need to make modifications to the kyvosparams.tfvars file, do so accordingly.
Upon successful execution of this command, Terraform will display the outputs as specified in the configuration.
To destroy your entire deployment, simply execute the ./deploy.sh destroy command.