Importing Infrastructure into Terraform

Поділитися
Вставка
  • Опубліковано 24 лип 2024
  • Most deployments are not going to be 100% greenfield. You probably already have infrastructure running in Azure or AWS. How can you use the import command in Terraform to bring your brownfield environment into the magical world of Infrastructure as Code? That is what I will be covering in today's video.
    GitHub Repo: github.com/ned1313/terraform-...
    Daily Check-In Podcast: anchor.fm/ned-bellavance
    Terraform Certification Guide: leanpub.com/terraform-certified/
    -----------------------------------------------------------------------------------------------------
    Patreon: / nedinthecloud
    Website: nedinthecloud.com
    Pluralsight: app.pluralsight.com/profile/a...
    GitHub: github.com/ned1313
    Music by Evan Williams ©2020
    Intro 0:00
    Why Import at all? 2:38
    Resource deployment 3:33
    Deploying with Terraform 5:06
    Review the State File 8:59
    Import Operation 12:07
    Deploying with ARM Template 14:08
    Terraform Import Command 16:13
    Running the Import 18:10
    Challenge Time! 23:18
    Outro 24:14
  • Наука та технологія

КОМЕНТАРІ • 37

  • @mosksky
    @mosksky 3 роки тому +3

    Ty Ned, another good knowledge transfer! Great job on naming TF tue folders :)

  • @user-bv6il2nk4t
    @user-bv6il2nk4t 3 роки тому +4

    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?

  • @erfanebrahimi9748
    @erfanebrahimi9748 4 місяці тому +1

    This training was awesome. Thank you Ned.

  • @justindeemer6260
    @justindeemer6260 2 роки тому

    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.

  • @pakwilli
    @pakwilli 3 роки тому

    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!

  • @ziaurrehman4738
    @ziaurrehman4738 2 роки тому

    Thanks for adding description ❤🙏

  • @pradiptarakshit7751
    @pradiptarakshit7751 3 роки тому

    Great Tutorial Ned, Loved it :)

  • @say2merohit
    @say2merohit 3 роки тому +1

    thanks a nice Start Ned Loved it :)

  • @AlexDresko
    @AlexDresko Рік тому +1

    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.

    • @NedintheCloud
      @NedintheCloud  Рік тому

      Love aztfy! I did a whole video about it: ua-cam.com/video/ADnTk3U22ew/v-deo.html

  • @skillbuilderzone
    @skillbuilderzone 2 роки тому

    Perfect!! This is what I needed.

  • @jeroenketelaar3567
    @jeroenketelaar3567 3 роки тому +1

    Loved this one!

  • @devlinthornicroft9975
    @devlinthornicroft9975 3 роки тому +1

    Great vid as usual.

  • @franklinlisboa5449
    @franklinlisboa5449 3 роки тому +1

    tnx, It helped a lot

  • @prabhatjaiswal6034
    @prabhatjaiswal6034 2 роки тому

    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

  • @90DaysOfDevOps
    @90DaysOfDevOps 3 роки тому

    Good stuff Ned, So you would need still need to create from the state file your main.tf configurations?

    • @NedintheCloud
      @NedintheCloud  3 роки тому +1

      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.

  • @ipadair8841
    @ipadair8841 2 роки тому

    How to import forti os providers

  • @gauravmanshani206
    @gauravmanshani206 2 роки тому

    Hi Ned. Is there any way to import resources in one go ?

  • @Thankyoubaby1
    @Thankyoubaby1 2 роки тому

    Sounds like someone has a case of the Mondays! (on a Tuesday apparently)

  • @pallabkolkata
    @pallabkolkata 3 роки тому

    @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

    • @NedintheCloud
      @NedintheCloud  3 роки тому

      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

  • @brads2041
    @brads2041 Рік тому

    Don't forget the cover page

  • @susovanpanja
    @susovanpanja 3 роки тому

    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?

    • @NedintheCloud
      @NedintheCloud  3 роки тому

      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.

  • @michaelhanley7112
    @michaelhanley7112 3 роки тому

    Hi
    How would this work for AWS Cloud Formation?

    • @NedintheCloud
      @NedintheCloud  3 роки тому +1

      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.

  • @Ravithezealous
    @Ravithezealous 3 роки тому

    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.

    • @NedintheCloud
      @NedintheCloud  3 роки тому

      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.

    • @ToshuMalhotraiitk
      @ToshuMalhotraiitk Рік тому

      Of course you can do it...

  • @aefwon3936
    @aefwon3936 3 роки тому

    !! love u sir !!

  • @freibuis
    @freibuis 3 роки тому

    config != state :) just saying

    • @NedintheCloud
      @NedintheCloud  3 роки тому +1

      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.