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
Merged

Conversation

tei-k
Copy link
Contributor

@tei-k tei-k commented Aug 28, 2020

@tei-k tei-k self-assigned this Aug 28, 2020
@tei-k tei-k changed the title [WIP] Add doc for share environments Add doc for share environments Aug 28, 2020
Copy link
Contributor

@scalar-boney scalar-boney left a comment

Choose a reason for hiding this comment

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

Thank you
I left some small comments.


## Get a public/private key-pair from the person who built the environment

:memo: Also need all the tfsatte files when using `local` backend
Copy link
Contributor

Choose a reason for hiding this comment

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

Small spelling mistake in tfsatte.
Expected tfstate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! fixed in e6261d1.

private_key_path = "./example_key"
```

- Update the output value `private_key_path` and `public_key_path` of tfsate
Copy link
Contributor

Choose a reason for hiding this comment

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

Small spelling mistake in tfsatte.
Expected tfstate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ditto.

scalar-boney
scalar-boney previously approved these changes Aug 31, 2020
Copy link
Contributor

@scalar-boney scalar-boney left a comment

Choose a reason for hiding this comment

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

LGTM!
Thank you

Copy link
Collaborator

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

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

Left some suggestions on the explanation.

I have one question.
By doing this, an engineer who deployed an environment first can still have access to the environment?
In other words, is it for sharing or delegating?

@@ -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

@@ -0,0 +1,35 @@
# How to share environment 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.


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

## 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.


## Get a public/private key-pair from the person who built the environment

: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.


## 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.

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

private_key_path = "./example_key"
```

- 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.

- Update the output value `private_key_path` and `public_key_path` of tfstate

```
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 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 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.

@feeblefakie
Copy link
Collaborator

@tei-k I've given some suggestions but are they correct?

Also, how about this?

I have one question.
By doing this, an engineer who deployed an environment first can still have access to the environment?
In other words, is it for sharing or delegating?

@tei-k
Copy link
Contributor Author

tei-k commented Sep 1, 2020

By doing this, an engineer who deployed an environment first can still have access to the environment?
In other words, is it for sharing or delegating?

@feeblefakie
Because can still have access to it, so it's for sharing.


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

Update the values of `private_key_path` and `public_key_path` of `data.terraform_remote_state.network` in each tfstate and do as follows.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm testing with psim environment but I don't have tfstate file.
Do we need to pull ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The tfstate file in the psim environment is on s3, so you don't need to pull it to local.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok, this line applies only for local backend. How about the following commands? They need to be done whether or not local?
Anyways, I think it requires some updates.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They need to be done whether or not local?

Yes, This is necessary regardless of the back-end type. (not only for local)


## Get a private key from the person who has built an environment.

You can generate a corresponding public key with `ssh-keygen -yf ~/.ssh/privatekey.pem > publickey.pem`.
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
You can generate a corresponding public key with `ssh-keygen -yf ~/.ssh/privatekey.pem > publickey.pem`.
First of all, please get a private key that is used to build an environment by the person who did it.
You can generate a corresponding public key with `ssh-keygen -yf ~/.ssh/privatekey.pem > publickey.pem`.
Here we assume we have `/path/to/privatekey.pem` and `/path/to/publickey.pub`.

Update the key paths of `tfvars` file in your local such as `example.tfvars` in the example.

```
public_key_path = "./publickey.pem"
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 = "./publickey.pem"
public_key_path = "/path/to/publickey.pem"

```
public_key_path = "./publickey.pem"

private_key_path = "./privatekey.pem"
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 = "./privatekey.pem"
private_key_path = "/path/to/privatekey.pem"

docs/ShareEnvironment.md Show resolved Hide resolved

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

Update the values of `private_key_path` and `public_key_path` of `data.terraform_remote_state.network` in each tfstate and do as follows.
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 values of `private_key_path` and `public_key_path` of `data.terraform_remote_state.network` in each tfstate and do as follows.
Then, do the following to reflect the above changes to each module.

@tei-k
Copy link
Contributor Author

tei-k commented Sep 2, 2020

@feeblefakie
Thank you for the many suggestions. fixed in c35cfd2.

docs/ShareEnvironment.md Outdated Show resolved Hide resolved
docs/ShareEnvironment.md Outdated Show resolved Hide resolved
docs/ShareEnvironment.md Outdated Show resolved Hide resolved
docs/ShareEnvironment.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

@feeblefakie
Copy link
Collaborator

@ymorimo I'll merge it but please take a glance when you get a chance.

@feeblefakie feeblefakie merged commit 49f28b8 into master Sep 3, 2020
@feeblefakie feeblefakie deleted the add-doc-for-share-environments branch September 3, 2020 00:38
Copy link
Contributor

@ymorimo ymorimo left a comment

Choose a reason for hiding this comment

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

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants