Extend Cloud Resources
To enable end users to provision and consume cloud resources, platform engineers need to prepare ComponentDefinitions for cloud resources if end users' requirements are beyond the built-in capabilities.
Here is the guide to create Terraform typed ComponentDefinitions of cloud resources for cloud providers Alibaba Cloud, AWS and Azure.
#
Prerequisites#
Develop a Terraform resource or moduleCreate a Terraform resource or module for a cloud resource.
For example, we created a Terraform resource for AWS S3 bucket, and stored it in a local file named aws_s3_bucket.tf
.
We also created a Terraform module for Alibaba Cloud EIP, and stored it in GitHub repository https://github.com/oam-dev/terraform-alibaba-eip.git.
#
Generate ComponentDefinitionBy running vela def init
command, we can generate a ComponentDefinition for a cloud resource based on Terraform resource or module
either from a local file, or from a remote GitHub repository.
We use --local
to accept Terraform resource or module from a local file to generate a ComponentDefinition.
We use --git
to accept Terraform module or resource from a remote GitHub repository to generate a ComponentDefinition.
You are warmly welcome to contribute this extended cloud resource ComponentDefinition to oam-dev/catalog.
#
Apply ComponentDefinitionWrite the generated ComponentDefinition into a file named terraform-<ComponentDefinition_NAME>.yaml
and apply it to the running Kubernetes cluster.
#
VerifyYou can quickly verify the ComponentDefinition by command vela show
.
If the tables display, the ComponentDefinition should work. To take a step further, you can verify it by provision an actual EIP instance per the doc Provision cloud resources.
#
Generate documentationYou are encouraged to generate the documentation for your ComponentDefinition and submit it to KubeVela official site.
By running vela def doc-gen
command, we can generate related docs for the ComponentDefinition either from a local file, or from the running application on kubernetes cluster.
If you choose to generate docs from running cluster, you should provide the name of the ComponentDefinition and the namespace which it is running in.
If you choose to generate docs from local ComponentDefinition file, you should provide the file path.
Move the file generated to kubevela/kubevela.io repo. Follow the contribution guide to submit the doc.