2 min read
Let's imagine we have the following data structure:
locals {
queries = [
{
query = "SELECT version()"
engine = "postgresql"
},
{
query = "SELECT * FROM v$version"
engine = "oracle"
},
(...)
]
}
If we want to use just some of the items on a resource we can use for_each through the resulting array of filtering the objects using a for:
for_each = [ for item in local.queries: item if item.engine == "postgresql" ]
22/06/2021
Read more...2 min read
Kubernetes init containers are a special container that runs before the main containers on the Pod. They are usually used used for setting up the environment and populate some shared storage to be used for the actual containers.
21/06/2021
Read more...2 min read
Kubernetes provides a DNS to be used to locate other pods or services instead of using it's IP address. The default cluster domain is cluster.local but we can change it if we like.
18/06/2021
Read more...2 min read
Helm intends to be a package manager for kubernetes, as such it provides a way to list all the installed applicacions on the cluster
17/06/2021
Read more...4 min read
Let's imagine we want to create a security group with the following ingress rules:
ingress_rules = [
{
protocol = "tcp"
cidr_blocks = [ "1.1.1.1/32", "2.2.2.2/32" ]
},
{
protocol = "tcp"
cidr_blocks = [ "1.2.3.4/32" ]
}
]
For each of the following ports:
services = ["80", "443", "8080"]
We can use the terraform function setproduct() to calculate all the combinations of elements from the given sets. That's also called the Cartesian product. For this example it's going to be 2x3.
16/06/2021
Read more...