Terraform 12 y Terragrunt y cómo se puede aplicar a la infraestructura de múltiples nubes. Alejandro Dovnar







Qué son Terraform 12 y Terragrunt y cómo se pueden aplicar a la infraestructura Multi-Cloud.

Hablaremos sobre el impacto de IaC (Infraestructura como código) en el mundo moderno y cómo Terraform lo ayuda a trabajar con entornos heterogéneos. Quiero discutir un poco sobre Terraform en sí, qué problemas tiene y cómo Terragrunt los resuelve. Luego hablaré sobre mi experiencia con Terragrunt y engancharé un poco sobre un tema como las nubes múltiples. En la segunda parte de la discusión sobre el tema, me gustaría mostrar el resultado de mis hallazgos al usar Terraform + Terragrunt en un entorno con tres proveedores de nube (AWS, GCP, Azure) y CloudFlare como DNS.









  • (Alexander) Hoy quiero hablar sobre cómo logré hacer la implementación de Multi-Cloud usando Terraform y Terragrunt, y cómo funciona en particular y por separado.







  • () ! , . quiz. , quiz , Terraform .









quiz. , , , , , .







, quiz , DevOpsMinsk Chat. . .







, quiz. .







Terraform – :







  1. configuration management
  2. HashiCorp
  3. Infrastructure is code
  4. Infrastructure as code.


Terraform HCL. 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:







  1. Backend
  2. Query
  3. DataSource
  4. Filter Source


DataSource?







  • () , , Terraform. , subnets Amazon availability-. DataSource, availability-. exclude, include Terraform-.







  • () , - , , DataSource?







  • () .









Terraform ?







  1. Terraform taint
  2. Terraform destroy
  3. Terraform apply
  4. Terraform plain
  5. 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 – .
















. . .







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 , . . , - , , , . .







  • () , ! , ! !


















All Articles