Skip to content

Commit c98a385

Browse files
테라폼 코드 개선 (#1637)
* fix: enhance terraform * fix: remove deploy script --------- Co-authored-by: woowahan-neo <[email protected]>
1 parent 95d8c1b commit c98a385

File tree

6 files changed

+29
-45
lines changed

6 files changed

+29
-45
lines changed

.github/workflows/terraform.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,8 @@ jobs:
2323
with:
2424
terraform_version: 1.5.3
2525

26-
- name: Select workspace
27-
run: |
28-
ENVIRONMENT=${{ github.event.inputs.environment }}
29-
terraform workspace select "$ENVIRONMENT" || terraform workspace new "$ENVIRONMENT"
30-
3126
- name: Terraform Init and Apply
27+
working-directory: terraform/environments/${{ github.event.inputs.environment }}
3228
run: |
3329
terraform init
3430
terraform plan -out=tfplan

terraform/backend.tf

-9
This file was deleted.

terraform/environments/dev/deploy.sh

-13
This file was deleted.

terraform/environments/dev/main.tf

+28
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
terraform {
2+
required_providers {
3+
aws = {
4+
source = "hashicorp/aws"
5+
version = "5.54.1"
6+
}
7+
}
8+
9+
cloud {
10+
organization = "cholog"
11+
12+
workspaces {
13+
name = "cholog-dev"
14+
}
15+
}
16+
}
17+
18+
provider "aws" {
19+
region = var.region
20+
21+
/** Note: access_key와 secret_key는 환경변수를 통해 설정하면 된다.
22+
export AWS_ACCESS_KEY_ID="your-access-key"
23+
export AWS_SECRET_ACCESS_KEY="your-secret-key"
24+
*/
25+
}
26+
127
module "tags" {
228
source = "../../modules/tags"
329

@@ -83,3 +109,5 @@ module "database" {
83109
server_tags = module.tags.server_tags
84110
database_tags = module.tags.database_tags
85111
}
112+
113+

terraform/provider.tf

-17
This file was deleted.

terraform/variables.tf

-1
This file was deleted.

0 commit comments

Comments
 (0)