-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path09_workspace
More file actions
49 lines (39 loc) · 1.62 KB
/
Copy path09_workspace
File metadata and controls
49 lines (39 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
1. to get the list of workspcae
terraform workspace list
2. To create a new workspace [example new workspace dev]
terraform workspace new dev
3. Switch to a specific workspace
terraform workspace select dev
4 To delete the workspace
terraform workspace delete dev
6. Tear down the infrastructure you just
Sample Test Output:
[ec2-user@ip-10-0-14-30 terraform_monowar]$ terraform workspace list
* default
[ec2-user@ip-10-0-14-30 terraform_monowar]$ terraform workspace new dev
Created and switched to workspace "dev"!
You're now on a new, empty workspace. Workspaces isolate their state,
so if you run "terraform plan" Terraform will not see any existing state
for this configuration.
[ec2-user@ip-10-0-14-30 s3]$ terraform plan
Terraform used the selected providers to generate the following execution plan. Resource actions are
indicated with the following symbols:
------
[ec2-user@ip-10-0-14-30 s3]$ terraform apply
---
Apply complete! Resources: 7 added, 0 changed, 0 destroyed.
[ec2-user@ip-10-0-14-30 s3]$ terraform workspace select dev
[ec2-user@ip-10-0-14-30 s3]$ terraform workspace list
default
* dev
[ec2-user@ip-10-0-14-30 s3]$ terraform state list
aws_kms_key.demokey
aws_s3_bucket.amity01
aws_s3_bucket_lifecycle_configuration.amity01_lifecycle_rule
aws_s3_bucket_public_access_block.amity_public_block
aws_s3_bucket_server_side_encryption_configuration.amity01-encryption
aws_s3_bucket_server_side_encryption_configuration.demo_encryption
aws_s3_bucket_versioning.amity01_versioning
[ec2-user@ip-10-0-14-30 s3]$ terraform workspace select default
Switched to workspace "default".
[ec2-user@ip-10-0-14-30 s3]$ terraform state list