Skip to content

Commit

Permalink
chore: rename "example-dev" to "oqtopus-dev" (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
orangekame3 authored Oct 23, 2024
1 parent 2a63629 commit 813381e
Show file tree
Hide file tree
Showing 25 changed files with 61 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ zip:
@echo "Project Location: ${WORKSPACE}/${APP}"
@echo "Library Location: ${DEPLOY_PACKAGES_DIR}"
@poetry export -f requirements.txt --output requirements.txt
@docker run --platform linux/x86_64 -u $(id -u):$(id -g) -v ./${DEPLOY_PACKAGES_DIR}:/${DEPLOY_PACKAGES_DIR} -v ./requirements.txt:/requirements.txt -v ~/.cache/pip:/.cache/pip python:3.12 pip install -r /requirements.txt -t /${DEPLOY_PACKAGES_DIR}
@docker run --platform linux/x86_64 --user $(id -u):$(id -g) \
-v ./${DEPLOY_PACKAGES_DIR}:/${DEPLOY_PACKAGES_DIR} \
-v ./requirements.txt:/requirements.txt \
python:3.12 /bin/bash -c "\
curl -fsSL https://astral.sh/uv/install.sh | bash && \
/root/.cargo/bin/uv pip install --system --no-cache-dir --requirement /requirements.txt --target /${DEPLOY_PACKAGES_DIR}"
@cd ${DEPLOY_PACKAGES_DIR} && rm -rf __pycache__ && zip -r ../${BIN}/lambda.zip * -q
@cd ${WORKSPACE} && zip -r ../deployment/$(PROFILE)/${BIN}/lambda.zip ${APP} -q
@cd ${WORKSPACE} && zip -r ../deployment/$(PROFILE)/${BIN}/lambda.zip ${LIB} -q
Expand Down
Binary file modified docs/asset/aws_system_architecture_diagram_network.drawio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/asset/aws_system_architecture_diagram_overview.drawio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion docs/en/architecture/aws_system_architecture_diagram.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
| Inbound | EIC Endpoint | 22 | 22 | tcp | EIC endpoint access |
| Outbound | DB Proxy | 3306 | 3306 | tcp | DB proxy access |
| Outbound | Secret Manager | 443 | 443 | tcp | Secret Manager access |
| Outbound | Anywhere (Internet) | -1 | -1 | -1 | Internet access |

## 3. DB Proxy Security Group

Expand Down
6 changes: 3 additions & 3 deletions docs/en/developer_guidelines/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ credential_process = aws configure export-credentials --profile myprofile
Use `myprofile-tf` in each Terraform configuration file. Set it as follows:

```bash
# terraform/infrastructure/example-dev/example-dev.tfbackend
# terraform/infrastructure/oqtopus-dev/oqtopus-dev.tfbackend
bucket = "xxxxxxxxxxxxxx"
key = "xxxxxxxxxxxxxx"
encrypt = true
Expand All @@ -34,7 +34,7 @@ dynamodb_table = "xxxxxxxxxxxxx"
```

```bash
# terraform/infrastructure/example-dev/terraform.tfvars
# terraform/infrastructure/oqtopus-dev/terraform.tfvars
product = "oqtopus"
org = "example"
env = "dev"
Expand All @@ -43,6 +43,6 @@ db_user_name = "xxxxxxxxxxxxx"
profile = "myprofile-tf"
```

After running `terraform init -backend-config=example-dev.tfbackend -reconfigure` under `terraform/infrastructure/example-dev`, you can execute `terraform plan` to run Terraform with MFA authentication.
After running `terraform init -backend-config=oqtopus-dev.tfbackend -reconfigure` under `terraform/infrastructure/oqtopus-dev`, you can execute `terraform plan` to run Terraform with MFA authentication.

See details in here: [Terraform AWS Provider Issue #2420](https://github.com/hashicorp/terraform-provider-aws/issues/2420#issuecomment-1899137746)
44 changes: 22 additions & 22 deletions docs/en/operation/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ The `terraform` directory contains the code for deploying the AWS environment fo
├── infrastructure
│ ├── Makefile
│ ├── README.md
│ ├── example-dev
│ ├── oqtopus-dev
│ └── modules
└── service
├── Makefile
├── README.md
├── example-dev
├── oqtopus-dev
└── modules

7 directories, 6 files
Expand All @@ -32,31 +32,31 @@ First, let's explain the procedure to deploy the infrastructure environment, suc

### Deploying the Infrastructure Layer

`terraform/infrastructure/example-dev` is the deployment directory for each environment. Since the state file is managed by S3, an S3 bucket needs to be created. Run the following command to create an S3 bucket.
`terraform/infrastructure/oqtopus-dev` is the deployment directory for each environment. Since the state file is managed by S3, an S3 bucket needs to be created. Run the following command to create an S3 bucket.

```bash
aws s3api create-bucket --bucket tfstate.oqtopus-example-dev --profile example-dev --region ap-northeast-1 --create-bucket-configuration LocationConstraint=ap-northeast-1
aws s3api create-bucket --bucket tfstate.oqtopus-oqtopus-dev --profile oqtopus-dev --region ap-northeast-1 --create-bucket-configuration LocationConstraint=ap-northeast-1
```

Next, create a DynamoDB table to lock the Terraform state file.

```bash
aws dynamodb create-table --table-name terraform-lock --attribute-definitions AttributeName=LockID,AttributeType=S --key-schema AttributeName=LockID,KeyType=HASH --billing-mode PAY_PER_REQUEST --profile example-dev --region ap-northeast-1
aws dynamodb create-table --table-name terraform-lock --attribute-definitions AttributeName=LockID,AttributeType=S --key-schema AttributeName=LockID,KeyType=HASH --billing-mode PAY_PER_REQUEST --profile oqtopus-dev --region ap-northeast-1
```

Next, prepare the Terraform configuration files. Create the following two files.

```hcl:infrastructure/example-dev/example-dev.tfbackend
# infrastructure/example-dev.tfbackend
bucket = "tfstate.oqtopus-example-dev"
```hcl:infrastructure/oqtopus-dev/oqtopus-dev.tfbackend
# infrastructure/oqtopus-dev.tfbackend
bucket = "tfstate.oqtopus-oqtopus-dev"
key = "infrastructure.tfstate"
encrypt = true
profile = "example-dev"
profile = "oqtopus-dev"
region = "ap-northeast-1"
dynamodb_table = "terraform-lock"
```

```hcl:infrastructure/example-dev/terraform.tfvars
```hcl:infrastructure/oqtopus-dev/terraform.tfvars
# infrastructure/terraform.tfvars
product="oqtopus"
org="example"
Expand All @@ -69,8 +69,8 @@ These files set the storage location for the state file and environment variable
Initialize with `terraform init`. Run the following command:

```bash
cd infrastructure/example-dev
terraform init -backend-config=example-dev.tfbackend
cd infrastructure/oqtopus-dev
terraform init -backend-config=oqtopus-dev.tfbackend
```

Then deploy with `terraform apply`.
Expand All @@ -85,32 +85,32 @@ Next, let's explain the service deployment.

Prepare the Terraform configuration files similarly as before. Create the following two files:

```hcl:service/example-dev/example-dev.tfbackend
# service/example-dev.tfbackend
bucket = "tfstate.oqtopus-example-dev"
```hcl:service/oqtopus-dev/oqtopus-dev.tfbackend
# service/oqtopus-dev.tfbackend
bucket = "tfstate.oqtopus-oqtopus-dev"
key = "service.tfstate"
encrypt = true
profile = "example-dev"
profile = "oqtopus-dev"
region = "ap-northeast-1"
dynamodb_table = "terraform-lock"
```

```hcl:service/example-dev/terraform.tfvars
```hcl:service/oqtopus-dev/terraform.tfvars
# service/terraform.tfvars
product = "oqtopus"
org = "example"
env = "dev"
region = "ap-northeast-1"
state_bucket = "tfstate.oqtopus-example-dev"
state_bucket = "tfstate.oqtopus-oqtopus-dev"
remote_state_key = "infrastructure.tfstate"
profile = "example-dev"
profile = "oqtopus-dev"
```

Initialize with `terraform init`. Run the following command:

```bash
cd service/example-dev
terraform init -backend-config=example-dev.tfbackend
cd service/oqtopus-dev
terraform init -backend-config=oqtopus-dev.tfbackend
```

## Application Deployment
Expand All @@ -121,7 +121,7 @@ To deploy in a multi-account configuration, we separate directories by environme

```bash
├── README.md
├── example-dev
├── oqtopus-dev
│ ├── Makefile
│ └── .env
└── foo-dev
Expand Down
1 change: 0 additions & 1 deletion docs/ja/architecture/aws_system_architecture_diagram.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
| Inbound | EIC Endpoint | 22 | 22 | tcp | EIC endpoint access |
| Outbound | DB Proxy | 3306 | 3306 | tcp | DB proxy access |
| Outbound | Secret Manager | 443 | 443 | tcp | Secret Manager access |
| Outbound | Anywhere (Internet) | -1 | -1 | -1 | Internet access |

## 3. DB Proxy Security Group

Expand Down
6 changes: 3 additions & 3 deletions docs/ja/developer_guidelines/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ credential_process = aws configure export-credentials --profile myprofile
terraformの各設定ファイルでは`myprofile-tf`を利用します。下記のように設定してください。

```bash
# terraform/infrastructure/example-dev/example-dev.tfbackend
# terraform/infrastructure/oqtopus-dev/oqtopus-dev.tfbackend
bucket = "xxxxxxxxxxxxxx"
key = "xxxxxxxxxxxxxx"
encrypt = true
Expand All @@ -35,7 +35,7 @@ dynamodb_table = "xxxxxxxxxxxxx"
```

```bash
# terraform/infrastructure/example-dev/terraform.tfvars
# terraform/infrastructure/oqtopus-dev/terraform.tfvars
product = "oqtopus"
org = "example"
env = "dev"
Expand All @@ -44,6 +44,6 @@ db_user_name = "xxxxxxxxxxxxx"
profile = "myprofile-tf"
```

`terraform/infrastructure/example-dev`配下で`terraform init -backend-config=example-dev.tfbackend -reconfigure`を実行後、`terraform plan`を実行することでMFA認証付きでのTerraform実行が可能です。
`terraform/infrastructure/oqtopus-dev`配下で`terraform init -backend-config=oqtopus-dev.tfbackend -reconfigure`を実行後、`terraform plan`を実行することでMFA認証付きでのTerraform実行が可能です。

詳細は以下を参照してください。 : [Terraform AWS Provider Issue #2420](https://github.com/hashicorp/terraform-provider-aws/issues/2420#issuecomment-1899137746)
44 changes: 22 additions & 22 deletions docs/ja/operation/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ terraformディレクトリには、プロジェクトのAWS環境をデプロ
├── infrastructure
│ ├── Makefile
│ ├── README.md
│ ├── example-dev
│ ├── oqtopus-dev
│ └── modules
└── service
├── Makefile
├── README.md
├── example-dev
├── oqtopus-dev
└── modules

7 directories, 6 files
Expand All @@ -33,33 +33,33 @@ infrastructureディレクトリには、ネットワークやデータストア

### インフラ層のデプロイ

terraform/infrastructure/example-devが各環境のデプロイメントディレクトリです。
terraform/infrastructure/oqtopus-devが各環境のデプロイメントディレクトリです。
stateファイルはS3で管理されるため、S3バケットを作成する必要があります。
以下のコマンドを実行して、S3バケットを作成します。

```bash
aws s3api create-bucket --bucket tfstate.oqtopus-example-dev --profile example-dev --region ap-northeast-1 --create-bucket-configuration LocationConstraint=ap-northeast-1
aws s3api create-bucket --bucket tfstate.oqtopus-oqtopus-dev --profile oqtopus-dev --region ap-northeast-1 --create-bucket-configuration LocationConstraint=ap-northeast-1
```

次にTerraformのStateフアイルをロックするためのDynamoDBテーブルを作成します。

```bash
aws dynamodb create-table --table-name terraform-lock --attribute-definitions AttributeName=LockID,AttributeType=S --key-schema AttributeName=LockID,KeyType=HASH --billing-mode PAY_PER_REQUEST --profile example-dev --region ap-northeast-1
aws dynamodb create-table --table-name terraform-lock --attribute-definitions AttributeName=LockID,AttributeType=S --key-schema AttributeName=LockID,KeyType=HASH --billing-mode PAY_PER_REQUEST --profile oqtopus-dev --region ap-northeast-1
```

次に、terraformの設定ファイルを用意します。以下の2つのファイルを作成します。

```hcl:infrastructure/example-dev/example-dev.tfbackend
# infrastructure/example-dev.tfbackend
bucket = "tfstate.oqtopus-example-dev"
```hcl:infrastructure/oqtopus-dev/oqtopus-dev.tfbackend
# infrastructure/oqtopus-dev.tfbackend
bucket = "tfstate.oqtopus-oqtopus-dev"
key = "infrastructure.tfstate"
encrypt = true
profile = "example-dev"
profile = "oqtopus-dev"
region = "ap-northeast-1"
dynamodb_table = "terraform-lock"
```

```hcl:infrastructure/example-dev/terraform.tfvars
```hcl:infrastructure/oqtopus-dev/terraform.tfvars
# infrastructure/terraform.tfvars
product="oqtopus"
org="example"
Expand All @@ -72,8 +72,8 @@ region = "ap-northeast-1"
`terraform init`で初期化を行います。以下のコマンドを実行します。

```bash
cd infrastructure/example-dev
terraform init -backend-config=example-dev.tfbackend
cd infrastructure/oqtopus-dev
terraform init -backend-config=oqtopus-dev.tfbackend
```

その後`terrafom apply`でデプロイを行います。
Expand All @@ -88,32 +88,32 @@ terraform apply

先ほどと同様に、terraformの設定ファイルを用意します。以下の2つのファイルを作成します。

```hcl:service/example-dev/example-dev.tfbackend
# service/example-dev.tfbackend
bucket = "tfstate.oqtopus-example-dev"
```hcl:service/oqtopus-dev/oqtopus-dev.tfbackend
# service/oqtopus-dev.tfbackend
bucket = "tfstate.oqtopus-oqtopus-dev"
key = "service.tfstate"
encrypt = true
profile = "example-dev"
profile = "oqtopus-dev"
region = "ap-northeast-1"
dynamodb_table = "terraform-lock"
```

```hcl:service/example-dev/terraform.tfvars
```hcl:service/oqtopus-dev/terraform.tfvars
# service/terraform.tfvars
product = "oqtopus"
org = "example"
env = "dev"
region = "ap-northeast-1"
state_bucket = "tfstate.oqtopus-example-dev"
state_bucket = "tfstate.oqtopus-oqtopus-dev"
remote_state_key = "infrastructure.tfstate"
profile = "example-dev"
profile = "oqtopus-dev"
```

`terraform init`で初期化を行います。以下のコマンドを実行します。

```bash
cd service/example-dev
terraform init -backend-config=example-dev.tfbackend
cd service/oqtopus-dev
terraform init -backend-config=oqtopus-dev.tfbackend
```

## アプリケーションのデプロイ
Expand All @@ -124,7 +124,7 @@ terraform init -backend-config=example-dev.tfbackend

```bash
├── README.md
├── example-dev
├── oqtopus-dev
│ ├── Makefile
│ └── .env
└── foo-dev
Expand Down
2 changes: 1 addition & 1 deletion docs/terraform_modules/security-group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module "security_group" {

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.57.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 5.57.0 |

## Resources

Expand Down
2 changes: 1 addition & 1 deletion terraform/infrastructure/modules/security-group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module "security_group" {

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.57.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 5.57.0 |

## Resources

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ endif
endif

init: ## Run terraform init
@terraform init -backend-config=example-dev.tfbackend
@terraform init -backend-config=oqtopus-dev.tfbackend

lint: ## Run tflint
@tflint --init
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module "db" {
db_name = "main"
user_name = var.db_user_name
db_proxy_security_group_ids = module.security_group.db_proxy_security_group_ids
db_performance_insights_enabled = var.db_performance_insights_enabled
db_performance_insights_enabled = true
}

module "management" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ variable "db_user_name" {
type = string
}

variable "db_performance_insights_enabled" {
description = "DB performance insights enabled"
type = bool
}

variable "profile" {
description = "aws profile"
type = string
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ endif
endif

init: ## Run terraform init
@terraform init -backend-config=example-dev.tfbackend
@terraform init -backend-config=oqtopus-dev.tfbackend

lint: ## Run tflint
@tflint --init
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 813381e

Please sign in to comment.