Qu'est-ce que Terraform 12 et Terragrunt et comment ils peuvent être appliqués à une infrastructure multi-cloud.
Nous parlerons de l'impact de l'IaC (Infrastructure as Code) sur le monde moderne et de la manière dont Terraform vous aide à travailler avec des environnements hétérogènes. Je veux parler un peu de Terraform lui-même, de ses problèmes et de la manière dont Terragrunt les résout. Ensuite, je parlerai de mon expérience avec Terragrunt et m'accrocherai un peu à un sujet tel que le multi-cloud. Dans la deuxième partie de la discussion sur le sujet, j'aimerais montrer le résultat de mes découvertes sur l'utilisation de Terraform + Terragrunt dans un environnement avec trois fournisseurs de cloud (AWS, GCP, Azure) et CloudFlare en tant que DNS.
(Alexander) Aujourd'hui, je veux parler de la façon dont j'ai réussi à faire un déploiement Multi-Cloud en utilisant Terraform et Terragrunt, ainsi que comment cela fonctionne en particulier et séparément.
() ! , . quiz. , quiz , Terraform .
quiz. , , , , , .
, quiz , DevOpsMinsk Chat. . .
, quiz. .
Terraform – :
- configuration management
- HashiCorp
- Infrastructure is code
- 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:
- 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 , . . , - , , , . .
() , ! , ! !