What Terraform 12 and Terragrunt are and how they can be applied to Multi-Cloud infrastructure.
We'll talk about the IaC (Infrastructure as Code) impact on the modern world and how Terraform helps you work with heterogeneous environments. I want to discuss a little about Terraform itself, what problems it has and how Terragrunt solves them. Then I will talk about my experience with Terragrunt and hook a little on such a topic as Multi-Clouds. In the second part of the discussion on the topic, I would like to show the result of my findings in using Terraform + Terragrunt in an environment with three cloud providers (AWS, GCP, Azure) and CloudFlare as DNS.
(Alexander) Today I want to talk about how I managed to do Multi-Cloud deployment using Terraform and Terragrunt, as well as how it works in particular and separately.
(Victor) Cool! I know that Sasha has prepared questions. And by tradition, before each report, we run a quiz. I think that this quiz will be useful for you from the point of view of understanding whether you know everything about Terraform and whether this talk will be of interest to you.
I suggest running quiz now. And, perhaps, together with you, Sasha, look at the questions that you yourself have come up with.
I draw your attention to the fact that you can participate in the quiz on our channel in Telegram, in DevOpsMinsk Chat . The bot is launched there. You can make friends and interact with this bot.
So quiz. I will read the questions and comment.
Terraform is:
- Configuration management tool
- Monetizing HashiCorp
- Infrastructure is code
- Infrastructure as code.
Terraform is used to describe the HCL infrastructure. What is HCL?
() HashiCorp Configuration Language. , . HashiCorp.
() HCL YAML. YAML-Developers.
() .
() ? , HCL 2.0.
() HCL 2.0 : YAML encode, decode JSON encode, decode, . HashiCorp.
VPC VM info:
- Backend
- Query
- DataSource
- Filter Source
DataSource?
() , , Terraform. , subnets Amazon availability-. DataSource, availability-. exclude, include Terraform-.
() , - , , DataSource?
() .
Terraform ?
- Terraform taint
- Terraform destroy
- Terraform apply
- Terraform plain
- Terraform refresh
, taint.
() Taint . , , . , . . taint . Terraform, , , .
() , , , , - ? , , - . ?
() plan, apply, , , , , , . ID .
() quiz. 19 5 . . . . 3 , , , . , .
() ? , Terraform, Terragrunt Multi-Cloud deployment, .
:
- . EPAM Systems lead systems engineer.
- DevOps- 4 .
- 6 - .
- Automation fanatic – , , , , . .
?
- , .
- , . . , Terraform, Terragrunt Multi-Cloud. , .
- , .
- , . .
- Q&A.
QR-, . . PreProd Demo site. production. , . .
- () , , , , .
, , . «Terraform 12». . ?
- () Terraform, , 0., . . 0.11, 0.12, 0.13. , HashiCorp, , , 1.0. , Terraform.
HashiConf, . Packer. HashiCorp. , , HashiCorp , 1.0. , .
() , Terraform , , , 12- .
() .
, . . , , , . - . , Terragrunt, Terraform Multi-Cloud . real production, . . environment .
, . , . .
, .
Terraform. . . , .
, , :
- - 3 clouds: Amazon, Azure GCP. , , . deployment-, 3 clouds , .
- , Terragrunt. .
- , . .
- challenges, :
- Azure . , Microsoft. .
- , . free tier AWS GCP. Azure , .
. . . :
- Multi-Cloud.
- Terraform.
- Terragrunt, Terraform.
Multi-Cloud, , . , . . , .
() - : , .
() .
, Multi-Cloud , vender-lock, cloud manage-, . , , cloud - . , .
– IT. enterprise- , - , , , Google Cloud, . Multi-Cloud , , , sandbox Google Cloud, . , , : «, Amazon».
Performance and resiliency . performance , Google Cloud Active Directory Management Service, Azure. . . .
, , Compliance, . . , - , Amazon , Azure , , Google Cloud, Azure . .
() . , , . , , - sensitive, . , AWS , AWS.
() .
() , , .
() , , , .
() , mail.ru.
() . , mail.ru, , . , .
challenges ?
- – , , , Amazon , , Google , Azure , , , , – . , - , , , , , .
- , , DevOps, , . , - size, , . Multi-Cloud, , . , .
Multii-Cloud , Terraform, , , .
, HCL. HashiCorp Configuration language.
? , , , Kubernetes Name Space . Terraform, Azure Terraform , , Cloud formation Azure template. . HCL . , , .
, , , , : , - , . , clouds. . , , , HCL – YAML, , , . HCL 2.0 .
() , clouds. . , clouds. .
() ?
() .
() ?
() . VPC.
() -.
() , , - . , , . , , .
Terraform? , cloud, , . . . , Terraform , - state. , S3 bucket. , . , , , , , state. , , . , . , install stipe .
() . , S3. , , durability, .
() .
() , , - , state, , , . , , Terraform 12- , , . state-, . , , durability, .
() .
Terraform , -, 10 remote state locations, . . S3 Cassandra, .
– Terraform state, Terraform Amazon Azure, . , . state , .
– Terraform 100 , . . Terraform – HCL API- . . . Amazon, OpenStack, Kubernetes, Helm, GitLab‑, .
() . . API , ?
() , . HashCorp’. , , - , . . . , , , .
Terraform . Terraform? .
() , Thoughtworks Technology Radar.
() . Technology Radar? , , . , .
Terraform , Technology Ragar, adopt , production .
. . , . . , . , . .
Terraform . cloud- Terraform-. , , .
() , Azure , , , Terraform, infrastructure as code. .
() , .
Terraform ?
- . . .
- Terraform CI/CD, – . lints. , .
- unit-. .
, . , .
CI? CI Terraform-, CI , . .
() , . - , CI Terraform, Terraform plan, state, apply, . . . , . , , , build -, , . Terraform state, .
() . . CI . linting, plan, apply, compliance, security. .
() .
() . . (, ) Terraform . . Terraform , . tools, output. outputs - . .
best practices, . . , , , , cloud formation template Amazon, . . . , - , . , - .
. Terraform. , , , 2 Terraform.
:
Terraform-, , HCL 2.0 , .
, - , .
() , , , , . . , 15 load balancing .
() . . . .
11- 12- Terraform. , . . , Terraform , . , , .
11- Terraform, .
– , , . , . - , . , .
() , 12- . , - , . . , - .
() , . . . . .
, API clouds, Amazon, . , , API-. Terraform 11- . security group - , 11- Terraform . ingress rules . 2 environment, 25 , 22-, . 2 , - . .
– . 11- Terraform .
() Count, .
() , . . ? , . rules security groups. , , . .
2 rules plan. , . - : « ».
: , , . , Terraform , . rule, . , rule. , prod, . . , - downtime.
state , - , maintenance …, .
GitHub. 0.12- .
() -, , stable.
() .
() , 2 beta 0.13. , .
() 18- . , 12- , . . HashiCorp Configuration language 2.0, .
?
- -, . count, for_each, . - , . for_each .
- . , . , , - , - .
- Terraform- – dynamic-, , . . .
for_each . Terraform for_each , . . for_each . , key-value . , , - , , , for_each, Terraform , , . , .
12- Terraform .
() , - rule , , ? – 36 ?
() .
() , 36 rules?
() .
.
. , YAML. for, if. HCL, Terraform, , HCL. Packer. .
-. 11- Terraform string string, number string, boolean string, , , 1 0 -: - true, - 1, - .
. maps. string, number, boolean, . , .
maps .
, , , .
() , , YAML anchors. . - , anchors . , , . . GitLab CI, Kubernetes .
() null, values. 11- Terraform , , . - , . . null. Null – null, , , .
12- Terraform 11- . 11- Terraform : A B, C, D. 11- Terraform , , . . . - , , . , .
12- Terraform . . A B, C. A B, D, C . , Terraform.
Terraform 0.13 1.0 – , . - 13- .
, depends_on, . . .
– , , . Terraform- Terraform . Feature flags , . . , , cloud . cloud AWS, GCP, Azure, Terraform : « ».
, , Terraform , 1.0.
?
- , prod.
- , secure.
- , .
- , tool .
Terraform . 1.0, , . infrastructure as code. Terraform’, , .
() Helm Kubernetes , Kubernetes-.
() . , . Helm - , HCL Kubernetes- – .
() -?
() YAML , , . HCL, HCL. . . , Helm . Terraform Helm . . , load, kube-config, Helm , .
- 1.0, . 3 0.11- Terraform 19 . 12- 20--. , , . , 1.0.
() , Terraform enterprise, - . , , , . enterprise-.
() , .
Terraform, , ?
- Terraform, . VPC, environment – .
- environment, . . . , . variable staff, . . environment, remote state location. Terraform , remote state. . bucket-. , . , , policy, . .
- environment x*3 days. , , .
- . environment , , , , . - . . . , , , .
- , , Terraform . , .
Terraform, Bash, Python, , , 690 . Python, Terraform. Terragrunt.
, Terraform:
Multi-Cloud Terraform, , . Notepad, -. .
Terragrunt. Terragrunt – golang tool, cli, Terraform. Terraform, Terraform.
?
- . bucket name location. , , policy, secure. - .
- HCL 2.0.
- . , , HCL 2.0.
- stacks, . . - , . , environments. .
- Terragrunt? stack – HCL-. HCL- – , - , , . Terragrunt environments, environments, - , - .
. Terragrunt . . 12- Terraform . .
HCL-. - , . dependency, , states.
() , environment, preprod, variable, , , cloud YAML HCL , — , environment ? . . , ? , , preprod 2 , prod 200 . - preprod , - prod , ?
() . . Terraform. . Terragrunt, .
, , remote state , , . . stack . , - . location.
() , location, , ? Azure, - , Azure folder?
() , . - naming convention. bucket bucket.
46:56
?
, YAML, environment, .
, cloud abstractions, . , .
preprod. environment.yaml, environment, . . cidr, subnet, instance_size, location .
- () , ?
- () , .
- () , location – ? , , , . GCP – , Azure – .
- () . demo.hcl, . , Terraform .
. . .
pull request, templanding’ production. HCL- + YAML, . .
.
? 3 , Travis CI CloudFlare DNS-. Travis’ 3 . Travis credentials . .
, . VPC, subnet, , . .
prod . . , . production .
Travis, , -. . Booting VM. , , .
, . shell-, . , , CloudFlare DNS. , .
() . : « , Terraform ? ARM, Azure , ?»
() – , - cloud ?
() . , , Azure, Azure , . Microsoft . , . , , Azure .
() , Golang, , , Golang pull request , , - . , . Community . Azure , . terraform , cloudformation, , . Golang, , .
() : « , ? : N-, . , ? , ?».
() CI , - git commits. cmdb. . . configuration management – , . cmdb - , , , Grafana, , . - changelog, , . , prod , . Git diff , . - , , . , , .
() environments, management- , Ansible, Puppet. , , - . Terraform , , , , .
: « state of staff cloud-, , cloud , ?». , GCP, storage?
() . - on-premise . subnet, . . . - CI-, , . cloud, , , - .
() Terraform cloud, states. workspaces.
: « Terraform ?».
() Terraform.
() foreach .
() . Terragrunt .
. , GCP -. , -, , map, - -. . - . foreach, .
() . . , foreach , .
() , . . , , ?
() .
() : « Terraform 13 ?». , . .
() Count, foreach , depends_on , - . variables validation, , . , , , .
() , - production , , , . 13- Terraform .
() 12- 0.12.18. 18- .
() : « setup -, Terraform-, state, , ? vendors ». , .
() , , , state.
() . , .
() , Consul, .
() , Consul state. , . , , lock-, .
() . , - Azure , . . .
() - ?
() . 3 clouds, . , preprod, . . preprod. HAProxy, .
() , ?
() .
() plan?
() , plan.
() .
() clouds, . . cloud , health check HAproxy , . round-robin HAProxy. Multi-Cloud. , - 20 , Azure, .
() .
() , .
() , feedback ?
() , .
() .
- () , , .
Terragrunt? environments , , , Terragrunt – , . , , Terragrunt. . - . ., , .
environments, , Terragrunt – . YAML , – , , . . ENV . , 3 . . . , . , . .
, . . Terraform tf-, HCL, , , Terragrunt .
? Google Cloud, Amazon – . Terraform , CLoudFlare – , . Azure - support Microsoft Azure . . GitHub, , , -, , community. , Azure API, , . .
?
, open source, GitHub. issues. Golang, . . , .
, , Terraform Terragrunt . , , - . , , .
- , Terragrunt , . . , , . , – . . shell- Python.
() .
() .
() . – «Terraform: Up & Running».
() , .
() , . . Terraform, , .
: « Terraform DK , cloud DK, Terraform, , ?»
() , CDK, . HashiCorp Terraform CDK. Type-, Amazon.
() -.
() , – , . . - - . , Terraform , type-, . , , , CDK. State Terraform benefit , , , . state , . , . , cloud, .
, CDK. Terraform, . .
. , silver bullet. , .
() : « Terragrunt? Vault?». , – .
() Terragrunt . Terragrunt , - . . . , cloud , Azure, Amazon. , . , .
() , , . , , Terragrunt , Terraform.
: « Terraform?»
() ?
() , .
() open source , , , community, .
, , . , .
- () , , , .
: « , Terragrunt , . - ?». , . . , , . , .
() , Terragrunt start. Terraform, . Terraform, Terraform Up and Running. Examples .
() Terraform learns. cloud . cloud. .
, . , ?
() environments , . . , - , , , . .
() , ! , ! !