This section requires your platform engineers have already enabled terraform addon.
This tutorial will talk about how to provision and consume Alibaba Cloud RDS (and OSS) by Terraform.
Let's deploy the application below to provision Alibaba Cloud OSS and RDS cloud resources, and consume them by the web component.
- name: express-server
- type: service-binding
# environments refer to db-conn secret
secret: db-conn # 1) If the env name is the same as the secret key, secret key can be omitted.
key: DB_PUBLIC_HOS # 2) If the env name is different from secret key, secret key has to be set.
# environments refer to oss-conn secret
- name: sample-db
- name: sample-oss
sample-db will generate secret
db-conn with these keys, and the component
sample-oss will generate secret
oss-conn. These secrets are binded to the Envs of component
express-server by trait
Service Binding. Then the component can consume instances of OSS and RDS.
Deploy and verify the application.
$ vela ls
APP COMPONENT TYPE TRAITS PHASE HEALTHY STATUS CREATED-TIME
webapp express-server webservice service-binding running healthy 2021-09-08 16:50:41 +0800 CST
├─ sample-db alibaba-rds running healthy 2021-09-08 16:50:41 +0800 CST
└─ sample-oss alibaba-oss running healthy 2021-09-08 16:50:41 +0800 CST
$ vela port-forward webapp
Forwarding from 127.0.0.1:8080 -> 80
Forwarding from [::1]:8080 -> 80
Forward successfully! Opening browser ...