Wednesday, 8 June 2022

Terraform Workspaces

 


By default, there is one state file (terraform.tfstate) per configuration directory. Sometimes, we want to reuse the same configuration files for multiple projects. Instead of creating a directory for each project and copy-pasting files, we can use Terraform's feature called workspaces. Each workspace has its own, isolate state. When in particular workspace, terraform plan can see only its state.

When we create a configuration file, before explicitly creating any workspaces, Terraform implicitly creates a workspace named default:

$ terraform console
> terraform.workspace
default

To create a workspace:

$ terraform workspace new ProjectA

To list all workspaces:

$ terraform workspace list
  default
* ProjectA
  ProjectB

Asterisk indicates the currently active workspace.

To switch to another workspace we need to use select command:

$ terraform workspace select default
Switched to workspace "default".
$ terraform workspace select ProjectB 
Switched to workspace "ProjectB".

terraform.workspace variable contains the name of the current workspace and it can be used in configuration files:

variables.tf:

variable region {
    default = "eu-west-1"
}

variable instance_type {
    default = "t2.micro"
}

variable ami {
    type = map
    default = {
        "ProjectA" = "ami-0123456789"
        "ProjectB" = "ami-9876543210"
    }
}

main.tf:

resource "aws_instance" "my-server" {
    ami = lookup(var.ami, terraform.workspace)
    instance_type = var.instance_type
    tags = {
        Name = "terraform.workspace"
    }
}

Terraform creates one state file for each workspace. They are stored in a directory named terraform.tfstate.d:

$ tree terraform.tfstate.d/
terraform.tfstate.d/
|--ProjectA
|       `-- terraform.tfstate
`--ProjectB
        `-- terraform.tfstate

---

1 comment:

FIRMWARE HACKS said...

⚠️CRYPTO TRADING SCAM ALERT⚠️

❌ Crypro Trading, Forex Trading, Stock Trading and their likes are a means of making money but it’s more like gambling. There are no sure means to guarantee that a person could make profit with them and that’s why it can also be reasoned to be scam. Let’s not forget that some individuals even give you 💯 % guarantee of making profits and end up running away with your money.

❌ You might have also come across some individuals that say they will give you guarantee on successful trades but they only end up as SCAMMERS as well. You here them say stuffs like 200% guaranteed in just 2 weeks and when you go into trade with them, they start telling you to pay profits percentage before you can get your income. These are all liars please avoid them. But if you have been a victim of this guys, then you should contact FIRMWARE now‼️

The internet today is full of Recovery Scam, you see so much testimonies been shared about how a firm or Company helped them recover what they lost to this Trading, but believe it, it’s just a way to lure more people and end up scamming them.


✳️The big Question is “Can someone Recover their money lost to Binary Option and Scam⁉️
I will say yes, and will tell you how.

The only way to Recovery your money back is by hiring HACKERS to help you break into the Firms Database Security System using the information you provide them with, Extract your file and get back your money. It seems like a really impossible thing to do, I will tell you, it should be impossible, but with the use of specially designed softwares known to HACKERS and Authorities (such as The FBI, CIA e.t.c) it is possible and the only way to recover your money.

✅FIRMWARE are a group of hackers who use their hacking skill to hunt down SCAMMERS and help individuals recovery their money from Internet SCAMMERS.
We just need the contact details of the SCAMMERS and Paymnet Info and within 4-8 hours your money will be return to you.

This are services we offer-:
🟢Crypto scam money recovery
🟢lost loan money recovery
🟢money laundry recovery
🟢Device hack
🟢Bank issues
🟢Access to school/company/fellowship/organization files
🟢Lost cars tracking
🟢fraud payment
🟢Access to cheating husband/wife device
🟢extending and subtracting of stamped file concerning a giving end line period of time
🟢tracing and recovering lost emails/conversations/contacts / and accessories
ETC


✳️ You can contact us via the emails below-:
firmwarehacks@gmail.com
Firmwarehacks@gmail.com
FIRMWARE HACKERS ©️
2022 All right reserved ®️