Diferències

Ací es mostren les diferències entre la revisió seleccionada i la versió actual de la pàgina.

Enllaç a la visualització de la comparació

Ambdós costats versió prèvia Revisió prèvia
Següent revisió
Revisió prèvia
tech:terraform:start [20/05/2019 00:14] – [ejemplos] matetech:terraform:start [15/05/2020 03:19] (actual) – [related] mate
Línia 1: Línia 1:
-Terraform+TERRAFORM
 {{tag> devops info}} {{tag> devops info}}
-== cli +  * [[tech:terraform:aws]] 
-<code bash> +  * [[tech:terraform:azure]]
-export AWS_DEFAULT_REGION="us-east-1" +
-export AWS_ACCESS_KEY_ID="$(revealpass AWS_ACCESS_KEY_ID)" +
-export AWS_SECRET_ACCESS_KEY="$(revealpass AWS_SECRET_ACCESS_KEY)" +
-</code> +
-<code bash> +
-revealpass() { +
-    local DATA_PATH="/secure/storage/PASSWORDS/" +
-    local SERVICE=$1 +
-     +
-    [[ ! -z ${SERVICE} ]] && [[ -f ${DATA_PATH}${SERVICE} ]] && cat ${DATA_PATH}${SERVICE} +
-+
-</code> +
- +
-=== básicos +
-  * **init** Initialize a new or existing Terraform configuration +
-  * **validate** Validates the Terraform files +
-  * **plan** : Generate and show an execution plan +
-  * **fmt** : Rewrites config files to canonical format +
-  * **apply** : Builds or changes infrastructure +
-  * **graph** : Create a visual graph of Terraform resources +
-  * **output** : Read an output from a state file +
-  * **destroy** : Destroy Terraform-managed infrastructure+
  
-=== otros +== documentación 
-  * **refresh** Update local state file against real resources +  * [[tech:terraform:cli]] 
-  * **show** Inspect Terraform state or plan +  * [[tech:terraform:terraform-state]] 
-  * **taint** Manually mark a resource for recreation +  * [[tech:terraform:variables]] 
-  * **untaint** Manually unmark a resource as tainted +  * [[tech:terraform:data-sources]] 
-  * **debug** Debug output management (experimental) +  * [[tech:terraform:modules]]
-  * **force-unlock** Manually unlock the terraform state +
-  * **state** Advanced state management+
  
-=== autocomplete +===PoC 
-  * ''terraform -install-autocomplete'' bash/zsh +  * [[tech:terraform:poc:workspaces]]
-  * ''terraform -uninstall-autocomplete''+
  
-== enlaces documentación +=== related 
-=== 0.11 +{{topic>terraform +cursos&nodate&nouser&tags&sort}} 
-  * [[https://www.terraform.io/docs/configuration-0-11/interpolation.html: interpolación (referenciar variables, atributos de recursos, llamar funciones)]] +{{topic>terraform +libros&nodate&nouser&tags&sort}} 
-  * +=== enlaces documentación 
 +  * 0.12: [[https://www.terraform.io/docs/configuration/index.html]] 
 +  * 0.11: [[https://www.terraform.io/docs/configuration-0-11/interpolation.html: interpolación (referenciar variables, atributos de recursos, llamar funciones)]]
  
 == de interés == de interés
Línia 84: Línia 61:
 </code> </code>
  
-=== data templates +=== dynamic
-<code powershell; template.tpl> +
-Install-WindowsFeature -Name GPMC,RSAT-AD-PowerShell,RSAT-AD-AdminCenter,RSAT-ADDS-Tools,RSAT-DNS-Server +
-New-ADOrganizationalUnit -Name "${container_OU}" -Path "${base_path_AD}" +
-New-ADGroup -Name "${admin_vpn_group}" -SamAccountName ${admin_vpn_group} -GroupCategory Security -GroupScope Global -DisplayName ${admin_vpn_group} -Path "${vpn_OU_AD}${base_path_AD}" +
-$Attributes = @{ +
-    Enabled = $true +
-    ChangePasswordAtLogon = $false +
-    Name = "${user}" +
-    AccountPassword = "${password}" | ConvertTo-SecureString -AsPlainText -Force +
-+
-New-ADUser @Attributes +
-</code>+
 <code properties> <code properties>
-data "template_file" "vm_adwriter" { 
-  template = "${file("templates/aws_instance.vm_adwriter.tpl")}" 
  
-  vars +variable "virtual_network_rule_ids" 
-    container_OU "VPNGroups" +  type list(map(string)) 
-    base_path_AD = "OU=myapp,DC=myapp,DC=com+  default = [ 
-    admin_vpn_group = "VPNAdmins+    { id = "x.x.x.x" },{ id = "y.y.y.y" } 
-    vpn_OU_AD = "OU=VPNGroups,+  ] 
-    user "FirstUser", +
-    password = "Password123"+   
 +
 +resource "...{ 
 + 
 +  dynamic "virtual_network_rule{ 
 +    for_each var.virtual_network_rule_ids 
 + 
 +    content { 
 +      id virtual_network_rule.value["id"] # etiqueta dynamic + value + key 
 +    }
   }   }
 } }
 </code> </code>
-<code properties> +=== casos de uso 
-... +  * [[tech:terraform:casos-uso]] 
-user_data ${data.template_file.vm_adwriter.rendered} +
-... +
-</code>+
 == ejemplos == ejemplos
   * [[tech:terraform:poc-ad]]   * [[tech:terraform:poc-ad]]
   * [[tech:terraform:win-instance]]   * [[tech:terraform:win-instance]]
  • tech/terraform/start.1558336454.txt.gz
  • Darrera modificació: 20/05/2019 00:14
  • per mate