Skip to content

Docker image based on alpine that includes terraform and kubectl packages.

License

Notifications You must be signed in to change notification settings

FlorianValery/terraform-kubectl

Repository files navigation

Terraform & Kubectl

Terraform and kubectl inside Docker to integrate within your Kubernetes CI/CD pipeline.
The AWS CLI is also included for remote S3 backend.

Image Size Image Size

Usage

Get the image

docker pull floval/terraform-kubectl:latest

Pull a specific image

docker pull floval/terraform-kubectl:[TAG]

Loading your Kube config

docker run --rm --name terraform-kubectl -v /path/to/kube/config/file:/root/.kube/config floval/terraform-kubectl:latest

Loading your AWS credentials

docker run --rm --name terraform-kubectl -e AWS_ACCESS_KEY={your_aws_key} -e AWS_SECRET_ACCESS_KEY={your_aws_secret_key} floval/terraform-kubectl:latest

Gitlab job example

To avoid mounting a host file, you can grab your Kubernetes and AWS config as CI/CD variables.

terraform plan:
  stage: plan
  image: floval/terraform-kubectl:latest
  script:
    - echo $KUBE_CONFIG > /root/.kube/config
    - terraform init && terraform plan
  tags:
    - latest

Drone job example

To avoid mounting a host file, you can grab your Kubernetes and AWS config as Drone Secrets.

- name: terraform plan
  image: floval/terraform-kubectl:latest
  commands:
    - echo $KUBE_CONFIG > /root/.kube/config
    - terraform init && terraform plan
  environment:
    KUBE_CONFIG:
        from_secret: KUBE_CONFIG
    AWS_ACCESS_KEY:
        from_secret: AWS_ACCESS_KEY
    AWS_SECRET_ACCESS_KEY:
        from_secret: AWS_SECRET_ACCESS_KEY
  tags:
    - latest

Supported tags and respective Dockerfile links

Only Terraform v0.13 and kubectl 1.19 onward are supported.

Terraform 1.0

Terraform 0.15

Terraform 0.14

Terraform 0.13

Contributing

If the version that you need is missing, please create a Pull Request.

Maintainer

Maintained by Florian Valéry

About

Docker image based on alpine that includes terraform and kubectl packages.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published