🔥Terraform | init, tags, name, EC2, Security groups, Dynamic Blocks

EPISODE · Jun 19, 2022 · 8 MIN

🔥Terraform | init, tags, name, EC2, Security groups, Dynamic Blocks

from Programmers · host Software Engineering

📚 Book - https://amzn.to/39ty0Tq - "Terraform: Up & Running: Writing Infrastructure as Code" Terraform init will download all the dependencies needed by the terraform project like when you have a clean maven project, and running almost any mvn command will pull down the dependencies. tags in terraform helps you set the additional tag properties of the resources, if you want to set the name of the resource that would appear in aws then you need to set the tag with specific key and this key is Name actual names of resources, so if you would like to create a vpc resource in aws with name "myvpc" you need to actually set its tags which is different from aws tags you would set the tags { Name = "MyVpc" } and this would set the name of the resource in aws and not the tags in aws. Create EC2The terraform name aws_instance The 2 mandatory arguments are ami and instance_type Example resource "aws_instance "MyEc2Instance" { ami = "ami_287428346" // some aws ami instance_type = "t2.micro" } Note to reference an id of a terraform instance need to specify <aws key>.<name>.id so aws_vpc.myvpc.id When we set an "aws_eip" which is elastic ip we have to tell it for which ec2 instance we assign it to, so the resource contains the "instance" property that we have to set. Aws account can give us up to 5 elastic ips. Security group - statefull firewall - stateful means if we allowed some traffic going in it would automatically allow traffic to go out, in stateless we have to set explicitly the input to the firewall and the output. resource "aws_security_group" "MySecurityGroup" { name = "Allow HTTPS" ingress { from_port = 443 to_port = 443 # This is a range of ports from to to is not output. protocol = "TCP" cird_blocks = ["0.0.0.0/0"] # All traffic. } egress { } } Then we can reference this MySecurityGroup from various resources such as ec2 instances. Dynamic Blocks - iterator, for_each var.mylistvar , content = port.value This allows us to use for_each.prefix the block you want to use the list for each in dynamic example variable "ingressrules" { # Here you set the list variable holding the data to be dynamically included. type = list(number) default = [80, 443] } dynamic "ingress" { # Now iterate and use the above list defined above. iterator = port for_each = var.ingressrules content { from_port = port.value } } Terraform dynamic blocks and security groups definition in Terraform and AWS elastic IP definition in Terraform and EC2 We continue also to investigate what does terraform init means.

NOW PLAYING

🔥Terraform | init, tags, name, EC2, Security groups, Dynamic Blocks

0:00 8:10

No transcript for this episode yet

We transcribe on demand. Request one and we'll notify you when it's ready — usually under 10 minutes.

Command Line Heroes Red Hat Hear the epic true tales of how developers, programmers, hackers, geeks, and open source rebels are revolutionizing the technology landscape. Command Line Heroes is an award-winning podcast hosted by Saron Yitbarek and produced by Red Hat. Get root access to show notes, transcripts, and other associated content at https://redhat.com/commandlineheroes My JavaScript Story Charles M Wood Interviews with people, contributors, programmers, authors, and other builders in the JavaScript Community Khanyisa Keke TV Khanyisa Keke On Khanyisa Keke TV, developers can learn and improve their Android for Kotlin Development skills. On this podcast, programmers can learn Android for Kotlin coding from scratch, improve their existing programming skills, get tips, be kept up to date with all the latest happenings and get access to free resources. Powered by Firstory Hosting Eyes on the Right Podcast Join educator, counselor, and Bible teacher Amy as she uncovers the hidden world behind today’s culture. With years of in-depth research into topics like the Illuminati, secret societies, pagan religions, Hollywood, symbolism, and intentionally concealed truths, Amy brings a fresh and fearless perspective to the conversation.Drawing from her time living near Hollywood, insider connections, and experiences with survivors and mind control de-programmers, Amy shares powerful insights and firsthand accounts that shed light on the darkness. Viewing these topics through a Biblical lens.
URL copied to clipboard!