Terraform interview asking 1 Difference between terraform module and terraform workspace , what we have use when scenario 2 why you need a terraform local state file , when you need centralized state file in S3 , each has it own usecase and sometimes its equally important your local state file in your host , what is that scenario where local state file becomes critical 3 i want manage .tf file with updated versions only of aws , whats that option where we can decide version of aws updation as per need or customize it in .tf file 4 whats syntax to manage lock in your state file , if developer 1 doing some work , developer 2 should not be allowed until lock is released? 5 why you use import functionality in terraform ? what is syntax of import in terraform 6 what is tainted and untainted in the terraform 7 what you mean by a terraform refresh ? 8 What need to provisioner , why you need provisioner in terraform?
The magic tool that you are looking for to make all of this easier is aztfy. It can import a resource and all of its child resources, and then spit out the HCL. You can also pointed at a resource Group and it will do the same thing for the entire Resource Group. And it's from Microsoft.
Ned, appreciate the videos, these have really helped in allowing me to get refreshed on terraform. Appreciate the honest review you give on these different topics especially the terraform import functionality, which is where I am at currently. Looking to import some of my already deployed infrastructure and I saw another one of your videos on terraformer, again, great work and saving me the frustration of wasting my time with it. However, I was curious, if you have had a chance to look at terracognita? Not opposed to doing the manual labor and again, videos like this one are priceless in learning how to accomplish these tasks. If you are looking for recommendations, would love to see a review on the terracognita capability.
Great video thanks Ned! I had mistakenly deleted my state file and am in the process of rebuilding it. This video was a real lifesaver as it pointed me in the right direction!
Terraform will handle creating the state file if it doesn't already exist. You could have an existing config with a state file, and use import to add resources that were created outside of Terraform. That's a scenario I deal with in my Terraform Deep Dive course on Pluralsight.
Hi I have configured my terraform backend and then did import but my state file not pushed to containers how do I pushed my state file to containers after importing resource
@Ned in the Cloud How do i specify an existing resource when i am creating a new resource using main.tf, say i have a resource group existing before which i created using Terraform and now i want to reference that existing RG while deploying a new VM say, so how do i specify that, just giving the name explicitly is not working
They have to be in the same state if you want to refer to the resource group using its address in the config file. Your other option is to add the resource group as a data source, if you aren't going to manage its lifecycle with the config. registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/resource_group
You can remove the subnet from the configuration, and Terraform will destroy it on the next apply. You can change the size of the VM, but that may delete the VM and recreate it.
After importing the AWS infrastructure to terraform can I export this infrastructure to a different AWS account to spin all the same infrastructure there if no then what is the method to achieve the same.
There's not really a way to transfer infrastructure from one AWS account to another. You could use the same configuration with a separate workspace to deploy identical infrastructure to a different account, but you would still need to transfer the data stored in any of the resources in the source account.
You can delete a stack in Cloud Formation without deleting the underlying infrastructure. I would suggest getting everything imported into Terraform first and then removing it from Cloud Formation.
Totally! You can use the same config for multiple environments with workspaces. The contents of the state is a combination of variables, configuration, and actual resources in the target providers.
This training was awesome. Thank you Ned.
Glad you enjoyed it!
Terraform interview asking
1 Difference between terraform module and terraform workspace , what we have use when scenario
2 why you need a terraform local state file , when you need centralized state file in S3 , each has it own usecase and sometimes its equally important your local state file in your host , what is that scenario where local state file becomes critical
3 i want manage .tf file with updated versions only of aws , whats that option where we can decide version of aws updation as per need or customize it in .tf file
4 whats syntax to manage lock in your state file , if developer 1 doing some work , developer 2 should not be allowed until lock is released?
5 why you use import functionality in terraform ? what is syntax of import in terraform
6 what is tainted and untainted in the terraform
7 what you mean by a terraform refresh ?
8 What need to provisioner , why you need provisioner in terraform?
Ty Ned, another good knowledge transfer! Great job on naming TF tue folders :)
Thanks for adding description ❤🙏
The magic tool that you are looking for to make all of this easier is aztfy. It can import a resource and all of its child resources, and then spit out the HCL. You can also pointed at a resource Group and it will do the same thing for the entire Resource Group. And it's from Microsoft.
Love aztfy! I did a whole video about it: ruclips.net/video/ADnTk3U22ew/видео.html
Ned, appreciate the videos, these have really helped in allowing me to get refreshed on terraform. Appreciate the honest review you give on these different topics especially the terraform import functionality, which is where I am at currently. Looking to import some of my already deployed infrastructure and I saw another one of your videos on terraformer, again, great work and saving me the frustration of wasting my time with it. However, I was curious, if you have had a chance to look at terracognita? Not opposed to doing the manual labor and again, videos like this one are priceless in learning how to accomplish these tasks. If you are looking for recommendations, would love to see a review on the terracognita capability.
Great video thanks Ned! I had mistakenly deleted my state file and am in the process of rebuilding it. This video was a real lifesaver as it pointed me in the right direction!
Glad it helped!
Good stuff Ned, So you would need still need to create from the state file your main.tf configurations?
Terraform will handle creating the state file if it doesn't already exist. You could have an existing config with a state file, and use import to add resources that were created outside of Terraform. That's a scenario I deal with in my Terraform Deep Dive course on Pluralsight.
Hi I have configured my terraform backend and then did import but my state file not pushed to containers how do I pushed my state file to containers after importing resource
Great vid as usual.
Perfect!! This is what I needed.
thanks a nice Start Ned Loved it :)
Hi Ned. Is there any way to import resources in one go ?
Loved this one!
Great Tutorial Ned, Loved it :)
@Ned in the Cloud How do i specify an existing resource when i am creating a new resource using main.tf, say i have a resource group existing before which i created using Terraform and now i want to reference that existing RG while deploying a new VM say, so how do i specify that, just giving the name explicitly is not working
They have to be in the same state if you want to refer to the resource group using its address in the config file. Your other option is to add the resource group as a data source, if you aren't going to manage its lifecycle with the config.
registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/resource_group
How to import forti os providers
If I need to delete the imported subnet or if I imported a VM but need to scale it up, how can I do that?
You can remove the subnet from the configuration, and Terraform will destroy it on the next apply. You can change the size of the VM, but that may delete the VM and recreate it.
tnx, It helped a lot
After importing the AWS infrastructure to terraform can I export this infrastructure to a different AWS account to spin all the same infrastructure there if no then what is the method to achieve the same.
There's not really a way to transfer infrastructure from one AWS account to another. You could use the same configuration with a separate workspace to deploy identical infrastructure to a different account, but you would still need to transfer the data stored in any of the resources in the source account.
Of course you can do it...
Hi
How would this work for AWS Cloud Formation?
You can delete a stack in Cloud Formation without deleting the underlying infrastructure. I would suggest getting everything imported into Terraform first and then removing it from Cloud Formation.
Sounds like someone has a case of the Mondays! (on a Tuesday apparently)
Don't forget the cover page
!! love u sir !!
config != state :) just saying
Totally! You can use the same config for multiple environments with workspaces. The contents of the state is a combination of variables, configuration, and actual resources in the target providers.