Terraform est un outil Hashicorp populaire pour gérer votre infrastructure cloud dans l' infrastructure en tant que paradigme de code .
Terragrunt est un wrapper pour Terraform qui fournit des outils supplémentaires pour stocker vos configurations Terraform, travailler avec plusieurs modules Terraform et gérer l'état distant.
Vidéo:
Liens:
- terraform-community-modules + terraform-aws-modules
- antonbabenko/pre-commit-terraform â
- antonbabenko/modules.tf-lambda â Terraform-
- antonbabenko/terragrunt-reference-architecture â Terragrunt reference architecture
- www.terraform-best-practices.com
- https://www.antonbabenko.com
- @antonbabenko â Twitter, Github Slacks
- YouTube, Terraform
AWS Community Hero. â Terraform-, Terraform. , HashiCorp-.
open source . , Terraform-, community-modules, aws-modules. , - - .
, , , Pre-commit-terraform. , . .
. , , Delivery Excellence. Terraform Terraform.
, GitHub , Linkedin . , open source, open source.
All-things Terraform + AWS + DevOps.
Consulting.
Workshops.
Trainings.
Mentorship.
Open source â . open source. , : « ? ?». .
- , Terraform, Terraform Terraform workspace, : « workshops , ?». workshops.
- , . ., , - , , - , , pull request, , -. , -.
email: anton [] antonbabanko.com. , , , . . , , .
Betajob.com. .
https://github.com/terraform-aws-modules
https://registry.terraform.io/modules/terraform-aws-modules
Terraform AWS â , 2017- , - , . , VPC Amazon. , - . , , - , , . . .
, . .
, . . .
https://github.com/sponsors/antonbabenko
7 000 000 , 1 000 pull requests issues . 6 , GitHub. -, , . , .
, , Cloudcraft. , , . . , . , , .
Cloudcraft , , AWS-.
https://dzone.com/articles/infrastructure-as-code-the-benefits
, , , , , , . . . , . . , . , Powerpoint. , clickops, â , , . , , .
, â , , , . , . . . cndb, Systems Manager Amazon. .
?
Terraform 0.12 Terraform 0.11.
, Terraform . , . Terraform . , Terraform .
Amazon 2011- : « CloudFormation». , . Spectrum, Fogs . ., JSON, YAML . ., . . - . DSL . . GitHub , , orchestration-cloudformation. . Spectrum â , -.
, Google , , , , Python, Jinja Tempating, . Google.
Azure , , , JSON. , , . , . Azure ARM Terraform . , - , Terraform â , JSON, .
Chef, Ansible, Puppet, . , , . .
: - , public cloud Amazon, Google, Azure . . configuration management - , , . , : , , .
Terraform 2014- , , , , CloudFormation, CloudFormation , , . .
Terraform, , 250 , . . HashiCorp Configuration Language, , .
Terraform , , . Terraform , - . Terraform, . Terraform . CloudFormation . , CloudFormation , 2013-2014- , .
Terraform mainframes, workers . . , , 2014- . , , API , Terraform . Terraform . use cases.
https://www.terraform.io/docs/providers/index.html
API , . . email Google permeation Dropbox, . , , Terraform . use cases.
use cases, . , Minecraft . , -. . , . , Terraform? , . hsale, , . , . Terraform , , , . , .
, - . , . - , , . . Terraform. Terraform , API .
, , . , , - , email, GitHub-, Jira. pull requests Terraform. .
Terraform, 3 :
- Terraform.io â , , .
- Learn.hashicorp.com â .
- Terraform-best-practices.com â , 100-500 Terraform, , , - , best practices. Google «Terraform best practices» .
, : « ?». â best practices . , best practices â , terraform-best-practices. . . . , . , , Terraform . , , , , . , , - .
, , . : « », . ., , - , , email pull request , . , , . - .
. , , Terraform â , . , , , . Terraform , , work space .
?
Terraform 0.11 , . . . s3_bucket.
Terraform 0.12 . , . . , .
https://www.hashicorp.com/blog/announcing-terraform-0-1-2-beta
. ; , , .
Terraform 0.11, , , , , try, false . , . Correct conditional operators , , , , . Terraform AWS . .
? ? 100 -500 , . Terraform plan, Terraform apply environment, . , . test cases : . . . . , Terraform . . . , Terraform - , , review, .
. . , Terraform, . . HashiCorp . , Terraform 0.12 , .
. , HashiCorp â , , . . open source.
https://www.terraform.io/upgrade-guides/0-12.html
, 0.11 0.12 .
-, upgrade guide, , , , . . , 90 % , .
, Terraform 0.12, 0.11 , Terraform state , 0.12. , -, , , state , , .
, . - 0.12, - , , .
https://github.com/tfutils/tfenv
, tfenv. .
https://www.terraform.io/docs/configuration/terraform.html
, , . , . ? -. , AWS. , . . Terraform-, . . .
, : «, , ?», Terraform state , . .
, Terraform , .
, , Terraform , Terraform . , .
, all-in-one, tf Terraform-. , , outputs. , refresh , plan . .
â , 1-in-1. . - , - , . , .
. : all-in-one 1-in-1? , , , all-in-one â , 1-in-1 â .
MFA (Most Frequent Answer) â .
, - , . Google : «Google, - , », terraform.io, - â all-in-one. , . Terraform plan 20 . all-in-one.
, , all-in-one , . , , . , environment. . . - .
1-in-1 , . , Registry terraform.io, VPC-. , , , . . - , . 1-in-1.
, , - Terraform-, - , , .
, , Terragrunt, 1-in-1 .
?
, all-in-one. Terraform plan. 15 . . , - . Terraform apply, 15 , «Yes», .
, , main targets. terraform apply -targets = module.vpc
. VPC. , shell-, makefile, PowerShell - Terraform, , war- , . .
1-in-1, mikefile . Terraform apply , Terraform apply . . . . , make terraform apply
- . .
? , state input . , , shell-, , . , , Terraform apply, data-source , Terraform remote state . . shell-, makefiles.
? ? . . Terraform Terraform.
, . . ? Terraform . . . , «Terraform apply». -, . , .
, Terraform , , . .
, Terragrunt. .
https://github.com/gruntwork-io/terragrunt
https://github.com/antonbabenko/terragrunt-reference-architecture
â Terraform Terraform-.
, Terragrunt, Terraform-. , , Terraform-. Terragrunt Terraform-.
, . Terragrunt .
, , «star» GitHub, 3 000 . , . .
, , , . .
, , . Terragrunt-reference-architecture , . , . , , . , , .
Terragrunt. .hcl. , - Terraform , .
3 , . inputs 14- , . , , Terragrunt.
: registry, . , 3. , . 14. terragrunt apply
.
Terraform, , . , AutoScaling 200-300 , .
, , Terraform, AWS SDK, , .
, Amazon, DevOps, , Terraform-. , , : .
: Terragrunt , , , .
Terragrunt. , hooks . . , hooks , . - hooks .
. 10 , , autoscaling group, VPC. VPC? 11 , VPC. autoscaling group, public subnet . 20 dependency.vpc.outputs.public_subnets.
, - : « , data-source data-sourceâ - state ?». , terraform output
. Terragrunt? , (.vpc) terraform outputs.public_subnets
. subnets dependency.vpc. vpc_zone_identifier. data-source . .
. 1-in-1, , , , terragrunt apply
, , - , «Yes» . . terragrunt apply all
, , , . : « ?». «». , .
Terragrunt pre-commit. pre-commit hooks Terragrunt , .
-, . , . -, . , . -, .
, Terragrunt, , Terraform Cloud. ? Terragrunt , , .
Terraform Cloud, Terragrunt . Terraform Cloud . , , 0 70 . -, .
, , Terraform Cloud â , , open source. , enterprise. , open source , shell-. - workspaces. - open source enterprise, .
workspaces?
, Terraform, Terraform apply. , . , - . «Terraform workspaces new» workspace. «Terraform plan». Terraform plan : « ». . . , workspace, , - workspace. workspace , . 100 .
â , workspaces . shell-, bucket , .
â workspaces, . , Terraform.workspaces = prod, 5, 25. , . , 5 environment , , lookup . lookup , Terraform workspaces. , .
: « workspaces ? production QA environment?». : « , slack». . - : « staging production environment ?». .
, , , Terraform . Terraform.tfvars, , . , instances. .
workspaces, . S3_bucket, state .
, . . : « , , workspaces name». .
workspaces , workspaces â . . workspaces workspaces shell-, AWS-, , , .
use cases, workspaces . , . , , , .
use cases , , pull request. . . pull request, - workspaces, , -, GitHub. - , , . , workspaces. , , . - . , production environment workspaces.
use cases . , . inmem. workspaces. . . workspaces , - - . , , Terraform state, Terraform backend configuration type inmem ( ). , .
workspaces , , , . , , , workspaces. , workspaces, - . , Feature 1. , terraform apply
. , . , terraform destroy
.
, , , , .
Terraform workspaces . . , 20 , 10 . workspaces, . .
, , . , Terraform. , , .
Terraform developers . , , DevOps-.
DevOps- Terraform 0.12, . . , , , . ? , , .
DevOps- Terraform developers reference architectures, . , ICS-, 100 , Amazon load balancer, . . . cloud- DevOps- , 100 , , . , , , , , . Terraform-, frontend-, , Terraform. : « , - ». , .
Terraform , frontend developer, 0.12 5 , . , , . . Terraform 0.12 â Terraform developer, .
, full stack developer Terraform. - , , frontend application. , . .
, , . - , , , frontend developer, backend developer, machine learning . . DevOps- , , . .
Modules.tf. ? .
- 2 , , .
. , - - , , .
https://github.com/antonbabenko/modules.tf-lambda
https://github.com/antonbabenko/modules.tf-demo
. , , , , , - .
â modules.tf.demo.
, Terraform AWS . Terragruntâ .
, , . open source .
https://asciinema.org/a/32rkyxIBJ2K4taqZLSlKYNDDI
asciinema.org , .
, , , . Terraform best practices , , Terragrunt.
, , Terraform , . Terragrunt - - .
, , . , , , , open source, , pull requests, issues . .
, , , . , . , . , Amazon. Amazon, . - . , . . 10 , , . . , - close course .
Terraform â . , Terraform-, . . 99 % Terraform , . . , . .
https://github.com/sponsors/antonbabenko
. . . , Delivery excellence.
! . , Terraform Cloud â , . Terraform backend. tfstate, . , S3, Diff, , CI. Terraform pipeline. all-in-one, 1-in-1. Terraform depends_on, . . . , Terragrunt . ?
, . , Terraform Cloud , . , open source community, , 99 % Terraform Cloud , . , Atlantis, GitHub-actions. - .
Terraform Cloud, . , , . Remote state Terraform S3.
, , . , Terraform Cloud, Atlantis, Terraform pull request. . . pull request, atlantis plan
. Terraform , - Jenkins. AWS forget instance. Terraform plan pull request. .
Atlassian Terraform. Terraform Cloud. . .
.
? , ?
. , , MasterCard REST Provider. , swagger . Terraform- swagger . swagger , swagger , . . - , .
. Amazon, , - issue , , . upload , : « ? ?». - , , Brian . , .
, . , . open source?
Cloudcraft?
.
Cloudcraft â open source.
. , , , Terraform, AWS. , - AWS. ?
, , , . , , . . . , ? , EC2 instance, 50 : IP-, subnet . . . . - - . . , open source . drowto.io, open source, Cloudcraft, .
! , , . Terraform-. Terraform Helm Charts?
, .
.
. Terraform- Terraform . , provisioning, , shell- â Terraform. , . Helm Charts . , - . , Helm Terraform, - . , , , . Terraform , . . . Helm, Kubernetes, - , Terraform apply. Terraform apply . .
, . - Helm, . issue «Helm 3 provider Terraform», , - . , -, . .
, Kubernetes- Terraform. , , .
. , - use cases. -, Kubernetes-. , - , . Terraform , , . , Kubernetes, Terraform . .
! . , count output , list map?
. . , - ?
, VPC VPC, - , restrictions security group VPC. list.
, - , , Terraform , , , , . , Terragrunt. . . Terragrunt . . outputâ . Terragrant , , . , , .
Terraform, , , Terraform .
, . terraform apply -target
, terragrunt apply
. , Terragrunt. . . âtarget
, . , , , , , .
, ! all-in-one 1-in-1. , . . AWS. , , AWS, . all-in-one . . Terragrunt, , . ? , â all-in-one 1-in-1.
, MFA somewhere in between. , , . use cases â . , 100-500 AM userâ . - . all-in-one . all-in-one, 1-in-1 .
Et je voulais montrer davantage qu'il existe de telles façons. Il y a un moyen, il y a un deuxiĂšme moyen. Et vous connaissez l'avantage Ă la fois de l'un et de l'autre. Et puis vous pouvez trouver une troisiĂšme voie, qui se situe quelque part entre les deux. Dans les projets live, je n'ai pas rencontrĂ© complĂštement tout-en-un. Si vous sĂ©parez tout au point de fanatisme, cela s'avĂšre irrĂ©alisable. Et il s'avĂšre que beaucoup de code peut ĂȘtre regroupĂ©.