Skip to content

Commit

Permalink
version 0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ITMonta committed Nov 5, 2020
1 parent 13437d1 commit aaeaea4
Show file tree
Hide file tree
Showing 47 changed files with 1,990 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: golangci
on:
push:
tags:
- v*
branches:
- master
pull_request:

jobs:
go_lint:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.30

go_test:
name: golang test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download Go modules
run: go mod download
- name: Run Test
run: go test ./...
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: release
on:
push:
tags:
- 'v*'
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15
- name: Import GPG key
id: import_gpg
uses: paultyng/[email protected]
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Empty file added .gitignore
Empty file.
33 changes: 33 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
run:
deadline: 10m

issues:
max-per-linter: 0
max-same-issues: 0

linters:
disable-all: true
enable:
- deadcode
- errcheck
- gocritic
- govet
- ineffassign
- interfacer
- nakedret
- misspell
- typecheck
- unused
- unconvert
- unparam
- varcheck
- vet
- vetshadow

linters-settings:
errcheck:
ignore: github.com/hashicorp/terraform-plugin-sdk/helper/schema:ForceNew|Set,fmt:.*,io:Close
misspell:
ignore-words:
- hdinsight
- exportfs
54 changes: 54 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Visit https://goreleaser.com for documentation on how to customize this
# behavior.
before:
hooks:
# this is just an example and not a requirement for provider building/publishing
- go mod tidy
builds:
- env:
# goreleaser does not work with CGO, it could also complicate
# usage by users in CI/CD systems like Terraform Cloud where
# they are unable to install libraries.
- CGO_ENABLED=0
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
ldflags:
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
goos:
- freebsd
- windows
- linux
- darwin
goarch:
- amd64
- '386'
- arm
- arm64
ignore:
- goos: darwin
goarch: '386'
binary: '{{ .ProjectName }}_{{ .Version }}'
archives:
- format: zip
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
algorithm: sha256
signs:
- artifacts: checksum
args:
# if you are using this is a GitHub action or some other automated pipeline, you
# need to pass the batch flag to indicate its not interactive .
- "--batch"
- "--local-user"
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
- "--output"
- "${signature}"
- "--detach-sign"
- "${artifact}"
release:
# If you want to manually examine the release before its live, uncomment this line:
# draft: true
changelog:
skip: true
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/terraform-provider-mongodb.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ifndef VERBOSE
MAKEFLAGS += --no-print-directory
endif

default: install

.PHONY: install lint unit

OS_ARCH=linux_amd64
HOSTNAME=registry.terraform.io
NAMESPACE=Kaginari
NAME=mongodb
VERSION=0.0.1
## on linux base os
TERRAFORM_PLUGINS_DIRECTORY=~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}


install:
mkdir -p ${TERRAFORM_PLUGINS_DIRECTORY}
go build -o ${TERRAFORM_PLUGINS_DIRECTORY}/terraform-provider-${NAME}
cd examples && rm -rf .terraform
cd examples && make init
re-install:
rm -f ${TERRAFORM_PLUGINS_DIRECTORY}/terraform-provider-${NAME}
go build -o ${TERRAFORM_PLUGINS_DIRECTORY}/terraform-provider-${NAME}
cd examples && rm -rf .terraform
cd examples && make init
lint:
golangci-lint run

38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Terraform Provider Mongodb

This repository is a Algolia Mongodb for [Terraform](https://www.terraform.io).

### Requirements

- [Terraform](https://www.terraform.io/downloads.html) >= 0.13
- [Go](https://golang.org/doc/install) >= 1.15

### Installation

1. Clone the repository
1. Enter the repository directory
1. Build the provider using the `make install` command:

````bash
git clone https://github.com/Kaginari/terraform-provider-mongodb
cd terraform-provider-mongodb
make install
````

### To test locally

**1: lunch mongo instance**
````bash
cd docker
docker-compose up -d
````
**2: Build the provider**

follow the [Installation](#Installation)

**3: Use the provider**

````bash
cd mongodb
make apply
````
41 changes: 41 additions & 0 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: '3.1'

networks:
network:
driver: bridge

services:
mongo:
container_name: mongo
image: mongo:3.6
restart: always
environment:
- MONGODB_USER:admin
- MONGODB_PASS:all0.1EN2.3ce
- MONGODB_DATABASE=admin
volumes:
- mongo_data:/data/db
ports:
- 27017:27017
networks:
- network
mongo-express:
image: mongo-express
container_name: mongo-express
ports:
- 8081:8081
environment:
ME_CONFIG_BASICAUTH_USERNAME: admin
ME_CONFIG_BASICAUTH_PASSWORD: all0.1EN2.3ce
ME_CONFIG_MONGODB_SERVER: mongo
ME_CONFIG_MONGODB_PORT: 27017
ME_CONFIG_MONGODB_ADMINUSERNAME: admin
ME_CONFIG_MONGODB_ADMINPASSWORD: all0.1EN2.3ce
links:
- mongo:mongo
networks:
- network
depends_on:
- mongo
volumes:
mongo_data: {}
2 changes: 2 additions & 0 deletions docker/mongo/db/WiredTiger
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
WiredTiger
WiredTiger 3.1.1: (July 12, 2018)
1 change: 1 addition & 0 deletions docker/mongo/db/WiredTiger.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
WiredTiger lock file
Empty file added docker/mongo/db/WiredTiger.wt
Empty file.
Empty file added docker/mongo/db/WiredTiger.wt.1
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file added docker/mongo/db/WiredTiger.wt.2
Empty file.
Empty file added docker/mongo/db/WiredTiger.wt.3
Empty file.
Empty file added docker/mongo/db/WiredTiger.wt.4
Empty file.
Empty file added docker/mongo/db/WiredTiger.wt.5
Empty file.
Empty file added docker/mongo/db/WiredTiger.wt.6
Empty file.
Empty file added docker/mongo/db/WiredTiger.wt.7
Empty file.
Empty file added docker/mongo/db/WiredTiger.wt.8
Empty file.
Empty file added docker/mongo/db/WiredTiger.wt.9
Empty file.
Empty file added docker/mongo/db/mongod.lock
Empty file.
Loading

0 comments on commit aaeaea4

Please sign in to comment.