Terraform state locking using DynamoDB(LockID) and S3 Bucket - Part 14

Поделиться
HTML-код
  • Опубликовано: 9 сен 2024

Комментарии • 89

  • @bubu60112
    @bubu60112 Месяц назад

    Wooooow this is some brilliant stuff, well done! well explained !

  • @anoopsauravut
    @anoopsauravut Год назад +1

    Nice Explanation. Very well demonstrated. Now i got clear concept on locking.

  • @blessingjennifer-thebelove6822
    @blessingjennifer-thebelove6822 Год назад +1

    Easy to follow and well explained. Thanks

  • @sandeepreddy1705
    @sandeepreddy1705 2 года назад

    Rahul I'm watching all your videos, what I observed is a clear demonstration on what ur saying and ur making it looks easy after watching ur video.
    Please do a complete tutorial of creating a cluster and deploying an application using terraform.

  • @randikamunasinghe1014
    @randikamunasinghe1014 3 месяца назад

    well explained in short , Thanks Rahul

  • @vishnuacharya7172
    @vishnuacharya7172 Год назад

    very helpful, very good teacher he is

  • @DigvijayKotekar
    @DigvijayKotekar Год назад

    Thank you very much Sir, for this wonderful, very simple explanation.....you are awesome.

  • @aniruddhatope2388
    @aniruddhatope2388 6 месяцев назад

    Very informative Tutorial Rahul. 🎉 Your videos are helping a lot in clearing concepts. Thanks for the awesome efforts

    • @RahulWagh
      @RahulWagh  6 месяцев назад

      Glad to hear that

  • @laxmanshetty5099
    @laxmanshetty5099 2 года назад

    It was amazing video, Nice explanation and I got full clarity idea on the terraform state locking file processing 👍👌

  • @praveenbhogade
    @praveenbhogade 2 года назад

    Good Job Man I really liked it, waiting for more sessions to come !!!

  • @twizzoe
    @twizzoe 2 года назад

    Hi Praveen, your video's really helped me with my terraform projects. Thanks a lot.

    • @RahulWagh
      @RahulWagh  2 года назад

      I am glad to hear that

  • @Kalaiarasan_Balu
    @Kalaiarasan_Balu Год назад

    very good explanation

  • @Annishvarma
    @Annishvarma 2 месяца назад

    I have a question regarding Terraform state locking mechanisms. In AWS, we use DynamoDB to acquire a lock on the state file when running Terraform commands to prevent concurrent modifications. How can we achieve a similar state locking mechanism in Azure? Specifically, what services and configurations should we use to ensure the state file is properly locked when multiple DevOps engineers are working with Terraform in Azure?

  • @jianishaik9491
    @jianishaik9491 2 года назад +1

    Really superb

  • @adedayoademefun8895
    @adedayoademefun8895 2 месяца назад

    Hi Rahul. Thanks for your wonderful videos. I currently have multiple projects and I’m using one S3 bucket for my state backend. These multiple project state files are separated by paths in the S3 bucket. Now, I want to implement DynamoDB state file lock. Since I have multiple projects, can I use only one DynamoDB table, like I used one S3 bucket for my state file backend? If the answer is yes, how does DynamoDB separate and isolate the locks for each project in this table? Or do I have to create multiple DynamoDB table for all my projects? Your guidance and thoughts on this would be appreciated.

  • @sandv2902
    @sandv2902 2 года назад

    excellent info great work👌👌

  • @RohitTiwari-mo8mi
    @RohitTiwari-mo8mi 2 года назад

    Really nice video - completed the playlist

    • @RahulWagh
      @RahulWagh  2 года назад +1

      There are more to come

  • @rajatpathak4499
    @rajatpathak4499 4 месяца назад

    brilliant

  • @ronnierana1684
    @ronnierana1684 2 года назад

    Nice explanation !! Thank You !!

    • @RahulWagh
      @RahulWagh  2 года назад

      Glad it was helpful!

  • @baibhavghimire3827
    @baibhavghimire3827 2 года назад +4

    Nice content. One suggestion to viewers is - let's create that S3 bucket/ddb also through terraform rather than console.

    • @RahulWagh
      @RahulWagh  2 года назад +4

      Yeah that’s totally true you can create the s3 bucket as well as dynamodb using terraform but here the idea was to show the locking concept

    • @twizzoe
      @twizzoe 2 года назад +1

      Nice question, I was just about to ask this. I created my S3 bucket and dynamic db via terraform also. Thanks for the clarification

  • @nainabhartia8481
    @nainabhartia8481 Год назад

    Very well explained.

  • @vishalbobade7184
    @vishalbobade7184 2 года назад

    Spot on Sir 👌

  • @deviprasad7676
    @deviprasad7676 2 года назад

    U r always gives nice good content.. keep rocking 👍 👌 .. thx

  • @praveenbhogade
    @praveenbhogade 2 года назад

    Excited to see this :) cheers!!!

  • @amangoyal111
    @amangoyal111 2 года назад +2

    There is a mistake in this video if I understood the concept clearly. When you are running terraform apply as developer 2, it is not making a new ec2 but terraform just updated the name tag. And you said that you deleted the old ec2 which was lauched previously but if you look at the public ipv4 DNS closely, the old ec2 was not deleted. Please correct me if I am wrong. Thank you.

    • @SaiKrishnaSanka
      @SaiKrishnaSanka 2 года назад

      the whole notion of dev-2 using the same tfstate file means, any changes you're making to existing tfstate file is an update. Tag name was the only change.
      I think he got confused with the terms there. He didn't delete his old one. Dev-2 updated the Name of the instance that was created by Dev-1.

    • @RajeshD-rf9jb
      @RajeshD-rf9jb 8 месяцев назад

      @@SaiKrishnaSanka Thanks! this clarified my doubt and gave clear understanding. When he said dev2 created new instance, I was like whaaaatt.. lol.

  • @rutujanalawade7817
    @rutujanalawade7817 10 месяцев назад

    Hi Rahul, actually I just started learning terraform and your videos are very helpful for learning terraform. I have one query. I went through the document you shared in description box. In the document you have created dynamoDB table by manually and also created by adding terraform resouce as aws_dynamodb_table, so after creating dynamoDB table manually why we need to add aws_dynamodb_table as a resource in main.tf

  • @Devanjal358
    @Devanjal358 6 месяцев назад

    Hello Rahul there is a small mistake at last the developer 2 has just replaced the developer 1 instance it did not created new you can check the plan ..Please correct that thank you ..Nice video .

    • @RahulWagh
      @RahulWagh  6 месяцев назад +1

      I will check

  • @israel8707
    @israel8707 Год назад

    Hello Rahul, first thanks for shared, I have a questions,
    you can use the same key for both projects and not have problems, but the state of each project is not overwritten?
    I thinks that each state have info specific about you deploy, please can you helm with this doubth,
    Thanks again and regards

  • @M_Novman
    @M_Novman Год назад

    thank you!

  • @barick3018
    @barick3018 9 месяцев назад

    Hey Rahul, could you please help. Here when dev 2 applied changes it launched one more instance.. so every time they make changes a new instance will be launched.
    Dev 1 and Dev2 working for the same instance..
    They pulled the statefile.
    Dev1 updated and pushed and updated the statefile however Dev2 still has the old state file. How will Dev2 get the latest changes to the instance and add his change and push it back?

  • @DinushaMadusankaChandrasinghe
    @DinushaMadusankaChandrasinghe Год назад

    very usefull

  • @opeyemiojo1154
    @opeyemiojo1154 Год назад

    Thanks for the tutorial, I was able to follow along and the terraform.tfstate file was in my s3 bucket, but it’s also on my local machine, I tried deleting locally but it got created once again after running terraform init, is this a morning approach? Or am I doing something wrong? Thanks

  • @chandrav5706
    @chandrav5706 2 года назад +1

    Thanks Rahul. How to achieve the same using google cloud ?

    • @RahulWagh
      @RahulWagh  2 года назад

      Well it will be totally different and will need another session to demonstrate for google cloud

  • @kishoru3475
    @kishoru3475 2 года назад

    Hey, what does that Digest value mean in the DynamoDB after applying the terraform. You should have explained that as well.

  • @harirocking1530
    @harirocking1530 2 года назад

    Bro i have an question for uu...
    if two developer User A and User B are working under the same project. User A configured the entire s3 backend and raised the ec2-instance. How could User B sync the files, which has been created by user A ???. i mean how will he configure so that he could get terraform.tfstate file into this local system and can view wat User A has written the code.

  • @prabhat2k15
    @prabhat2k15 Год назад

    i have a use case, here developer2 has pushed it config and he is able to do it, but it should not. Because he should first pull the state file . What ma I missing here?

  • @sivaramakrishnak5993
    @sivaramakrishnak5993 6 месяцев назад

    Hi Rahul instead of passing access key and secret i passed profile but gives error does not find error can you help me resolve the issue

  • @martinthong125
    @martinthong125 7 месяцев назад

    Rahul, how do I store multiple state files in s3?

  • @viswanathreddy3085
    @viswanathreddy3085 2 года назад

    As per the video i'm trying to create 2 ec2 instances with the same state file, but in my case 1st ec2 instance is creating when i creating 2 one first one deleting and creating wit the 2 one. Any suggestions please.

  • @Rameshpowervlogs
    @Rameshpowervlogs Год назад

    Hii Rahul
    I have doubt in this video
    We are using here S3 and Dynamo db
    Y not we directly store the statefile into Dynamo db again y we are using S3 object.

    • @SaurabhNegi-sv6fy
      @SaurabhNegi-sv6fy 9 месяцев назад

      S3 is for storing FILES and directories while DynamoDB is for Key-value pairs. Understand the difference.

  • @Selvakumar-jp8he
    @Selvakumar-jp8he Год назад

    Hello sir, Actually when you used to apply command for project 2 developer but it was not created a new resource and just make a changes on tag in which you have created project 1 developer resources.

    • @gnanasundaramganesasivam4676
      @gnanasundaramganesasivam4676 2 месяца назад

      Yes... Looks like the same Ec2 created by developer 1 for project 1 got updated with the name in the second run initiated by developer 2 because the aws instance definition name was same with the other one... (in both main.tf file & same tf state file)

  • @AmrutaWagh-kb3yv
    @AmrutaWagh-kb3yv Год назад

    and how to unlock
    the state file
    lock?

  • @prudhvikumar8343
    @prudhvikumar8343 Год назад

    hi Rahul Key name what i will provide ?

  • @sudarshankoirala2072
    @sudarshankoirala2072 2 года назад

    Nice explanation, thanks. One question though, once the developer 1 has updated the state doesn't developer 2 pull the state before running the terraform apply ?

  • @laxmanshetty5099
    @laxmanshetty5099 2 года назад

    Dear Rahul sir,
    Could you please make any video of the how to integrate jenkins with terraform and using ansible.

    • @RahulWagh
      @RahulWagh  2 года назад +1

      surely i will add it to my list

  • @jagadeeshyenne7490
    @jagadeeshyenne7490 2 года назад

    Informative...! :) may be this question is not relevant to this video. Incase some how accidentally deleted remote terraform state file from s3, in that case how we can troubleshoot ?

    • @RahulWagh
      @RahulWagh  2 года назад +2

      The simple answer is you are screwed, there is no way you can get state file back if it has been deleted.
      The another way to be safe is to enabled the provisioning on the state file so that you have the older version of state file in your versioning repository

  • @pawansolanki20095
    @pawansolanki20095 Год назад

    Hi I getting error for S3 backend
    Successfully configured the backend "s3"! Terraform will automatically
    use this backend unless the backend configuration changes.
    Error refreshing state: AccessDenied: Access Denied
    status code: 403, request id: 13YNJNZ963P0G2PC, host id: BesL3R7isQNbpgHpncUwj1Eg9kioyJLxo4Gxw0fHCtKZzqM7vrKlT2Dw+ijf0WNcwjYBJLfOWGE=
    Any clue?

  • @afifsarker5150
    @afifsarker5150 Год назад

    If 2 dev are using separate folders then state file will be diff for two directory's. Isn't it? Or only one state file will be maintain for my laptop though i have created multiple projects?

    • @SaurabhNegi-sv6fy
      @SaurabhNegi-sv6fy 9 месяцев назад

      state files will be different for each folder if its locally stored but since Remote backend is being used here it will be 1 single statefile
      (s3://jhooq-terraform-s3-bucket/jhooq/terraform/remote/s3/terraform.tfstate)

  • @rajeshdebnath6239
    @rajeshdebnath6239 2 года назад

    sir, please make more video on dynamo db

  • @Youdude2
    @Youdude2 Год назад

    Is there a point in state locking if using CICD to run terraform apply?

    • @RahulWagh
      @RahulWagh  Год назад

      hmm terraform state locking is concept meant mostly for developer although you could use inside the CI CD pipeline as well. But i am still wondering why you want to trigger terraform apply from jenkins?

    • @Youdude2
      @Youdude2 Год назад

      @@RahulWagh so it can go through a PR approval before making changes to production. Why would you give developer access to apply to prod? Should be a role that Jenkins assume.

  • @vladeb1104
    @vladeb1104 Год назад

    in my case i've had to provide the access key for backend init: terraform init -backend-config="access_key=" -backend-config="secret_key="

  • @StephenRayner
    @StephenRayner 2 года назад +1

    Access key and secret key inside a tf file is insane...

    • @RahulWagh
      @RahulWagh  2 года назад

      Hello stephen it is just for tutorial not for production use, the idea is to learn the concepts. Not to build production level application on youtube.

  • @ajitdalvi596
    @ajitdalvi596 Год назад

    Nice home..it's distracting terraform

  • @StephenRayner
    @StephenRayner 2 года назад +1

    I find it so silly that you are using an infrastructure as code tool but then you go and make the S3 bucket manually... WTF

    • @RahulWagh
      @RahulWagh  2 года назад

      I always keep the more stress on concept first. All though incorporating S3 bucket code inside terraform is not a big deal but end users like you are only interested in dyanmoDB state locking concept. If i start putting everything in session then length of the session would increase many fold and no one is interested in learning how to create S3 bucket using terraform when i am saying the headline state locking using dyanmodb

    • @SaiKrishnaSanka
      @SaiKrishnaSanka 2 года назад

      I think it's wise to mention that there are several ways of creating S3 bucket. And that you chose to do it the console way.
      But I guess, if we're going to create S3 bucket from local. We should make backend changes to terraform only after we create the S3 bucket on aws from local.

  • @vedaanish2015
    @vedaanish2015 2 года назад

    Good explanation

    • @RahulWagh
      @RahulWagh  2 года назад

      Thanks for liking

    • @AndreasItoe
      @AndreasItoe 2 года назад

      Hey Rahul. Please are you doing some live session training and if yes please share information on how to reach you. Thanks