imjoey edited a comment on issue #167:
URL: https://github.com/apache/apisix-docker/issues/167#issuecomment-829766880


   > > > @izayoi-akira please add some details about your snapshot operations. 
Indeed this is a right way
   > > 
   > > 
   > > @tokers how about we introduce the `Terraform` which is for declarative 
configurations management. Thus we can export all the existing resources into 
several `.tf` files that represent the declarative resources. Also, we can 
import it via uploading files onto Dashboard or just run `terraform apply`. 
This will give us full-fledged functionality for user data import/export.
   > > Looking forward to your feedback.
   > 
   > Frankly, I'm not sure, as Terraform just likes a tool used on Cloud. Is it 
also can be used in bare-metal or containers deployed on-premise?
   
   @tokers
   yep, the most commonly used scenarios of Terraform are for cloud 
provisioning. While as a matter of fact, Terraform is a great tool that can 
handle all the cases as long as Declarative Configuration is needed. For 
example, we can also find the Github/Gitlab providers for the 
repository/branch/privilege/user management here [[1]].
   
   With regards to APISIX, a minimum feasible Terraform `.tf` configurations 
may seems like this:
   
   ```terraform
   provider "apisix" {
     # Assume we use Admin API here
     url      = "https://your-apisix-server-addr:9080/";
     access_user = "admin"
     access_key = "the-access-key-for-admin-api"
   }
   
   resource "apisix_route" "route_1" {
     name = "r1"
     desc = "for buzi1"
     uri = "/foo/bar"
     host = "foo.com"
     methods = ["GET", "HOST"]
     status = 1
     labels = {
       "k1": "v1",
       "k2": "v2"
     }
     upstream_id = ${apisix_upstream.upstream_1.id}
   }
   
   resource "apisix_upstream" "upstream_1" {
     name = "u1"
     type = "chash"
     key = "remote_addr"
     nodes = {
           "127.0.0.1:80": 1,
           "foo.com:80": 2
       }
   }
   
   ```
   
   This would bring us the reproducible APISIX resource definitions. For 
backup/restore, we need to support export these definitions as the format of 
Terraform templates stored in `.tf` files.
   
   Please let me know what do you think. Maybe we all need much more 
discussion. Thanks.
   
   [1]: https://registry.terraform.io/browse/providers
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to