
In this session, we will look at an introduction to Infrastructure as Code and get an understanding of Infrastructure as Code and how it works.
In this session, we will look at some of the benefits provided by Infrastructure as Code and how it can be useful to setup the infrastructure rather than setting up the infrastructure manually.
In this session, we will look at the various tools that can be used to setup the infrastructure using code. We will discuss about Terraform, Pulumi, AWS CloudFormation, Azure Resource Manager and Google Deployment service.
In this session, we will look at an introduction to Terraform and get an understanding of what Terraform is.
In this session, we will look at some of the important benefits that Terraform provides when we talk about creating the infrastructure using code.
In this session, we will look at how we can install or setup Terraform on the Ubuntu machine before we can start working with Terraform.
In this session, we will look at how we can install or setup Terraform on the Windows machine before we can start working with Terraform.
In this session, we will look at an introduction to Terraform providers and get an understanding on what Terraform providers are and where we can see the list of providers, how to use the providers.
In this session, we will look at an introduction to Terraform resources and get an understanding on what Terraform resources are and will look at a sample resource block and the arguments example.
In this session, we will look at an introduction to Terraform registry and get an understanding on what Terraform registry are and how we can use the Terraform registry to refer to the providers, modules and policies.
In this session, we will look at authorization and configuring the permissions so that we can create the resources on AWS cloud platform. Here, we will use the access key and secret in the credential files and see how we can authenticate to AWS.
In this session, we will look at how we can authorize to AWS using environment variables. Here, we will define the access key and secret as environment variables and use that to authenticate to AWS to create the resources. You can run the below commands to create the environment variables on Linux machine.
export AWS_ACCESS_KEY_ID="access_key"
export AWS_SECRET_ACCESS_KEY="secret_key"
export AWS_REGION="region_name"
In this session, we will look at how we can authenticate to AWS using credential files. Here, we will store the access key and secret in files and then use the file to authenticate to AWS to create the resources.
In this session, we will look at how we can authenticate to AWS using an IAM role. Here, we will launch an EC2 instance and install Terraform on EC2 instance. Create an IAM role with the necessary permissions and attach that IAM role to the EC2 instance which will give Terraform the necessary permissions to create the resources on AWS platform.
In this session, we will look at the basic syntax for the Terraform configuration. Here, we will look at the various components that we need to define inside the Terraform configuration when writing the Terraform code for creating the resources.
In this session, we will look at the terraform init command and what this command does. Whenever we the write the code for the first time, we will have to initialize the code. For that, we can use the terraform init command. This command will download all the plugins required to run the terraform code. For example, this command will download the provider plugins and stores it in the local machine.
In this session, we will look at the terraform validate command. This command can used to validate the code or do a syntax check on the code to make sure we do not have any syntax error when we are executing the code to create the resources on AWS. This command will check if we are using the right arguments, right variables and other validations before we can execute the code to create the resources.
In this session, we will look at the terraform plan command. This command can be used to generate a plan or a preview of the resources that Terraform will create when we execute the code. This command can be useful to validate or to verify if Terraform will create the right resources or the resources that we want to be created. We can use this plan to confirm if we have the right values like ami ID, instance type, vpc ID, etc or the number of resources that will be created.
In this session, we will look at the terraform apply stage. Here, we can use the command to create the resources once we are okay with the plan. We can use this command to generate a plan and if are okay with the plan, we can approve the plan and execute the code and Terraform will start creating the resources for us.
In this session, we will look at the terraform show stage. Here, we will use the command to show the resources or the components that are managed by Terraform once the resource are created. This command will read the current latest state file and display the information in the JSON format or in the human readable format so that we can see what all resources Terraform is managing.
In this session, we will look at the terraform destory command. Here, we will use this command to destroy the resources managed by Terraform. At any point, if we do not want the resources or the infrastructure created or managed by Terraform, we can delete those resources by using this command.
In this session, we will look at an introduction to Terraform variables and why we should use Terraform variables. Terraform variables can be used as a placeholder to store certain values and then we can call those wherever we want in the configuration files. This way, we do not have to hardcore the values in the configuration files to refer the values.
In this session, we will look at how we can refer or how we can call the variables in the Terraform configuration files. We will also look at the various options that are available to pass the variable values and also the variable precedence that Terraform follows when calling the variables in the configuration files.
In this session, we will look at how we can pass the values for the Terraform variables from the command line. Here, we will use the -var flag to pass the values for the variables that we have declared in the Terraform configuration files. This is one way for us to pass the values if we have very few variables declared in the configuration files.
In this session, we will look at how we can can the values to the variables using variable definition files. Here, we can maintain a separate file for the variables and define all the variables and the values in this file and then Terraform will start reading the values from the variable definition files.
In this session, we will look at how we can pass the Terraform variable values as environment variables. For this, we will be declaring the environment variables as TF_VAR_variable_name and then the value. Terraform will look for the variable values in the below order.
Environment variables.
The terraform.tfvars file, if present.
The terraform.tfvars.json file, if present.
Any *.auto.tfvars or *.auto.tfvars.json files, processed in lexical order of their filenames.
Any –var and –var-file options on the command line, in the order they are provided.
In this session, we will look at an introduction and get an understanding of Terraform Outputs. Terraform Outputs can be used when ever we want to display or expose certain information about the resource we are creating. For example, if you want to expose the public IP address or the private IP address of the EC2 instance, we can make use of Terraform Outputs for that.
In this session, we will look at an example of how we can use the output block to display or to expose certain information about the resource that we are creating using Terraform, on the command line. In this example, we will expose the private IP address and the public IP address on the command line using the Terraform output block.
In this session, we will look at the optional arguments that we can pass with Terraform Outputs. When we talk about the Terraform Outputs arguments, we have description, sensitive, depends_on. Here, we will look at the description argument and the sensitive argument that we can pass with the Terraform Outputs configuration. Description argument can be used to add an explanation as why we are defining the output block and the sensitive argument can be used to hide some sensitive information on the command line. Terraform will not display the value on the command line if it is set to sensitive.
In this session, we will look an introduction to Terraform locals and get an understanding as to what Terraform locals are and when we can use them in the configuration files. Terraform locals can be used to declare local values once and use them multiple time in the configuration files. This will improve the readability of the code.
In this session, we will look at an example for Terraform locals. Here, we will define the common_tags key values using the locals block and then use that common_tags in the resource block as part of tags when creating the resources.
In this session, we will look at how we can break the configuration file into multiple configuration files. Be default, we have been writing all the code in one configuration file. However, the common practise is that we break the configuration file such that the components are maintained in separate files. For example, a file for provider block, a file for resource block, a file for variables block, a file for all the variables values and so on.
In this session, we will look at an introduction and get an understanding on Terraform data sources. Data source block can be used to refer to the existing resources and use them to create some additional resources. For example, we have an existing subnet in AWS and we want to launch an instance in this existing subnet using Terraform. Instead of hard-coding the subnet value, we can fetch the value from AWS using the data source block and then provide that information in the resource block to launch the instance in the AWS console.
In this session, we will look at the first example for Terraform data source. In this example, we will fetch the information about existing AWS subnet and then use that information in the resource block to launch an EC2 instance using Terraform. By default, if we do not specify the subnet in the resource block, instance will be created in a random subnet selected by AWS. Here, we will specify the subnet that we want using the data source block which the fetch the information like the subnet ID and use that in the resource block to create the instance.
In this session, we will look at the second example for the Terraform data source. Here, we will fetch the information about the existing security group, VPC and key pair name and then use that information in the resource blocks like to create security group in the specified VPC, launch the instance using the specified key pair and the security group.
In this session, we will look at an introduction to Terraform provisioners. Terraform provisioners can be used when we want to run some commands or execute some scripts on the remote resource. We can use this to take some action or model specific steps on the remote resource created using Terraform. Terraform provides with three types. File provisioner, local-exec provisioner and remote-exec provisioner.
In this session, we will look at how we can declare the provisioner block in the Terraform configuration files. We can declare the provisioner block using the "provisioner" block and then mention the provisioner type to use. For example, file provisioner, local-exec provisioner and remote-exec provisioner.
In this session, we will look at the local-exec provisioner. local-exec provisioner can be used when we want to take some action or model specific actions on the local machine. Local machine is the machine where Terraform is running. We can use the local-exec to execute some commands to execute some script on the local machine. When using the local-exec provisioner, we do not have to specify any connection block as we are running the commands on the local machine.
In this session, we will look at the file provisioner. File provisioner can be used when we want to copy a file or a collection of files to the resource created by Terraform. When using the file provisioner, we will also need to provide the connection block which will contain the connection setting which Terraform will use to connect to the new resource to copy the files to the remote resource.
In this session, we will look at the remote-exec provisioner block. Here, remote-exec provisioner block can be used to run some commands to execute some scripts on the remote resource created by Terraform. When using the remote-exec provisioner block, we will have to specify the connection block which Terraform will use to connect to the remote resource and perform the specified actions.
In this course, we will learn about Infrastructure as Code and Terraform. Terraform is one of the most famous and widely used Infrastructure as Code tool in the IT industry. We will look at an introduction to Infrastructure as Code, Different tools of IaC, Setting up Terraform on linux and windows machines.
We will also look at the various concepts of Terraform like providers, resources, outputs, variables, creating infra on AWS, Authenticating to AWS, Terraform workflow, Data source, provisioners, meta-arguments, tainting and alternative to tainting, null-resources, Terraform workspaces, managing Terraform state file on the local machine and remote machine, Using Terraform modules to make the infra code reuable, Terraform cloud, Terraform data types and lots of other concepts that will help you start working with Terraform to create and manage infrastructure on AWS using code.
In this course, I have covered all the important concepts that you will end up using in your day to day activities. All the sessions will have hands-on examples so that you can practise them along with the videos and there are also assignments and quiz available for most of the sections, so that you will be more comfortable with the concepts that we have covered in this course.