gruntwork-io / terragrunt

Terragrunt is a flexible orchestration tool that allows Infrastructure as Code written in OpenTofu/Terraform to scale.
https://terragrunt.gruntwork.io/
MIT License
8.04k stars 975 forks source link

locking terraform state file stored in OCI Object Storage using terragrunt #693

Closed tama1214 closed 5 years ago

tama1214 commented 5 years ago

Hi all, To locking terraform tfstate file Terragrunt offer to use AWS DynamoDB. In this case Terragrunt use AWS S3 bucket for remote state storage. But my question is about locking tfstate file stored in OCI (Oracle Cloud Infrastructure) Object Storage. Is it possible to use terragrunt to block tfstate file stored in OCI Ojbect Storage? And if so, how will the code template for terragrunt look in this case?

Thank you in advance.

brikis98 commented 5 years ago

You can use any of the backends supported by Terraform: https://www.terraform.io/docs/backends/types/index.html. Put whatever configs you would've put in the backend "xxx" { ... } block into Terragrunt's config block.

tama1214 commented 5 years ago

@brikis98 , thanks for your reply. But my question is a little different.

I'm wondering if there is an alternative to AWS DynamoDB in OCI (Oracle Cloud Infrastructure)? I can't use AWS DynamoDB to lock the tfstate file. Is there any tool in OCI that I can use to lock a tfstate file through terragrunt? In one book I managed to find the following (page 163) image

Does this mean that only AWS DynamoDB can be used to lock the tfstate file? Thank you.

brikis98 commented 5 years ago

Ah, that book is out of date. When Terragrunt first came out, Terraform didn't support locking at all, so we implemented locking in Terragrunt using DynamoDB. Since then, Terraform added its own native locking, so we removed locking From Terragrunt.

So if you want locking, you need to use one of the officially supported backends that supports it: https://www.terraform.io/docs/backends/types/index.html.

tama1214 commented 5 years ago

oh, many thanks for this information. I will refer to this document. Thanks!