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

V0.1 | Made it generic so that real module can reuse it #3

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "BP-BASE-SHELL-STEPS"]
path = BP-BASE-SHELL-STEPS
url = https://github.com/OT-BUILDPIPER-MARKETPLACE/BP-BASE-SHELL-STEPS.git
branch = v0.6
1 change: 1 addition & 0 deletions BP-BASE-SHELL-STEPS
Submodule BP-BASE-SHELL-STEPS added at f17d79
17 changes: 0 additions & 17 deletions BP-BASE-SHELL-STEPS/.github/workflows/reviewdog.yml

This file was deleted.

1 change: 0 additions & 1 deletion BP-BASE-SHELL-STEPS/README.md

This file was deleted.

42 changes: 0 additions & 42 deletions BP-BASE-SHELL-STEPS/functions.sh

This file was deleted.

34 changes: 0 additions & 34 deletions BP-BASE-SHELL-STEPS/log-functions.sh

This file was deleted.

4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ FROM hashicorp/terraform

RUN apk add --no-cache --upgrade bash
RUN apk add jq
RUN apk add --no-cache aws-cli

ENV SLEEP_DURATION 5s

COPY build.sh .
ADD BP-BASE-SHELL-STEPS /opt/buildpiper/shell-functions/
ADD modules /opt/buildpiper/modules

ENV ACTIVITY_SUB_TASK_CODE TF_MODULES_EXECUTE
ENV INSTRUCTION "apply"
ENV MODULE "ELASTICACHE"

ENTRYPOINT [ "./build.sh" ]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ I'll let people to use all the available OpsTree tf module via this step
```
git submodule init
git submodule update
docker build -t ot/tf-modules-step:0.0.1 .
docker build -t ot/tf-modules-step:0.1 .
```


Expand Down
10 changes: 7 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
#!/bin/bash
source /opt/buildpiper/shell-functions/functions.sh
source /opt/buildpiper/shell-functions/log-functions.sh
source /opt/buildpiper/shell-functions/aws-functions.sh

logInfoMessage "Creating for $MODULE"
logInfoMessage "I'll create/update [$MODULE] whose properties are available at [$WORKSPACE] and have mounted at [$CODEBASE_DIR]"
tfCodeLocation="${WORKSPACE}"/"${CODEBASE_DIR}"/"${TF_CODE_LOCATION}"
logInfoMessage "I'll create/update [$MODULE] available at [$tfCodeLocation]"
sleep "$SLEEP_DURATION"

cd "$WORKSPACE"/"${CODEBASE_DIR}"
cp /opt/buildpiper/modules/${MODULE}/*.tf .
getAssumeRole ${AWS_ASSUME_ROLE_ARN}

cd "${tfCodeLocation}"
cp /opt/buildpiper/modules/* .

logInfoMessage "Running below tf command"
logInfoMessage "terraform $INSTRUCTION"
Expand Down
37 changes: 0 additions & 37 deletions modules/ELASTICACHE/elasticache.tf

This file was deleted.

180 changes: 0 additions & 180 deletions modules/ELASTICACHE/elasticache_variable.tf

This file was deleted.