Skip to content

pli01/docker-outscale-cli

Repository files navigation

docker-outscale-cli

Docker build and publish

This repository contains a toolbox to operate resources on Outscale cloud. It can be used in CI/CD workflows

Here is tools to build and run a docker image outscale-cli, based on debian:buster including following tools:

  • osc-cli
  • osc-sdk-python
  • aws
  • boto, boto3
  • s3cmd
  • terraform
  • ansible
  • packer
  • others tools

Docker image is build automatically and available on ghcr.io

And it can also be build locally and run with docker-compose

Struture directory:

- dot-env.sample
- Dockerfile
- docker-compose: build/run image. ./aws, ./osc and current dir are available in the container

- aws/ : .aws config, endpoints and alias, based on `AWS_` variables
  - config
  - models/endpoints.json
  - cli/alias

- osc/
  - osc-cli-wrapper.sh: wrapper which can generate .osc/config.json based on config.json.template based on `OSC_` variables
  - ./config.json.template

- terraform/: sample tf files to build a small vpc, based on `OUTSCALE_` variables

Build

Use docker-compose to build image

docker-compose build

To override default binaries version, set env variables and build

DOCKER_OUTSCALE_CLI_VERSION=$DOCKER_OUTSCALE_CLI_VERSION

ANSIBLE_VERSION=$ANSIBLE_VERSION
AWS_CLI_VERSION=$AWS_CLI_VERSION
S3CMD_VERSION=$S3CMD_VERSION
OSC_CLI_VERSION=$OSC_CLI_VERSION
TERRAFORM_VERSION=$TERRAFORM_VERSION

Run

Use docker-compose to use tools in container

PreReq:

  • Prepare your env variable, copy dot-env.sample in .env and Change it!
  • use tools with docker-compose
# copy dot-env.sample .env
# prepare .env with credentials
source .env

# use osc-cli
docker-compose run -i --rm cli ./osc/osc-cli-wrapper.sh --help

# use aws
docker-compose run -i --rm cli aws help 

# open a shell in container
docker-compose run -i --rm cli /bin/bash

aws cli

export AWS_ACCESS_KEY_ID=_CHANGE_KEY_
export AWS_SECRET_ACCESS_KEY=_CHANGE_SECRET_
export AWS_DEFAULT_REGION=_CHANGER_REGION_
docker-compose run -i --rm cli aws ec2 describe-instances

docker-compose run -i --rm cli aws ls-vm

osc-cli

export OSC_ACCESS_KEY="$AWS_ACCESS_KEY_ID"
export OSC_SECRET_KEY="$AWS_SECRET_ACCESS_KEY"
export OSC_REGION="$AWS_DEFAULT_REGION"
docker-compose run -i --rm cli ./osc/osc-cli-wrapper.sh api ReadUsers

terraform

export OUTSCALE_ACCESSKEYID="$AWS_ACCESS_KEY_ID"
export OUTSCALE_SECRETKEYID="$AWS_SECRET_ACCESS_KEY"
export OUTSCALE_REGION="$AWS_DEFAULT_REGION"
# provider.tf
terraform {
  required_providers {
    outscale = {
      source  = "outscale/outscale"
    }
    cloudinit = {
      source  = "hashicorp/cloudinit"
    }
  }
}

provider "outscale" {
  # Configuration options
  # use env variables from
  #   OUTSCALE_ACCESSKEYID
  #   OUTSCALE_SECRETKEYID
  #   OUTSCALE_REGION
}

Doc reference

Outscale documentation:

About

docker-outscale-cli

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages