From 09a5a1ccd4529a03fbb938f2cfd295932b74e0e3 Mon Sep 17 00:00:00 2001 From: Manuel Vogel Date: Thu, 24 Dec 2020 09:00:20 +0100 Subject: [PATCH 1/5] chore: adds separate bug and ft req templates --- .github/ISSUE_TEMPLATE.md | 43 ----------- .github/ISSUE_TEMPLATE/Bug_Report.md | 87 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/Feature_Request.md | 48 +++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 11 +++ 4 files changed, 146 insertions(+), 43 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/ISSUE_TEMPLATE/Bug_Report.md create mode 100644 .github/ISSUE_TEMPLATE/Feature_Request.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 8066d392..00000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,43 +0,0 @@ -Hi there, - -Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html. - -### Terraform Version -Run `terraform -v` to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed. - -### Affected Resource(s) -Please list the resources as a list, for example: -- opc_instance -- opc_storage_volume - -If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this. - -### Terraform Configuration Files -```hcl -# Copy-paste your Terraform configurations here - for large Terraform configs, -# please use a service like Dropbox and share a link to the ZIP file. For -# security, you can also encrypt the files using our GPG public key. -``` - -### Debug Output -Please provider a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist. - -### Panic Output -If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the `crash.log`. - -### Expected Behavior -What should have happened? - -### Actual Behavior -What actually happened? - -### Steps to Reproduce -Please list the steps required to reproduce the issue, for example: -1. `terraform apply` - -### Important Factoids -Are there anything atypical about your accounts that we should know? For example: Running in EC2 Classic? Custom version of OpenStack? Tight ACLs? - -### References -Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example: -- GH-1234 diff --git a/.github/ISSUE_TEMPLATE/Bug_Report.md b/.github/ISSUE_TEMPLATE/Bug_Report.md new file mode 100644 index 00000000..ce0143e3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Bug_Report.md @@ -0,0 +1,87 @@ +--- +name: 🐛 Bug Report +about: If something isn't working as expected 🤔. + +--- + + + + + +### Community Note + +* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request +* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request +* If you are interested in working on this issue or have submitted a pull request, please leave a comment + + + +### Terraform (and docker Provider) Version + + + +### Affected Resource(s) + + + +* `docker_XXXXX` + +### Terraform Configuration Files + + + +```hcl +# Copy-paste your Terraform configurations here - for large Terraform configs, +# please use a service like Dropbox and share a link to the ZIP file. For +# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp +``` + +### Debug Output + + + +### Panic Output + + + +### Expected Behaviour + + + +### Actual Behaviour + + + +### Steps to Reproduce + + + +1. `terraform apply` + +### Important Factoids + + + +### References + + + +* #0000 diff --git a/.github/ISSUE_TEMPLATE/Feature_Request.md b/.github/ISSUE_TEMPLATE/Feature_Request.md new file mode 100644 index 00000000..a0e33779 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Feature_Request.md @@ -0,0 +1,48 @@ +--- +name: 🚀 Feature Request +about: I have a suggestion (and might want to implement myself 🙂)! +title: Support for [thing] + +--- + + + +### Community Note + +* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request +* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request +* If you are interested in working on this issue or have submitted a pull request, please leave a comment + + + +### Description + + + +### New or Affected Resource(s) + + + +* docker_XXXXX + +### Potential Terraform Configuration + + + +```hcl +# Copy-paste your Terraform configurations here - for large Terraform configs, +# please use a service like Dropbox and share a link to the ZIP file. For +# security, you can also encrypt the files using our GPG public key. +``` + +### References + + + +* #0000 diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..ae6f84e9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,11 @@ +blank_issues_enabled: false +contact_links: + - name: Terraform Docker Provider Questions + url: https://gophers.slack.com/archives/C01G9TN5V36 + about: GitHub issues in this repository are only intended for bug reports and feature requests. Other issues will be closed. Please ask and answer questions through the Terraform Azure Provider Community Forum. + - name: Terraform Core Bug Reports and Feature Requests + url: https://github.com/hashicorp/terraform/issues/new/choose + about: Terraform Core, which handles the Terraform configuration language, CLI commands, and resource dependency graph, has its own codebase. Bug reports and feature requests for those pieces of functionality should be directed to that repository. + - name: Terraform Language or Workflow Questions + url: https://discuss.hashicorp.com/c/terraform-core + about: Please ask and answer language or workflow related questions through the Terraform Core Community Forum. From da72cf9d01ef74dd6ab4017cd682a4671230e7f1 Mon Sep 17 00:00:00 2001 From: Manuel Vogel Date: Thu, 24 Dec 2020 09:02:51 +0100 Subject: [PATCH 2/5] fix: remove all azure cps --- .github/ISSUE_TEMPLATE/Bug_Report.md | 2 +- .github/ISSUE_TEMPLATE/config.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/Bug_Report.md b/.github/ISSUE_TEMPLATE/Bug_Report.md index ce0143e3..3772ffc4 100644 --- a/.github/ISSUE_TEMPLATE/Bug_Report.md +++ b/.github/ISSUE_TEMPLATE/Bug_Report.md @@ -74,7 +74,7 @@ To obtain the debug output, see the [Terraform documentation on debugging](https ### Important Factoids - + ### References diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index ae6f84e9..d5dacdca 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -2,7 +2,7 @@ blank_issues_enabled: false contact_links: - name: Terraform Docker Provider Questions url: https://gophers.slack.com/archives/C01G9TN5V36 - about: GitHub issues in this repository are only intended for bug reports and feature requests. Other issues will be closed. Please ask and answer questions through the Terraform Azure Provider Community Forum. + about: GitHub issues in this repository are only intended for bug reports and feature requests. Other issues will be closed. Please ask and answer questions through the Terraform Docker Provider Slack channel. - name: Terraform Core Bug Reports and Feature Requests url: https://github.com/hashicorp/terraform/issues/new/choose about: Terraform Core, which handles the Terraform configuration language, CLI commands, and resource dependency graph, has its own codebase. Bug reports and feature requests for those pieces of functionality should be directed to that repository. From cf611b417fa219fa74f6c8e1ad431856fab2f007 Mon Sep 17 00:00:00 2001 From: Manuel Vogel Date: Thu, 24 Dec 2020 16:26:29 +0100 Subject: [PATCH 3/5] chore: ignores testing folders --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 50950d6a..bdb89c22 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,7 @@ scripts/testing/certs # build outputs results + +# testing +testing +testing-mirror/registry.terraform.io/kreuzwerker/docker From 544fd2a6854e6437c6366882ca5d5e1e59646cc3 Mon Sep 17 00:00:00 2001 From: Manuel Vogel Date: Thu, 24 Dec 2020 16:27:35 +0100 Subject: [PATCH 4/5] docs: adds coc and contributing --- CODE_OF_CONDUCT.md | 74 +++++++++++++++++++++++++++ CONTRIBUTING.md | 125 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 199 insertions(+) create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..e9f6fc56 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +- The use of sexualized language or imagery and unwelcome sexual attention or + advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic + address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at root@carlosbecker.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..9e47f51c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,125 @@ +# Contributing + +By participating to this project, you agree to abide our [code of +conduct](/CODE_OF_CONDUCT.md). + +## Setup your machine + +`terraform-provider-docker` is written in [Go](https://golang.org/). + +Prerequisites: + +- `make`, `git`, `bash` +- [Go 1.15+](https://golang.org/doc/install) +- [Docker](https://www.docker.com/) +- [Terraform 0.12+](https://terraform.io/) + +Clone `terraform-provider-docker` anywhere: + +```sh +git clone git@github.com:kreuzwerker/terraform-provider-docker.git +``` + +Install the build dependencies: + +```sh +make build +``` + +## Test your change + +You can create a branch for your changes and try to build from the source as you go: + +```sh +make build +``` + +### Unit and acceptance tests +When you are satisfied with the changes, **tests**, and **documentation** updates, we suggest you run: + +```sh +# unit tests +make test + +# acceptance test +## setup the testing environment +make testacc_setup + +## run a single test +TF_LOG=INFO TF_ACC=1 go test -v ./docker -run ^TestAccDockerImage_data_private_config_file$ -timeout 360s + +## cleanup the local testing resources +make testacc_cleanup +``` + +### Test against current terraform IaC descriptions +In order to extend the provider and test it with `terraform`, build the provider as mentioned above with: + +```sh +# Testing in a local mirror which needs to have the following convention. +# See https://www.terraform.io/docs/commands/cli-config.html#provider-installation for details +export TESTING_MIRROR=testing-mirror/registry.terraform.io/kreuzwerker/docker/9.9.9/$(go env GOHOSTOS)_$(go env GOHOSTARCH) +mkdir -p ./$TESTING_MIRROR + +# now we build into the provider into the local mirror +go build -o ./$TESTING_MIRROR/terraform-provider-docker_v9.9.9 +``` + +Now we change into the `testing` directory (which is ignored as well) and set an explicit version of the provider we develop: +```hcl +terraform { + required_providers { + docker = { + source = "kreuzwerker/docker" + version = "9.9.9" + } + } +} + +provider "docker" { +} + +resource "docker_image" "foo" { + name = "nginx:latest" + keep_locally = true +} + +resource "docker_container" "foo" { + name = "foo" + image = docker_image.foo.latest +} +``` + +As the next step we can init terraform by provider a local plugin directory: +```sh +# Which reflects the convention mentioned before +# See https://www.terraform.io/docs/commands/init.html#plugin-installation +terraform init -plugin-dir=../testing-mirror +terraform plan +terraform apply -auto-approve +``` + +### Developing on Windows + +You can build and test on Windows without `make`. Run `go install` to +build and `Scripts\runAccTests.bat` to run the test suite. + +Continuous integration for Windows is not available at the moment due +to lack of a CI provider that is free for open source projects *and* +supports running Linux containers in Docker for Windows. For example, +AppVeyor is free for open source projects and provides Docker on its +Windows builds, but only offers Linux containers on Windows as a paid +upgrade. + +## Create a commit + +Commit messages should be well formatted, and to make that "standardized", we +are using Conventional Commits. + +You can follow the documentation on +[their website](https://www.conventionalcommits.org). + +## Submit a pull request + +Push your branch to your `terraform-provider-docker` fork and open a +pull request against the master branch. \ No newline at end of file From abd3133996b5667359d61ea0548b444bbf5b408b Mon Sep 17 00:00:00 2001 From: Manuel Vogel Date: Thu, 24 Dec 2020 16:27:42 +0100 Subject: [PATCH 5/5] docs: cleans readme --- README.md | 119 ++++++++++++++---------------------------------------- 1 file changed, 30 insertions(+), 89 deletions(-) diff --git a/README.md b/README.md index 10712a99..3a7313d6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -Terraform Provider -================== +# Terraform Provider - Website: https://www.terraform.io - [![Gitter chat](https://badges.gitter.im/hashicorp-terraform/Lobby.png)](https://gitter.im/hashicorp-terraform/Lobby) @@ -7,104 +6,46 @@ Terraform Provider -Requirements ------------- - +## Requirements - [Terraform](https://www.terraform.io/downloads.html) 0.12.x - [Go](https://golang.org/doc/install) 1.15.x (to build the provider plugin) -Building The Provider ---------------------- - -Clone repository to: `$GOPATH/src/github.com/terraform-providers/terraform-provider-docker` +## Building The Provider ```sh -$ mkdir -p $GOPATH/src/github.com/terraform-providers; cd $GOPATH/src/github.com/terraform-providers $ git clone git@github.com:terraform-providers/terraform-provider-docker -``` - -Enter the provider directory and build the provider - -```sh -$ cd $GOPATH/src/github.com/terraform-providers/terraform-provider-docker $ make build ``` -Using the provider ----------------------- -## Fill in for each provider - -Developing the Provider ---------------------------- - -If you wish to work on the provider, you'll first need the latest version of [Go](http://www.golang.org) installed on your machine (currently 1.15). You'll also need to correctly setup a [GOPATH](http://golang.org/doc/code.html#GOPATH), as well as adding `$GOPATH/bin` to your `$PATH` (note that we typically test older versions of golang as long as they are supported upstream, though we recommend new development to happen on the latest release). - -To compile the provider, run `make build`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory. - -```sh -$ make build -... -$ $GOPATH/bin/terraform-provider-docker -... -``` - -In order to test the provider, you can simply run `make test`. - -```sh -$ make test -``` - -In order to run the full suite of Acceptance tests, run `make testacc`. - -*Note:* Acceptance tests create a local registry which will be deleted afterwards. - -```sh -$ make testacc -``` - -In order to run only single Acceptance tests, execute the following steps: - -```sh -# setup the testing environment -$ make testacc_setup - -# run single tests -TF_LOG=INFO TF_ACC=1 go test -v ./docker -run ^TestAccDockerImage_data_private_config_file$ -timeout 360s - -# cleanup the local testing resources -$ make testacc_cleanup -``` - -In order to extend the provider and test it with `terraform`, build the provider as mentioned above with -```sh -$ make build -# or a specific version -$ go build -o terraform-provider-docker_v1.2.0_x4 -``` - -Remove an explicit version of the provider you develop, because `terraform` will fetch -the locally built one in `$GOPATH/bin` +## Example usage ```hcl -provider "docker" { - # version = "~> 0.1.2" - ... +# Set the required provider and versions +terraform { + required_providers { + # We recommend pinning to the specific version of the Azure Provider you're using + # since new versions are released frequently + docker = { + source = "kreuzwerker/docker" + version = "2.8.0" + } + } } -``` +# Configure the docker provider +provider "docker" { +} -Don't forget to run `terraform init` each time you rebuild the provider. Check [here](https://www.youtube.com/watch?v=TMmovxyo5sY&t=30m14s) for a more detailed explanation. +# Create a docker image resource +# -> docker pull nginx:latest +resource "docker_image" "foo" { + name = "c" + keep_locally = true +} -You can check the latest released version of a provider at https://releases.hashicorp.com/terraform-provider-docker/. - -Developing on Windows ---------------------- - -You can build and test on Widows without `make`. Run `go install` to -build and `Scripts\runAccTests.bat` to run the test suite. - -Continuous integration for Windows is not available at the moment due -to lack of a CI provider that is free for open source projects *and* -supports running Linux containers in Docker for Windows. For example, -AppVeyor is free for open source projects and provides Docker on its -Windows builds, but only offers Linux containers on Windows as a paid -upgrade. +# Create a docker container resource +# -> docker run --name foo -d nginx:latest +resource "docker_container" "foo" { + name = "foo" + image = docker_image.foo.latest +} +``` \ No newline at end of file