Skip to content

Instantly share code, notes, and snippets.

@joatmon08
Last active December 5, 2019 04:46
Show Gist options
  • Save joatmon08/b7fd4b6310a051f9e96d3a85355cda01 to your computer and use it in GitHub Desktop.
Save joatmon08/b7fd4b6310a051f9e96d3a85355cda01 to your computer and use it in GitHub Desktop.
Local Provisioner Debugging
FROM ubuntu:18.04
RUN apt-get update && apt-get install -y --no-install-recommends wget unzip python3-pip python3-dev \
&& cd /usr/local/bin \
&& ln -s /usr/bin/python3 python \
&& pip3 install --upgrade pip
RUN wget --no-check-certificate https://s3.amazonaws.com/aws-cli/awscli-bundle.zip \
&& unzip awscli-bundle.zip \
&& ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
RUN wget https://releases.hashicorp.com/terraform/0.12.17/terraform_0.12.17_linux_amd64.zip \
&& unzip terraform_0.12.17_linux_amd64.zip \
&& mv terraform /usr/local/bin/
RUN groupadd -r admin && useradd --no-log-init -r -g admin rosemary
USER rosemary
FROM ubuntu:18.04
RUN apt-get update && apt-get install -y --no-install-recommends wget unzip python3-pip python3-dev \
&& cd /usr/local/bin \
&& ln -s /usr/bin/python3 python \
&& pip3 install --upgrade pip setuptools
RUN pip3 install awscli --upgrade
RUN wget https://releases.hashicorp.com/terraform/0.12.17/terraform_0.12.17_linux_amd64.zip \
&& unzip terraform_0.12.17_linux_amd64.zip \
&& mv terraform /usr/local/bin/
RUN groupadd -r admin && useradd --no-log-init -r -g admin rosemary
USER rosemary
$ terraform apply -auto-approve
null_resource.local: Refreshing state... [id=6245153492614755925]
null_resource.whamoi: Refreshing state... [id=2815819290261938981]
null_resource.awscli: Refreshing state... [id=7207060310976078485]
null_resource.which: Refreshing state... [id=8730284836234865165]
null_resource.terraform: Refreshing state... [id=424322497838690385]
null_resource.local: Destroying... [id=6245153492614755925]
null_resource.which: Destroying... [id=8730284836234865165]
null_resource.awscli: Destroying... [id=7207060310976078485]
null_resource.terraform: Destroying... [id=424322497838690385]
null_resource.whamoi: Destroying... [id=2815819290261938981]
null_resource.terraform: Destruction complete after 0s
null_resource.which: Destruction complete after 0s
null_resource.awscli: Destruction complete after 0s
null_resource.whamoi: Destruction complete after 0s
null_resource.local: Destruction complete after 0s
null_resource.awscli: Creating...
null_resource.whamoi: Creating...
null_resource.terraform: Creating...
null_resource.which: Creating...
null_resource.which: Provisioning with 'local-exec'...
null_resource.whamoi: Provisioning with 'local-exec'...
null_resource.terraform: Provisioning with 'local-exec'...
null_resource.awscli: Provisioning with 'local-exec'...
null_resource.which (local-exec): Executing: ["/bin/sh" "-c" "which aws && which terraform"]
null_resource.whamoi (local-exec): Executing: ["/bin/sh" "-c" "whoami"]
null_resource.local: Creating...
null_resource.awscli (local-exec): Executing: ["/bin/sh" "-c" "aws --version"]
null_resource.terraform (local-exec): Executing: ["/bin/sh" "-c" "terraform version"]
null_resource.local: Provisioning with 'local-exec'...
null_resource.local (local-exec): Executing: ["/bin/sh" "-c" "ls -al /usr/local/bin"]
null_resource.whamoi (local-exec): rosemary
null_resource.whamoi: Creation complete after 0s [id=9020657420734241538]
null_resource.which (local-exec): /usr/local/bin/aws
null_resource.which (local-exec): /usr/local/bin/terraform
null_resource.which: Creation complete after 0s [id=601591571951164112]
null_resource.local (local-exec): total 49996
null_resource.local (local-exec): drwxr-xr-x 1 root root 4096 Dec 5 04:22 .
null_resource.local (local-exec): drwxr-xr-x 1 root root 4096 Dec 5 04:21 ..
null_resource.local (local-exec): lrwxrwxrwx 1 root root 22 Dec 5 04:21 aws -> /usr/local/aws/bin/aws
null_resource.local (local-exec): -rwxr-xr-x 1 root root 221 Dec 5 04:20 pip
null_resource.local (local-exec): -rwxr-xr-x 1 root root 221 Dec 5 04:20 pip3
null_resource.local (local-exec): -rwxr-xr-x 1 root root 221 Dec 5 04:20 pip3.6
null_resource.local (local-exec): lrwxrwxrwx 1 root root 16 Dec 5 04:20 python -> /usr/bin/python3
null_resource.local (local-exec): -rwxr-xr-x 1 root root 51175008 Dec 2 18:22 terraform
null_resource.local: Creation complete after 0s [id=5640751921027004]
null_resource.terraform (local-exec): Terraform v0.12.17
null_resource.terraform (local-exec): + provider.null v2.1.2
null_resource.terraform: Creation complete after 0s [id=4221322174220797915]
null_resource.awscli (local-exec): aws-cli/1.16.297 Python/3.6.9 Linux/4.9.184-linuxkit botocore/1.13.33
null_resource.awscli: Creation complete after 1s [id=2010243430287978504]
$ terraform apply -auto-approve
null_resource.local: Refreshing state... [id=5640751921027004]
null_resource.which: Refreshing state... [id=601591571951164112]
null_resource.whamoi: Refreshing state... [id=9020657420734241538]
null_resource.terraform: Refreshing state... [id=4221322174220797915]
null_resource.awscli: Refreshing state... [id=2010243430287978504]
null_resource.which: Destroying... [id=601591571951164112]
null_resource.terraform: Destroying... [id=4221322174220797915]
null_resource.whamoi: Destroying... [id=9020657420734241538]
null_resource.local: Destroying... [id=5640751921027004]
null_resource.awscli: Destroying... [id=2010243430287978504]
null_resource.terraform: Destruction complete after 0s
null_resource.which: Destruction complete after 0s
null_resource.whamoi: Destruction complete after 0s
null_resource.local: Destruction complete after 0s
null_resource.awscli: Destruction complete after 0s
null_resource.terraform: Creating...
null_resource.which: Creating...
null_resource.whamoi: Creating...
null_resource.which: Provisioning with 'local-exec'...
null_resource.whamoi: Provisioning with 'local-exec'...
null_resource.which (local-exec): Executing: ["/bin/sh" "-c" "which aws && which terraform"]
null_resource.awscli: Creating...
null_resource.terraform: Provisioning with 'local-exec'...
null_resource.whamoi (local-exec): Executing: ["/bin/sh" "-c" "whoami"]
null_resource.awscli: Provisioning with 'local-exec'...
null_resource.local: Creating...
null_resource.local: Provisioning with 'local-exec'...
null_resource.terraform (local-exec): Executing: ["/bin/sh" "-c" "terraform version"]
null_resource.which (local-exec): /usr/local/bin/aws
null_resource.which (local-exec): /usr/local/bin/terraform
null_resource.awscli (local-exec): Executing: ["/bin/sh" "-c" "aws --version"]
null_resource.which: Creation complete after 0s [id=4642497063139000284]
null_resource.local (local-exec): Executing: ["/bin/sh" "-c" "ls -al /usr/local/bin"]
null_resource.whamoi (local-exec): rosemary
null_resource.whamoi: Creation complete after 0s [id=102790834406723109]
null_resource.local (local-exec): total 50112
null_resource.local (local-exec): drwxr-xr-x 1 root root 4096 Dec 5 04:29 .
null_resource.local (local-exec): drwxr-xr-x 1 root root 4096 Oct 29 21:25 ..
null_resource.local (local-exec): drwxr-xr-x 2 root root 4096 Dec 5 04:28 __pycache__
null_resource.local (local-exec): -rwxr-xr-x 1 root root 815 Dec 5 04:28 aws
null_resource.local (local-exec): -rwxr-xr-x 1 root root 1432 Dec 5 04:28 aws.cmd
null_resource.local (local-exec): -rwxr-xr-x 1 root root 204 Dec 5 04:28 aws_bash_completer
null_resource.local (local-exec): -rwxr-xr-x 1 root root 1136 Dec 5 04:28 aws_completer
null_resource.local (local-exec): -rwxr-xr-x 1 root root 1807 Dec 5 04:28 aws_zsh_completer.sh
null_resource.local (local-exec): -rwxr-xr-x 1 root root 234 Dec 5 04:26 easy_install
null_resource.local (local-exec): -rwxr-xr-x 1 root root 234 Dec 5 04:26 easy_install-3.6
null_resource.local (local-exec): -rwxr-xr-x 1 root root 1675 Dec 5 04:28 jp.py
null_resource.local (local-exec): -rwxr-xr-x 1 root root 221 Dec 5 04:26 pip
null_resource.local (local-exec): -rwxr-xr-x 1 root root 221 Dec 5 04:26 pip3
null_resource.local (local-exec): -rwxr-xr-x 1 root root 221 Dec 5 04:26 pip3.6
null_resource.local (local-exec): -rwxr-xr-x 1 root root 212 Dec 5 04:28 pyrsa-decrypt
null_resource.local (local-exec): -rwxr-xr-x 1 root root 228 Dec 5 04:28 pyrsa-decrypt-bigfile
null_resource.local (local-exec): -rwxr-xr-x 1 root root 212 Dec 5 04:28 pyrsa-encrypt
null_resource.local (local-exec): -rwxr-xr-x 1 root root 228 Dec 5 04:28 pyrsa-encrypt-bigfile
null_resource.local (local-exec): -rwxr-xr-x 1 root root 210 Dec 5 04:28 pyrsa-keygen
null_resource.local (local-exec): -rwxr-xr-x 1 root root 233 Dec 5 04:28 pyrsa-priv2pub
null_resource.local (local-exec): -rwxr-xr-x 1 root root 206 Dec 5 04:28 pyrsa-sign
null_resource.local (local-exec): -rwxr-xr-x 1 root root 210 Dec 5 04:28 pyrsa-verify
null_resource.local (local-exec): lrwxrwxrwx 1 root root 16 Dec 5 04:26 python -> /usr/bin/python3
null_resource.local (local-exec): -rwxr-xr-x 1 root root 594 Dec 5 04:28 rst2html.py
null_resource.local (local-exec): -rwxr-xr-x 1 root root 714 Dec 5 04:28 rst2html4.py
null_resource.local (local-exec): -rwxr-xr-x 1 root root 1140 Dec 5 04:28 rst2html5.py
null_resource.local (local-exec): -rwxr-xr-x 1 root root 791 Dec 5 04:28 rst2latex.py
null_resource.local (local-exec): -rwxr-xr-x 1 root root 600 Dec 5 04:28 rst2man.py
null_resource.local (local-exec): -rwxr-xr-x 1 root root 764 Dec 5 04:28 rst2odt.py
null_resource.local (local-exec): -rwxr-xr-x 1 root root 1698 Dec 5 04:28 rst2odt_prepstyles.py
null_resource.local (local-exec): -rwxr-xr-x 1 root root 601 Dec 5 04:28 rst2pseudoxml.py
null_resource.local (local-exec): -rwxr-xr-x 1 root root 637 Dec 5 04:28 rst2s5.py
null_resource.local (local-exec): -rwxr-xr-x 1 root root 871 Dec 5 04:28 rst2xetex.py
null_resource.local (local-exec): -rwxr-xr-x 1 root root 602 Dec 5 04:28 rst2xml.py
null_resource.local (local-exec): -rwxr-xr-x 1 root root 670 Dec 5 04:28 rstpep2html.py
null_resource.local (local-exec): -rwxr-xr-x 1 root root 51175008 Dec 2 18:22 terraform
null_resource.local: Creation complete after 0s [id=6346737726398046181]
null_resource.terraform (local-exec): Terraform v0.12.17
null_resource.terraform (local-exec): + provider.null v2.1.2
null_resource.terraform: Creation complete after 0s [id=155237988034234727]
null_resource.awscli (local-exec): aws-cli/1.16.297 Python/3.6.9 Linux/4.9.184-linuxkit botocore/1.13.33
null_resource.awscli: Creation complete after 0s [id=8227985786253309981]
Apply complete! Resources: 5 added, 0 changed, 5 destroyed.
resource "null_resource" "whamoi" {
triggers = {
build_number = timestamp()
}
provisioner "local-exec" {
command = "whoami"
}
}
resource "null_resource" "which" {
triggers = {
build_number = timestamp()
}
provisioner "local-exec" {
command = "which aws && which terraform"
}
}
resource "null_resource" "awscli" {
triggers = {
build_number = timestamp()
}
provisioner "local-exec" {
command = "aws --version"
}
}
resource "null_resource" "terraform" {
triggers = {
build_number = timestamp()
}
provisioner "local-exec" {
command = "terraform version"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment