├── .gitignore ├── test ├── test-terragrunt │ ├── terragrunt.hcl │ └── main.tf ├── test-terraform │ └── hello.tf ├── .gitignore └── test.sh ├── .github ├── FUNDING.yml └── workflows │ ├── keepalive.yml │ └── build.yml ├── eks ├── Dockerfile.template └── build.sh ├── Dockerfile ├── .circleci └── config.yml ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | eks/Dockerfile 2 | -------------------------------------------------------------------------------- /test/test-terragrunt/terragrunt.hcl: -------------------------------------------------------------------------------- 1 | # terragrunt.hcl 2 | terraform { 3 | source = "." 4 | } 5 | 6 | -------------------------------------------------------------------------------- /test/test-terraform/hello.tf: -------------------------------------------------------------------------------- 1 | resource "null_resource" "default" { 2 | provisioner "local-exec" { 3 | command = "echo 'Hello World'" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/.gitignore: -------------------------------------------------------------------------------- 1 | .*.sw? 2 | .idea 3 | terragrunt.iml 4 | vendor 5 | .terraform 6 | .vscode 7 | *.tfstate 8 | *.tfstate.backup 9 | *.out 10 | .terragrunt-cache 11 | .bundle 12 | .ruby-version 13 | .terraform.lock.hcl 14 | terragrunt 15 | .DS_Store 16 | mocks/ 17 | # added 18 | result 19 | -------------------------------------------------------------------------------- /test/test-terragrunt/main.tf: -------------------------------------------------------------------------------- 1 | # main.tf 2 | provider "local" { 3 | version = "~> 2.0" 4 | } 5 | 6 | resource "local_file" "hello_world" { 7 | content = "Hello, World!" 8 | filename = "${path.module}/hello_world.txt" 9 | } 10 | 11 | output "hello_message" { 12 | value = "Hello, World!" 13 | } 14 | -------------------------------------------------------------------------------- /test/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | docker run -ti --rm -v $(pwd)/test/test-terragrunt:/apps -w /apps alpine/terragrunt bash -c "terragrunt --version > result && terragrunt init && terragrunt apply -auto-approve && echo $? >> result" 4 | echo $? 5 | echo "==== test result ====" 6 | cat test/test-terragrunt/result 7 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.github/workflows/keepalive.yml: -------------------------------------------------------------------------------- 1 | name: Keep Repo Active 2 | 3 | on: 4 | schedule: 5 | - cron: '0 0 */30 * *' # Every 30 days 6 | workflow_dispatch: 7 | 8 | jobs: 9 | keepalive: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Checkout `keepalive` branch 13 | uses: actions/checkout@v4 14 | with: 15 | ref: keepalive # Checkout that specific branch 16 | 17 | - name: Make a dummy change 18 | run: | 19 | echo "Last updated at $(date -u)" > keepalive.txt 20 | 21 | - name: Commit and push 22 | run: | 23 | git config user.name "github-actions[bot]" 24 | git config user.email "github-actions[bot]@users.noreply.github.com" 25 | git add keepalive.txt 26 | git commit -m "chore: keep repo active" || echo "No changes to commit" 27 | git push origin keepalive 28 | env: 29 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 30 | -------------------------------------------------------------------------------- /eks/Dockerfile.template: -------------------------------------------------------------------------------- 1 | FROM hashicorp/terraform:VERSION 2 | 3 | ARG TERRAGRUNT 4 | 5 | RUN apk add --update --no-cache bash git openssh 6 | 7 | ADD https://github.com/gruntwork-io/terragrunt/releases/download/${TERRAGRUNT}/terragrunt_linux_amd64 /usr/local/bin/terragrunt 8 | 9 | RUN chmod +x /usr/local/bin/terragrunt 10 | 11 | # Add kubectl, aws_iam_auth for eks deployment 12 | ARG KUBECTL=1.14.7 13 | ARG AWS_IAM_AUTH=0.5.3 14 | ARG EKSCTL=0.89.0 15 | 16 | # Install kubectl (same version of aws esk) 17 | RUN apk add --update --no-cache curl && \ 18 | curl -LO https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL}/bin/linux/amd64/kubectl && \ 19 | mv kubectl /usr/bin/kubectl && \ 20 | chmod +x /usr/bin/kubectl 21 | 22 | # Install aws-iam-authenticator (latest version) 23 | RUN curl -LO https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v${AWS_IAM_AUTH}/aws-iam-authenticator_${AWS_IAM_AUTH}_linux_amd64 && \ 24 | mv aws-iam-authenticator_${AWS_IAM_AUTH}_linux_amd64 /usr/bin/aws-iam-authenticator && \ 25 | chmod +x /usr/bin/aws-iam-authenticator 26 | 27 | # Install eksctl (latest version) 28 | RUN curl --silent --location "https://github.com/weaveworks/eksctl/releases/download/v${EKSCTL}/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp && \ 29 | mv /tmp/eksctl /usr/bin && \ 30 | chmod +x /usr/bin/eksctl 31 | 32 | WORKDIR /apps 33 | 34 | ENTRYPOINT [] 35 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ARG TERRAFORM 2 | #ARG OPENTOFU 3 | 4 | FROM quay.io/terraform-docs/terraform-docs:latest as docs 5 | #FROM ghcr.io/opentofu/opentofu:${OPENTOFU} as tofu 6 | FROM hashicorp/terraform:${TERRAFORM} 7 | 8 | ARG TERRAGRUNT 9 | ARG BOILERPLATE 10 | 11 | RUN apk add --update --no-cache bash git openssh 12 | 13 | COPY --from=docs /usr/local/bin/terraform-docs /usr/local/bin/terraform-docs 14 | #COPY --from=tofu /usr/local/bin/tofu /usr/local/bin/tofu 15 | 16 | # Determine the target architecture using uname -m 17 | RUN case `uname -m` in \ 18 | x86_64) ARCH=amd64; ;; \ 19 | armv7l) ARCH=arm; ;; \ 20 | aarch64) ARCH=arm64; ;; \ 21 | ppc64le) ARCH=ppc64le; ;; \ 22 | s390x) ARCH=s390x; ;; \ 23 | *) echo "un-supported arch, exit ..."; exit 1; ;; \ 24 | esac && \ 25 | echo "export ARCH=$ARCH" > /envfile && \ 26 | cat /envfile 27 | 28 | # install terragrunt 29 | RUN . /envfile && echo $ARCH && \ 30 | TERRAGRUNT_URL="https://github.com/gruntwork-io/terragrunt/releases/download/v${TERRAGRUNT}/terragrunt_linux_${ARCH}" && \ 31 | wget -q "${TERRAGRUNT_URL}" -O /usr/local/bin/terragrunt && \ 32 | chmod +x /usr/local/bin/terragrunt 33 | 34 | # install boilerplate 35 | RUN . /envfile && echo $ARCH && \ 36 | BOILERPLATE_URL="https://github.com/gruntwork-io/boilerplate/releases/download/v${BOILERPLATE}/boilerplate_linux_${ARCH}" && \ 37 | wget -q "${BOILERPLATE_URL}" -O /usr/local/bin/boilerplate && \ 38 | chmod +x /usr/local/bin/boilerplate 39 | 40 | WORKDIR /apps 41 | 42 | ENTRYPOINT [] 43 | 44 | -------------------------------------------------------------------------------- /eks/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Prerequisite 4 | # Make sure you set secret enviroment variables in Travis CI 5 | # DOCKER_USERNAME 6 | # DOCKER_PASSWORD 7 | # API_TOKEN 8 | 9 | set -ex 10 | 11 | image="alpine/terragrunt" 12 | repo="hashicorp/terraform" 13 | 14 | if [[ ${CI} == 'true' ]]; then 15 | CURL="curl -sL -H \"Authorization: token ${API_TOKEN}\"" 16 | else 17 | CURL="curl -sL" 18 | fi 19 | 20 | latest=$(${CURL} https://api.github.com/repos/${repo}/releases/latest |jq -r .tag_name|sed 's/v//') 21 | eks="${latest}-eks" 22 | 23 | terragrunt=$(${CURL} https://api.github.com/repos/gruntwork-io/terragrunt/releases/latest |jq -r .tag_name) 24 | 25 | sum=0 26 | echo "Lastest terraform release is: ${latest}" 27 | 28 | tags=`curl -s https://hub.docker.com/v2/repositories/${image}/tags/ |jq -r .results[].name` 29 | 30 | for tag in ${tags} 31 | do 32 | if [ ${tag} == ${eks} ];then 33 | sum=$((sum+1)) 34 | fi 35 | done 36 | 37 | # get available Amazon EKS Kubernetes versions, only pick up the top version 38 | # https://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html 39 | KUBECTL=$(curl -s https://raw.githubusercontent.com/awsdocs/amazon-eks-user-guide/master/doc_source/kubernetes-versions.md |egrep -A 10 "The following Kubernetes versions"|grep ^+ |awk '{gsub("\\\\", ""); print $NF}' |sort -Vr|head -1) 40 | 41 | # get latest eksctl 42 | EKSCTL=$(curl -s https://api.github.com/repos/weaveworks/eksctl/releases | jq -r '.[].tag_name' |grep -v "\-rc" | sed 's/v//' | sort -rV | head -n 1) 43 | 44 | if [[ ( $sum -ne 1 ) || ( ${REBUILD} == "true" ) ]];then 45 | sed "s/VERSION/${latest}/" Dockerfile.template > Dockerfile 46 | docker build --build-arg TERRAGRUNT=${terragrunt} --build-arg KUBECTL=${KUBECTL} --build-arg EKSCTL=${EKSCTL} --no-cache -t ${image}:${eks} . 47 | 48 | # if [[ "$TRAVIS_BRANCH" == "eks" ]]; then 49 | docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD 50 | docker push ${image}:${eks} 51 | # fi 52 | 53 | fi 54 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | 3 | # Prerequisite 4 | # Make sure you set secret enviroment variables in CICD 5 | # DOCKER_USERNAME 6 | # DOCKER_PASSWORD 7 | # API_TOKEN 8 | 9 | # REBUILD - it has default value "false", if need rebuild the image, turn it on with value "true" 10 | 11 | parameters: 12 | rebuild: 13 | type: string 14 | default: "false" 15 | 16 | jobs: 17 | build: 18 | docker: 19 | - image: alpine/docker-with-buildx 20 | environment: 21 | REBUILD: << pipeline.parameters.rebuild >> 22 | steps: 23 | - checkout 24 | - setup_remote_docker: 25 | docker_layer_caching: true 26 | - run: | 27 | apk --no-cache --update add bash curl sudo jq 28 | # support GNU date 29 | apk add --update --no-cache coreutils 30 | echo $REBUILD 31 | bash ./build.sh 32 | 33 | scan: 34 | docker: 35 | - image: alpine/trivy 36 | steps: 37 | - checkout 38 | - run: | 39 | trivy image --format table --exit-code 1 \ 40 | --ignore-unfixed --vuln-type os,library \ 41 | --scanners vuln --severity CRITICAL,HIGH \ 42 | --timeout 10m0s alpine/terragrunt \ 43 | --db-repository public.ecr.aws/aquasecurity/trivy-db 44 | 45 | workflows: 46 | build: 47 | jobs: 48 | - build: 49 | name: build 50 | context: 51 | - Docker-Hub 52 | filters: 53 | branches: 54 | only: 55 | - master 56 | - main 57 | 58 | - scan: 59 | requires: 60 | - build 61 | name: scan 62 | context: 63 | - Docker-Hub 64 | filters: 65 | branches: 66 | only: 67 | - master 68 | - main 69 | 70 | nightly: 71 | triggers: 72 | - schedule: 73 | cron: "0 4 * * 0" 74 | filters: 75 | branches: 76 | only: 77 | - master 78 | - main 79 | jobs: 80 | - build: 81 | name: build 82 | context: 83 | - Docker-Hub 84 | filters: 85 | branches: 86 | only: 87 | - master 88 | - main 89 | - scan: 90 | requires: 91 | - build 92 | name: scan 93 | context: 94 | - Docker-Hub 95 | filters: 96 | branches: 97 | only: 98 | - master 99 | - main 100 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # enhanced tool to manage terraform deployment with terragrunt 2 | 3 | [If enjoy, please consider buying me a coffee.](https://www.buymeacoffee.com/ozbillwang) 4 | 5 | Auto-trigger docker build for [terragrunt](https://github.com/gruntwork-io/terragrunt) when new terraform version is related. 6 | 7 | [![DockerHub Badge](http://dockeri.co/image/alpine/terragrunt)](https://hub.docker.com/r/alpine/terragrunt/) 8 | 9 | ### Notes 10 | 11 | * Never use tag `latest` in prod environment. 12 | * Multi-Arch supported (linux/amd64, linux/arm64) 13 | * For examples, below tags are supported now: 14 | - alpine/terragrunt:latest 15 | - alpine/terragrunt:1.8.4 (terraform version) 16 | - alpine/terragrunt:tf1.8.4 (terraform version) 17 | - (TODO, not ready yet) alpine/terragrunt:otf1.7.1 (opentofu version) 18 | 19 | ### Tools included in this container 20 | 21 | * [terraform](https://terraform.io) - terraform version is this docker image's tag 22 | * [terragrunt](https://github.com/gruntwork-io/terragrunt) - The latest terragrunt version when running the build. 23 | * [boilerplate](https://github.com/gruntwork-io/boilerplate) - The latest boilerplate version when running the build. 24 | * [terraform-docs](https://github.com/terraform-docs/terraform-docs) - The latest terraform-docs version when running the build. 25 | * (TODO, not ready yet) [OpenTofu](https://opentofu.org/docs/intro/install/) - the latest opentofu version when running the build 26 | 27 | ### Repo: 28 | 29 | https://github.com/alpine-docker/terragrunt 30 | 31 | ### Daily build logs: 32 | 33 | https://github.com/alpine-docker/terragrunt/actions 34 | 35 | ### Docker image tags: 36 | 37 | https://hub.docker.com/r/alpine/terragrunt/tags/ 38 | 39 | ### Multiple platforms supported 40 | 41 | * linux/arm64 42 | * linux/amd64 43 | 44 | # Why we need it 45 | 46 | This is mostly used during Continuous Integration and Continuous Delivery (CI/CD), or as a component of an automated build and deployment process. 47 | 48 | # Usage: 49 | 50 | # (1) must mount the local folder to /apps in container. 51 | # (2) must mount the aws credentials and ssh config folder in container. 52 | $ docker run -ti --rm -v $HOME/.aws:/root/.aws -v ${HOME}/.ssh:/root/.ssh -v `pwd`:/apps alpine/terragrunt:0.12.16 bash 53 | # 54 | # common terraform steps 55 | $ terraform init 56 | $ terraform fmt 57 | $ terraform validate 58 | $ terraform plan 59 | $ terraform apply 60 | 61 | # common opentofu steps 62 | $ tofu init 63 | $ tofu fmt 64 | $ tofu validate 65 | $ tofu plan 66 | $ tofu apply 67 | 68 | # common terragrunt steps 69 | # cd to terragrunt configuration directory, if required. 70 | # Terraform and OpenTofu Version Compatibility Table 71 | # https://terragrunt.gruntwork.io/docs/getting-started/supported-versions/ 72 | $ terragrunt hclfmt 73 | $ terragrunt run-all plan 74 | $ terragrunt run-all apply 75 | 76 | # The Processes to build this image 77 | 78 | * Enable CI cronjob on this repo to run build weekly on master branch 79 | * Check if there are new versions announced via Terraform Github REST API 80 | * Match the exist docker image tags via Hub.docker.io REST API 81 | * If not matched, build the image with latest `terraform version` as tag and push to hub.docker.com 82 | * Always install latest version of terragrunt -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Docker 2 | 3 | on: 4 | push: 5 | tags: ["*"] 6 | branches: 7 | - "main" 8 | - "master" 9 | schedule: 10 | - cron: '0 5 * * 0' 11 | pull_request: 12 | branches: ["**"] 13 | 14 | env: 15 | # Hostname of your registry 16 | REGISTRY: docker.io 17 | # Image repository, without hostname and tag 18 | IMAGE_NAME: alpine/terragrunt 19 | SHA: ${{ github.event.pull_request.head.sha || github.event.after }} 20 | 21 | jobs: 22 | build: 23 | runs-on: ubuntu-latest 24 | permissions: 25 | pull-requests: write 26 | steps: 27 | - name: Setup Docker buildx 28 | uses: docker/setup-buildx-action@v3 29 | 30 | # Step to fetch the latest curl version 31 | - name: Get latest tool versions 32 | id: curl-version 33 | run: | 34 | # export CURL_OPTIONS="-sL -H \"Authorization: token ${{ secrets.API_KEY }}\"" 35 | 36 | curl -H "Cache-Control: no-cache" -sL "https://raw.githubusercontent.com/alpine-docker/multi-arch-docker-images/stable/functions.sh" -o functions.sh 37 | # curl -H "Cache-Control: no-cache" -sL "https://raw.githubusercontent.com/alpine-docker/multi-arch-docker-images/refs/heads/master/functions.sh" -o functions.sh 38 | source functions.sh 39 | 40 | # get latest version 41 | terraform_repo="hashicorp/terraform" 42 | terragrunt_repo="gruntwork-io/terragrunt" 43 | boilerplate_repo="gruntwork-io/boilerplate" 44 | latest_terraform=$(get_latest_release "${terraform_repo}") 45 | latest_terragrunt=$(get_latest_release "${terragrunt_repo}") 46 | latest_boilerplate=$(get_latest_release "${boilerplate_repo}") 47 | echo "Latest terraform release is: ${latest_terraform}" 48 | echo "Latest terragrunt release is: ${latest_terragrunt}" 49 | echo "Latest boilerplate release is: ${latest_boilerplate}" 50 | echo "TERRAFORM=${latest_terraform}" >> $GITHUB_ENV 51 | echo "TERRAGRUNT=${latest_terragrunt}" >> $GITHUB_ENV 52 | echo "BOILERPLATE=${latest_boilerplate}" >> $GITHUB_ENV 53 | 54 | # Authenticate to the container registry 55 | - name: Authenticate to registry ${{ env.REGISTRY }} 56 | uses: docker/login-action@v3 57 | with: 58 | registry: ${{ env.REGISTRY }} 59 | username: ${{ secrets.DOCKERHUB_USERNAME }} 60 | password: ${{ secrets.DOCKERHUB_TOKEN }} 61 | 62 | # Extract metadata (tags, labels) for Docker 63 | - name: Extract Docker metadata 64 | id: meta 65 | uses: docker/metadata-action@v5 66 | with: 67 | images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} 68 | labels: | 69 | org.opencontainers.image.revision=${{ env.SHA }} 70 | tags: | 71 | type=edge,branch=$repo.default_branch 72 | type=semver,pattern=v{{version}} 73 | type=sha,prefix=,suffix=,format=short 74 | 75 | # Build and push Docker image with Buildx 76 | # (don't push on PR, load instead) 77 | - name: Build and push Docker image 78 | id: build-and-push 79 | uses: docker/build-push-action@v6 80 | with: 81 | platforms: linux/amd64,linux/arm64 82 | sbom: ${{ github.event_name != 'pull_request' }} 83 | provenance: ${{ github.event_name != 'pull_request' }} 84 | push: ${{ github.event_name != 'pull_request' }} 85 | load: ${{ github.event_name == 'pull_request' }} 86 | tags: ${{ steps.meta.outputs.tags }} 87 | labels: ${{ steps.meta.outputs.labels }} 88 | cache-from: type=gha 89 | cache-to: type=gha,mode=max 90 | build-args: | 91 | TERRAFORM=${{ env.TERRAFORM }} 92 | TERRAGRUNT=${{ env.TERRAGRUNT }} 93 | BOILERPLATE=${{ env.BOILERPLATE }} 94 | 95 | # - name: Checkout code 96 | # uses: actions/checkout@v2 97 | 98 | # - name: check the platform in multi-arch images 99 | # run: | 100 | # echo ${{ steps.meta.outputs.tags }} 101 | # bash ./test.sh ${{ steps.meta.outputs.tags }} 102 | 103 | - name: set tags 104 | run: | 105 | # install crane 106 | curl -LO https://github.com/google/go-containerregistry/releases/download/v0.20.2/go-containerregistry_Linux_x86_64.tar.gz 107 | tar zxvf go-containerregistry_Linux_x86_64.tar.gz 108 | chmod +x crane 109 | 110 | export VERSION=($(docker run -i --rm ${{ steps.meta.outputs.tags }} curl --version|awk '$1=$1' |awk -F "[ -]" 'NR==1{print $2}')) 111 | echo $VERSION 112 | ./crane auth login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} index.docker.io 113 | ./crane copy ${{ steps.meta.outputs.tags }} ${{ env.IMAGE_NAME }}:latest 114 | ./crane copy ${{ steps.meta.outputs.tags }} ${{ env.IMAGE_NAME }}:${{ env.TERRAFORM }} 115 | ./crane copy ${{ steps.meta.outputs.tags }} ${{ env.IMAGE_NAME }}:tf${{ env.TERRAFORM }} 116 | rm -f /home/runner/.docker/config.json 117 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------