Skip to content

Commit 12a07a4

Browse files
authored
Fix awscli v2 (#86)
1 parent 3d6cf4c commit 12a07a4

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

Dockerfile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ WORKDIR /iac
8989
COPY docker-entrypoint.sh /usr/local/bin/
9090
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
9191

92-
FROM minimal AS az
92+
FROM minimal AS az
9393
ARG AZURE_CLI_VERSION
9494
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
9595
# hadolint ignore=DL3008
@@ -114,19 +114,22 @@ RUN apt-get update \
114114
&& rm -rf /var/cache/apt/archives/* /var/lib/apt/lists/*
115115

116116
FROM minimal AS aws
117-
# pip installs
118-
ARG AWSCLI_VERSION
119-
# hadolint ignore=DL3013
120-
RUN python3 -m pip install --upgrade --no-cache-dir pip \
121-
&& pip install --user --no-cache-dir git+git://github.com/aws/aws-cli.git#${AWSCLI_VERSION}
117+
ARG AWS_CLI_VERSION
118+
RUN curl -L https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${AWS_CLI_VERSION}.zip -o /tmp/awscliv2.zip \
119+
&& unzip /tmp/awscliv2.zip -d /tmp/ \
120+
&& /tmp/aws/install --bin-dir /aws-cli-bin/ \
121+
# Required for the *-aws images to be functional
122+
&& ln -sf /aws-cli-bin/* /usr/local/bin/ \
123+
&& rm -rf /tmp/*
122124

123125
# Add aws autocomplete
124-
RUN echo 'complete -C /root/.local/bin/aws_completer aws' >> ~/.bashrc
126+
RUN echo 'complete -C /usr/local/bin/aws_completer aws' >> ~/.bashrc
125127

126128
FROM minimal AS final
127129

128130
# AWS
129-
COPY --from=aws /root/.local /root/.local
131+
COPY --from=aws /usr/local/aws-cli/ /usr/local/aws-cli/
132+
COPY --from=aws /aws-cli-bin/ /usr/local/bin/
130133
COPY --from=aws /root/.bashrc /root/.bashrc
131134

132135
# Azure

tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
CLIENT = docker.from_env()
2626
CONFIG = utils.parse_config(config_file=constants.CONFIG_FILE)
2727

28-
TARGETS = {}
28+
TARGETS: dict[str, dict[str, list[str]]] = {}
2929
for target in constants.TARGETS:
3030
TARGETS[target] = {}
3131
if target == "final":

tests/test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def run_terraform(*, image: str):
154154
# Ensure insecure configurations fail due to checkov
155155
# Tests is a list of tuples containing the test environment, command, and
156156
# expected exit code
157-
tests: list[tuple[dict, str, int]] = [
157+
tests: list[tuple[dict, str, int]] = [ # type: ignore
158158
({}, "terraform --skip-tfsec --skip-terrascan plan", 1),
159159
({}, "tfenv exec --skip-tfsec --skip-terrascan plan", 1),
160160
(
@@ -192,7 +192,7 @@ def run_terraform(*, image: str):
192192
# Ensure insecure configurations fail due to terrascan
193193
# Tests is a list of tuples containing the test environment, command, and
194194
# expected exit code
195-
tests: list[tuple[dict, str, int]] = [
195+
tests: list[tuple[dict, str, int]] = [ # type: ignore
196196
({}, "terraform --skip-tfsec --skip-checkov plan", 3),
197197
({}, "tfenv exec --skip-tfsec --skip-checkov plan", 3),
198198
(
@@ -231,7 +231,7 @@ def run_terraform(*, image: str):
231231
# disabled
232232
# Tests is a list of tuples containing the test environment, command, and
233233
# expected exit code
234-
tests: list[tuple[dict, str, int]] = [
234+
tests: list[tuple[dict, str, int]] = [ # type: ignore
235235
({"DISABLE_SECURITY": "true"}, "terraform init", 0),
236236
({"DISABLE_SECURITY": "true"}, "tfenv exec init", 0),
237237
(
@@ -296,7 +296,7 @@ def run_terraform(*, image: str):
296296
# Ensure secure configurations pass
297297
# Tests is a list of tuples containing the test environment, command, and
298298
# expected exit code
299-
tests: list[tuple[dict, str, int]] = [
299+
tests: list[tuple[dict, str, int]] = [ # type: ignore
300300
({}, "terraform init", 0),
301301
({}, "tfenv exec init", 0),
302302
(

0 commit comments

Comments
 (0)