count vs for_each https://spacelift.io/blog/terraform-count-for-each Exploring Ephemerality in Terraform 1.10 and Beyond https://developer.hashicorp.com/terraform/intro/terraform-editions ====== enviroments ====== https://thomasthornton.cloud/2024/04/25/using-terraform-tfvars-for-environment-agnostic-deployments/ ====== New in terraform ====== New ways to simplify HashiCorp Terraform workflows with AI-powered insights from Anthropic. 1️⃣ Automate commands to ensure your Terraform configurations are reliable before deploying. 2️⃣ For HCP #Terraform customers, the Plan Analyzer helps you review plan files, even when working with public modules or unfamiliar code. Make your infrastructure more efficient and secure. Start exploring these tools today: https://bit.ly/4iyitAn ====== terraform 1.10 ====== https://www.hashicorp.com/blog/terraform-1-10-improves-handling-secrets-in-state-with-ephemeral-values?trk=feed_main-feed-card_feed-article-content ====== Data types ====== https://developer.hashicorp.com/terraform/language/expressions/types#map ====== hardcoded values ====== https://dustindortch.com/2024/02/08/terraform-best-practices-do-not-hard-code-values/ ====== Github actions ====== https://build5nines.com/terraform-github-actions-automated-deployment/ ====== Terraform env ====== {{:burim:img_7678.jpeg?600|}} ====== Terraform repo setup====== https://nedinthecloud.com/2024/03/04/creating-your-first-terraform-repository/ ====== Matt from microsoft videos ====== https://www.youtube.com/@matt-ffffff ====== Data types ====== https://youtu.be/hBmcwtVQkPM?si=Rd8q4cEucr-bnIkM https://gist.github.com/burimali/fdc782235b5ec81625ced7ff7bd1c87d ====== terraform move to module ====== https://youtu.be/3eSVr5HO29s?si=81DtWPy1I1vI7WHt ====== terraform state rm ====== https://spacelift.io/blog/terraform-state-rm# ====== trainings learning ====== https://github.com/btkrausen/hashicorp/tree/master ====== data ====== https://spacelift.io/blog/terraform-data-sources-how-they-are-utilised ====== Using GithubActions to retrive credentials ====== on: push: branches: - main jobs: terraform: runs-on: ubuntu-latest env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} steps: - name: Checkout uses: actions/checkout@v2 - name: Terraform Init run: terraform init - name: Terraform Plan run: terraform plan - name: Terraform Apply run: terraform apply ====== Data types ====== Terraform supports several data types that can be used in configuration files and expressions. Here are some of the most common data types in Terraform: String: A sequence of characters. Strings are enclosed in double quotes (") or single quotes (') in Terraform configuration files. Examples: "hello world", 'my string'. Number: A numeric value. Numbers can be integers or floating-point values. Examples: 42, 3.14159. Boolean: A value that represents true or false. Boolean values are represented by the keywords true and false in Terraform configuration files. List: A collection of items of any data type. Lists are defined using the list function and enclosed in square brackets []. Examples: [1, 2, 3], ["item1", "item2"]. Map: A collection of key-value pairs of any data type. Maps are defined using the map function and enclosed in curly braces {}. Examples: { "name" = "John", "age" = 30 }, { "key1" = "value1", "key2" = "value2" } Tuple: A collection of fixed number of items of different data types. Tuples are defined with parentheses () and comma separated values. Examples: ("firstname", "lastname"), (1, "string") Set: A collection of unique items of any data type. Sets are defined using the set function and enclosed in curly braces {}. Object: Terraform does not have a specific object type, but you can use a map to represent an object, where the keys are the object's properties and the values are the property's values. Null: A special value that represents the absence of a value. It can be used to indicate that a variable or an output has no value. Any: Terraform also has an "any" type, which can be used to represent any type of value. This is useful when you want to pass a value to a function or a resource that can accept multiple types of input. Terraform also has a number of built-in functions that can be used to manipulate and process data, such as length, lookup, concat, flatten, zipmap, setproduct, distinct, sort, reverse, slice, chunklist among others. These functions allow you to perform operations on data, such as counting the number of items in a list, looking up a specific item in a list, or joining two lists together. ====== Condition ====== https://stackoverflow.com/questions/67902785/adding-extra-element-to-a-list-in-terraform-if-condition-is-met ====== Bank TF ====== https://youtu.be/070B392Qvw8 ====== for_each ====== https://www.youtube.com/watch?v=NgJ9Q5xGhGo ====== Labs Play ====== https://play.instruqt.com/hashicorp ====== Cisco ====== https://blogs.cisco.com/developer/terraformiosxe01?ccid=networkautomation-page&dtid=newsletter&oid=sdeweese-fy22-q3-0000-03devblog-ww&mkt_tok=NTY0LVdIVi0zMjMAAAGDD8HML3l4-b17XbeT2CahGWIvvEKWBxm8WoVlmvc_2XJOxnTwr00ShYL65nOn11gV1u28GVlQCLjw2axIlQy_5HUCWG38bUVZ0s8XPGYE9htf-qE ====== Youtube terraform videos ====== https://youtu.be/7jnuTdhxjhw ====== Terraform enterprise ====== https://www.youtube.com/watch?v=w4YPGjAWmDc ====== GCP terraform ====== https://blog.zittatech.com/google-cloud-platform/bootstrapping-gcp-project-with-terraform/ https://www.techgeeknext.com/cloud/terraform-gcp-github-example https://stackoverflow.com/questions/68290090/set-up-google-cloud-platform-gcp-authentication-for-terraform-cloud https://blog.avenuecode.com/how-to-use-terraform-to-create-a-virtual-machine-in-google-cloud-platform https://cobalt.io/blog/iac-pipelines-with-terraform-and-cloud-build https://learn.hashicorp.com/tutorials/terraform/github-actions https://medium.com/interleap/automating-terraform-deployment-to-google-cloud-with-github-actions-17516c4fb2e5 https://stackoverflow.com/questions/69820011/using-terraform-cloud-with-the-google-provider-on-github-actions-gives-an-error https://discuss.hashicorp.com/t/how-to-authenticate-to-gcp-when-using-terraform-cloud/17489/10 https://learn.hashicorp.com/tutorials/terraform/tfe-provider-run-triggers?in=terraform/cloud https://acloudguru.com/blog/engineering/how-to-use-github-actions-to-automate-terraform [[https://discuss.hashicorp.com/t/how-to-authenticate-to-gcp-when-using-terraform-cloud/17489/10| Credentials Issues]] ====== Docs ====== https://www.terraform.io/intro/index.html https://elatov.github.io/2018/07/use-terraform-to-deploy-a-vm-in-esxi/#installing-terraform https://elatov.github.io/2018/07/use-terraform-to-deploy-a-vm-in-esxi/ https://blog.inkubate.io/create-a-ubuntu-18-04-terraform-template-for-vmware-vsphere/ ====== Terraform vs Ansible ====== [[https://www.youtube.com/watch?v=rx4Uh3jv1cA| Ansible vs. Terraform]] Terraform is declarative. Ansible is a mix of declarative and procedural, depending on the modules. running terraform terraform init terraform plan terraform apply ====== terraform sample ====== https://github.com/terraform-google-modules/terraform-google-lb ====== vpc service controls ====== https://github.com/burimali/terraform-google-vpc-service-controls https://github.com/terraform-google-modules/terraform-google-vpc-service-controls/blob/master/examples/bq-exfil-demo/README.md ====== glb demo ====== https://github.com/wwwil/glb-demo ====== Github actions runner in GCP ====== https://github.com/ned1313/terraform-tuesdays https://github.com/ned1313/terraform-tuesdays/tree/main/2021-09-14-GCP-Runner https://www.youtube.com/watch?v=3Zw3W35Iukk