How to Manage Secrets in Terraform?

Sdílet
Vložit
  • čas přidán 5. 09. 2024

Komentáře • 77

  • @AntonPutra
    @AntonPutra  Před rokem +2

    🔴 - To support my channel, I’d like to offer Mentorship/On-the-Job Support/Consulting - me@antonputra.com

  • @dmitrikonnov922
    @dmitrikonnov922 Před rokem +7

    This video is PURE GOLD.

  • @user-iw1ut3mb1k
    @user-iw1ut3mb1k Před rokem +7

    Another cool way is to store the sensitive values in SSM parameter store and then using the data source to pull it into your terraform.

    • @AntonPutra
      @AntonPutra  Před rokem

      yeap

    • @yogithakakarla1716
      @yogithakakarla1716 Před rokem

      Could u please share us how to do this please

    • @yogithakakarla1716
      @yogithakakarla1716 Před rokem

      Pls let us know how to do this @anton putra

    • @puttenicole
      @puttenicole Před rokem +4

      @@yogithakakarla1716
      data "aws_ssm_parameter" "token" {
      name = "/mysecret/token"
      }
      data.aws_ssm_parameter.token.value

    • @George-mk7lp
      @George-mk7lp Před rokem

      @@puttenicole thanks!

  • @yasharsultanov1749
    @yasharsultanov1749 Před rokem +3

    Антон, вы даже не сможете представить, как сильно вы помогли мне. Спасибо!

  • @gorandev
    @gorandev Před 2 měsíci +2

    Very informative video, I didn't know about the "pass" password manager. Thank you.

  • @kruchkov.alexandr
    @kruchkov.alexandr Před rokem +3

    Спасибо, очень полезный урок, я даже сохранил в закладках.

  • @prashlovessamosa
    @prashlovessamosa Před rokem +2

    Awesomely Explained.

  • @bobrt3739
    @bobrt3739 Před 3 měsíci +2

    Great

  • @azerbaijan50
    @azerbaijan50 Před rokem +2

    Thank you for this great video. You do priceless things here.

  • @karthikreddy6638
    @karthikreddy6638 Před rokem +4

    Hi Anton, As usual really great content. Kudos to you for putting such high quality content everytime.
    May be you can do playlist on central Logging solutions for k8s pods. Just a suggestion for future videos. Thanks again. Appreciate the effort you put behind these vidoes. 🎉

    • @AntonPutra
      @AntonPutra  Před rokem

      Thanks for the suggestion, will do in the future!

  • @Wzooff
    @Wzooff Před rokem +1

    Due to recent aws provider changes we can get rid of passwords for rds using manage_master_user_password attribute :)
    Databases for me was the last thing that required creating passwords. Everything else can be managed with iam roles without passwords/keys at all

  • @kelvinonuchukwu8215
    @kelvinonuchukwu8215 Před rokem +1

    Superb!!

  • @GunShot109
    @GunShot109 Před 3 měsíci +1

    very informative

  • @scottamolinari
    @scottamolinari Před 10 měsíci

    A very k8s-centric (i.e. the private key stays inside the cluster) method to encrypting secrets and being able to save them external to the cluster is via Bitnami's sealed secrets.

    • @AntonPutra
      @AntonPutra  Před 10 měsíci

      Yes, but it's hard to rotate and quickly revoke, unless you have a script that pulls the secrets and creates sealed secret out of it.

    • @scottamolinari
      @scottamolinari Před 10 měsíci

      @@AntonPutra- Um, no matter what system you use, you always have to have some process to generate the secret, encrypt it and save it.

    • @AntonPutra
      @AntonPutra  Před 10 měsíci +1

      @@scottamolinari Sure, I've been using Sealed Secrets in production for the last 5 years and have never had any issues. The only exception was with GKE, where you need to open an additional port between the master and nodes to pull the public cert for encrypting your secrets, because it uses kubectl proxy.

  • @suoncha
    @suoncha Před rokem +1

    Awsome! Btw, i’m using Vault hosting on an EC2 for storing secrets recently. What ur opinion abt its downsides when compare to managed services? Beside having to manage it urself lol

    • @AntonPutra
      @AntonPutra  Před rokem +3

      I would personally prefer to use self managed services like vault, well partially because we use multiple clouds.

  • @diegonayalazo
    @diegonayalazo Před 3 měsíci +1

  • @aminniktash9006
    @aminniktash9006 Před 11 měsíci +1

    great video especially the second part, Thanks in advance, Would you please explain after securing the secrets with the latest method, are we still have them as plain text on the state file or not? you didn't demo that part and the end of your video

    • @AntonPutra
      @AntonPutra  Před 11 měsíci +1

      Thank you! Yes, unfortunately, in the Terraform state, you'll find those secrets in plain text. It's a well-known issue that HashiCorp didn't want to resolve. They want everybody to migrate to Terraform Cloud. Now, after the fork "OpenTF," they immediately implemented encryption of those secrets. We may need to wait a few more weeks until they officially release it.

  • @samratchaudhary8511
    @samratchaudhary8511 Před rokem

    Sir, can you teach us how to create cross-account deployment using terraform module in jenkins CI/CD pipeline?

    • @AntonPutra
      @AntonPutra  Před rokem

      Do you mean hep to setup IAM roles for terraform?

    • @samratchaudhary8511
      @samratchaudhary8511 Před rokem

      @@AntonPutra Yes, sir! Usin'g IAM roles to deploy to dev, staging and production steps and strategy!

  • @SANTOSHSINGH4U
    @SANTOSHSINGH4U Před 4 měsíci

    is there a way to extract credentials from azure vault and run terraform and pass these values to azure pipeline solutions..I m looking for similar solution in azure around service principle

    • @AntonPutra
      @AntonPutra  Před 4 měsíci

      i assume it's posible, but you or your role need to have permissions for that vault secret

  • @yogithakakarla1716
    @yogithakakarla1716 Před rokem +1

    Show us how to do using hashicorp vault

    • @AntonPutra
      @AntonPutra  Před rokem

      Ok, there are so many different integrations.. I'll make one soon

  • @kruchkov.alexandr
    @kruchkov.alexandr Před rokem

    Am I understanding correctly that the combination of sops+kms is not the best choice because the password is stored in the state?
    So, from the perspective of GIT + CI/CD, it's beautiful and protected, but the state itself contains passwords and tokens.

    • @AntonPutra
      @AntonPutra  Před rokem +1

      Whatever option you choose, secrets will also be stored in plain text in the Terraform state. In my opinion, cloud-managed services (secrets managers) are more convenient in the long run than SOPs, etc.

  • @biLLie_wiLLie
    @biLLie_wiLLie Před rokem +1

    nice video! Are you devops?

  • @lakshayarora3935
    @lakshayarora3935 Před rokem

    Great video. I would like to know why pass doesn't pops up again to enter the passphrase (to retrieve the password ) once we have got the password. So, every time we need the password, it should ask for the passphrase everytime

    • @AntonPutra
      @AntonPutra  Před rokem

      it does only if you enter it initially

    • @lakshayarora3935
      @lakshayarora3935 Před rokem

      @@AntonPutra But that will not work in Production environments.

    • @AntonPutra
      @AntonPutra  Před rokem

      @@lakshayarora3935 I would use cloud secret managers for prod

  • @degeneric9618
    @degeneric9618 Před 4 měsíci

    4:20 for future reference

  • @YordisPrieto
    @YordisPrieto Před rokem

    What about the usage of random_password resource?
    Would you recommend to remove it? Or is there anyway to leverage random_password resource securely? I am in DigitalOcean so I do not have KMS or something alike at the moment.

    • @AntonPutra
      @AntonPutra  Před rokem

      you can use it for testing =) basically you use state to store your secret

    • @NeimorJeck
      @NeimorJeck Před rokem

      It's not the most convenient option. Instead of managed SMs from public cloud providers you can use the vault as self hosted solution and get sensitive data to terraform using the same approach.

    • @YordisPrieto
      @YordisPrieto Před rokem

      Definitely just for testing 😛
      I did deployed Vault but I have a cyclical dependency since I use terraform to deploy Vault so at some point in the infra I don’t have Vault available 🥲

  • @YordisPrieto
    @YordisPrieto Před rokem +1

    Second

  • @domw2391
    @domw2391 Před rokem +1

    looks like AWS secret manager is the easiest way

    • @AntonPutra
      @AntonPutra  Před rokem +2

      💯 or vault

    • @George-mk7lp
      @George-mk7lp Před rokem

      using secret manager will it still store secret value in state file?

  • @H4KnSL4K
    @H4KnSL4K Před 8 měsíci

    Ugh. Why are you using MacOS? With your knowledge, I was assuming you'd be running Linux...

    • @AntonPutra
      @AntonPutra  Před 8 měsíci +1

      Well, 90% of the software engineers in the Bay Area use MacOS, mostly because companies provide it. Some startups use Linux, but to be compliant, I guess they force us to use Mac.

    • @AntonPutra
      @AntonPutra  Před 8 měsíci +1

      Also, Adobe won't run on Linux, so I don't want to be constantly switching between two laptops.

  • @redfox6179
    @redfox6179 Před rokem

    Hi, do you have telegram?

    • @AntonPutra
      @AntonPutra  Před rokem

      I do, also I have email me@antonputra.com =)

    • @Alex-tv1fp
      @Alex-tv1fp Před rokem

      The only one thing I am not like on this video that you are reading text instead of real “explanation”.

  • @shantipahari
    @shantipahari Před rokem

    db_creds = jsondecode(
    │ 7: data.aws_secretsmanager_secret_version.creds.secret_string
    │ 8: )
    │ ├────────────────
    │ │ while calling jsondecode(str)

    │ Call to function "jsondecode" failed: invalid character '"' after object key:value pair.

    • @shantipahari
      @shantipahari Před rokem

      i tried to follow this but i got the following error

    • @kurtcobain5294
      @kurtcobain5294 Před rokem

      so you cant read? @@shantipahari