1) More Terraform Functions
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-259.png)
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-260.png)
1.1) Numeric Functions
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-261.png)
1.2) String Functions
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-262.png)
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-263.png)
1.3) Collection Functions
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-264.png)
1.4) Map Functions
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-265.png)
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-267.png)
2) Operator and Conditional Expressions
2.1) Numeric Operators
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-268.png)
2.2) Equality Operators.
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-269.png)
2.3) Comparison Operators.
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-270.png)
2.4) Logical Operators
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-271.png)
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-272.png)
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-274.png)
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-275.png)
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-276.png)
3) Terraform Workspaces (OSS)
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-277.png)
Bạn có nhiều project A, B, C thì thì nó chỉ khách nhau về variable thì chúng ta là sao?
Ở bài trước bạn có thể sư dụng theo kiểu module để manage được problem trên.
Ngoài ra chúng ta có 1 cách nữa đó là sử dụng workspace.
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-278.png)
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-279.png)
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-280.png)
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-281.png)
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-282.png)
Giờ bạn nhìn ảnh trên.
Bạn có thể thấy ami được config theo dạng map.
-> nếu là Project A thì ami sẽ là ami-0eda…..
-> nếu là Project B thì ami sẽ là ami-0c2….
Mục đích là nếu chúng ta đang ở project A thì variable output của ami sẽ là ami-0eda….
chúng ta dùng hem lookup(var.<variable_name>, terraform.workspace)
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-283.png)
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-284.png)
Chuyển workspace:terraform workspace select <workspace_name>
![](https://nimtechnology.com/wp-content/uploads/2022/05/image-285.png)