Skip to content

Commit

Permalink
fix: update terraform log path and configuration, adjust docker-compo…
Browse files Browse the repository at this point in the history
…se volume mappings
  • Loading branch information
x86taka committed Nov 19, 2024
1 parent 2311cb6 commit fe4f3a3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 18 deletions.
1 change: 1 addition & 0 deletions config.sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ worker:

terraform:
options:
path: "/usr/bin/terraform"
workingDirectory: "/deploy"
parallelism: 4
secrets:
Expand Down
7 changes: 4 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ services:
SLACK_WEBHOOK_URL:
DISCORD_WEBHOOK_team100:
build: .
#working_dir: /deploy
network_mode: "host"
tty: true
# ports:
# - "8089:8089"
volumes:
# tfファイルのディレクトリ
- ./deploy:/deploy
- ./config.yaml:/app/config.yaml
- ./logs:/app/logs
- /etc/localtime:/etc/localtime:ro
# tfファイルのディレクトリをマウント
# - ../tf-dir:/deploy
4 changes: 2 additions & 2 deletions pkg/terraform/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func NewClient(path, workDir, workspace, parallelism string, stdout bool, envs [
mergeEnv := append(os.Environ(), envs...)
mergeEnv = append(mergeEnv, "TF_WORKSPACE="+workspace)
mergeEnv = append(mergeEnv, "TF_LOG=INFO")
logPath := fmt.Sprintf("TF_LOG_PATH=/app/recreate-logs/%s-%s.json", workspace, time.Now().Format("2006-01-02-15-04-05"))
logPath := fmt.Sprintf("TF_LOG_PATH=/app/logs/%s-%s.json", workspace, time.Now().Format("2006-01-02-15-04-05"))
mergeEnv = append(mergeEnv, logPath)
c := &Client{
parallelism: parallelism,
Expand All @@ -37,7 +37,7 @@ func NewClient(path, workDir, workspace, parallelism string, stdout bool, envs [
log.Printf("%#v", c.env)
str, err := c.init()
if err != nil {
panic(str)
log.Println(str)
}
return c
}
Expand Down
13 changes: 0 additions & 13 deletions pkg/terraform/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,6 @@ func (c *Client) DestroyFromProblemId(problemId string, plan bool) (string, erro
return c.apply(str)
}

func (c *Client) RecreateTeam(plan bool) (string, int, error) {
_, resourceCount, err := c.GetResourceTargetId("")
if err != nil {
return "", resourceCount, err
}

if _, err := c.DestroyTeam(plan); err != nil {
return "", resourceCount, err
}
result, err := c.CreateTeam(plan)
return result, resourceCount, err
}

func (c *Client) RecreateFromProblemId(problemId string, plan bool) (string, int, error) {
str, resourceCount, err := c.GetResourceTargetId("module." + problemId)
/*
Expand Down

0 comments on commit fe4f3a3

Please sign in to comment.