Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add doc for share environments #193

Merged
merged 12 commits into from
Sep 3, 2020
35 changes: 35 additions & 0 deletions docs/ShareEnvironment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# How to share environment with others
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# How to share environment with others
# How to share environments with others


This explanation is for multiple person operating in the same environment.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This explanation is for multiple person operating in the same environment.
Non-testing environments tend to be shared and operated with multiple DevOps engineers.
This document explains how to do it properly.


feeblefakie marked this conversation as resolved.
Show resolved Hide resolved
## Get a public/private key-pair from the person who built the environment
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Get a public/private key-pair from the person who built the environment
## Get a private key from the person who has built an environment.

Since we can just generate a corresponding public key, I deleted the statement.


:memo: Also need all the tfstate files when using `local` backend
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:memo: Also need all the tfstate files when using `local` backend
You can generate a corresponding public key with `ssh-keygen -yf ~/.ssh/privatekey.pem > publickey.pem`.
If an environment is created with `local` backend, you need all the tfstate files additionally. But, as a best practice, it's better to use cloud storage backends such as AWS S3 or Azure Blob Storage for an environment that is shared among multiple engineers.


## Update the tfstate of the network module

- Fix key_path of `example.tfvars` in your local
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Fix key_path of `example.tfvars` in your local
Update the key paths of `tfvars` file in your local such as `example.tfvars` in the example.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it's weird to talk about example because it's not the case mostly.


```
public_key_path = "./example_key.pub"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public_key_path = "./example_key.pub"
public_key_path = "./publickey.pem"


private_key_path = "./example_key"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private_key_path = "./example_key"
private_key_path = "./privatekey.pem"

```

- Update the output value `private_key_path` and `public_key_path` of tfstate
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Update the output value `private_key_path` and `public_key_path` of tfstate
Then, update tfstate file as follows.


```
cd example/[aws|azure]/network
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cd example/[aws|azure]/network
cd /path/to/network-module

terraform init
terraform refresh -var-file=example.tfvars
```

## Update the tfstate of the cassandra, scalardl and monitor modules
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Update the tfstate of the cassandra, scalardl and monitor modules
## Update the tfstate of the cassandra, scalardl, and monitor modules


- Update the value `private_key_path` and `public_key_path` of `data.terraform_remote_state.network` in each tfstate
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Update the value `private_key_path` and `public_key_path` of `data.terraform_remote_state.network` in each tfstate
Update the values of `private_key_path` and `public_key_path` of `data.terraform_remote_state.network` in each tfstate and do as follows.


```
cd example/[aws|azure]/[cassandra|scalardl|monitor]
terraform init
terraform refresh -var-file=example.tfvars
```