Skip to content

Commit

Permalink
Generate changelog, add a Makefile and Dependabot support (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
Talina06 authored Dec 7, 2023
1 parent de8df2e commit a46967a
Show file tree
Hide file tree
Showing 155 changed files with 1,533 additions and 1,518 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Maintained by the Couchbase Capella DevEx Integrations team
* @couchbasecloud/couchbase-capella-terraform-provider-team
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: weekly
day: wednesday
reviewers:
- "couchbasecloud/couchbase-capella-terraform-provider-team"
34 changes: 16 additions & 18 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,16 @@ Merging to main == merging to PRODUCTION.

## Description

Please include a summary of the fix/feature/change, including any relevant motivation and context.
<!-- What does this change do? Why is it needed? -->

## Maturity Assessment
## Type of Change

- [ ] 0. Prototype
- [ ] 1. Make it work
- [ ] 2. Make it right
- [ ] 3. Make it delightful
- [ ] N/A

## Area impacted

- [ ] Resource
- [ ] Data source
- [ ] Documentation
- [ ] Other (Please comment)

<!-- Tick this box if this PR introduces a breaking change -->
- [ ] Breaking change
- [ ] Bug fix (non-breaking change which fixes an issue). Please, add the "bug" label to the PR.
- [ ] New feature (non-breaking change which adds functionality). Please, add the "enhancement" label to the PR.
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR.
- [ ] This change requires a documentation update
- [ ] Documentation fix/enhancement

## Manual Testing Approach

Expand All @@ -38,13 +29,20 @@ Merging to main == merging to PRODUCTION.
- [ ] Manually tested
- [ ] Unit tested
- [ ] Acceptance tested
- [ ] E2E tested
- [ ] Unable to test / will not test (Please provide comments in section below)


### Testing

<details open>
<summary>Testing</summary>
<!-- Provide your testing proof within this collapsible segment-->
</details>

## Required Checklist:

- [ ] I have checked that this change does not generate any credentials and that **they are NOT accidentally logged anywhere**.
- [ ] I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
- [ ] I have added any necessary documentation (if required)
- [ ] I have run make fmt and formatted my code

## Further comments
41 changes: 41 additions & 0 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Acceptance Tests
concurrency:
group: acceptance-tests

on:
workflow_dispatch:
pull_request:
push:
branches:
- main
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'
- 'LICENSE'
- 'Makefile'
- 'docs/**'

jobs:
build:
name: Build
runs-on: ubuntu-latest

env:
TF_VAR_auth_token: ${{ secrets.CAPELLA_AUTH_TOKEN }}
TF_VAR_organization_id: ${{ secrets.CAPELLA_ORGANIZATION_ID }}
TF_VAR_host: ${{ secrets.CAPELLA_HOST }}

steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
id: go
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}
- name: Run acceptance tests
run: make testacc
39 changes: 39 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Lint
on: [pull_request]

permissions:
contents: read
pull-requests: read

jobs:
golangci:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # needed for `only-new-issues` to compare diffs
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: "--config .golangci.yml"
only-new-issues: true

tfproviderlint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- run: make tfcheck
22 changes: 22 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Unit Tests
on: [pull_request]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out code repository source code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
id: go
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}
- name: Vet
run: make vet
- name: Test
run: make test
4 changes: 4 additions & 0 deletions .github_changelog_generator
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
future-release=v1.0.0
since-tag=v1.0.0
date-format=%Y-%m-%d
base=CHANGELOG.md
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ terraform.tfvars
*.backup
*.tfstate.*

# Ignore binary build folder
bin

# Ignore terraform hidden folder
/.terraform

Expand Down
5 changes: 5 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ issues:
max-per-linter: 0
max-same-issues: 0

run:
skip-files:
- (.+)_test.go
- internal/testing

linters:
disable-all: true
enable:
Expand Down
40 changes: 30 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
# 1.0.0 (Unreleased)
# Changelog

## October 18 2023
UPGRADE NOTES:
- Upgraded provider to use Golang 1.20+ and Terraform 1.5+
- Upgraded terraform-plugin-framework to 1.4.1
## [v1.0.0](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/tree/v1.0.0) (2023-11-10)

BUG FIXES:
- Update cluster will no longer fail for PoC organization with developer pro plan.
- User removed from organization from Capella UI won't break the terraform provider.
[Full Changelog](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/compare/d9a774ce9a0731bd15a6ca9eb9b7ea4d7f4e1d33...v1.0.0)

ENHANCEMENTS:
- Detailed examples and README with sample outputs
**Merged pull requests:**

- \[AV-67237\] Code Health - Create Acceptance Test Directory [\#87](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/pull/87) ([matty271828](https://github.com/matty271828))
- \[AV-64820\] App Services Terraform Provider Feature Branch [\#84](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/pull/84) ([nidhi07kumar](https://github.com/nidhi07kumar))
- \[AV-67060\] PP Bugs - Pass in sort by parameter [\#83](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/pull/83) ([matty271828](https://github.com/matty271828))
- \[AV-62009\] Code Health - Pass in Success Codes to Client [\#80](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/pull/80) ([matty271828](https://github.com/matty271828))
- \[AV-66360\] PP Bugs - Make resource object optional [\#76](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/pull/76) ([matty271828](https://github.com/matty271828))
- \[AV-65775\] List APIs - Database Credentials & Buckets Pagination [\#74](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/pull/74) ([matty271828](https://github.com/matty271828))
- \[AV-65679\] List APIs - Users, ApiKeys & Clusters Pagination [\#73](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/pull/73) ([matty271828](https://github.com/matty271828))
- \[AV-65771\] List APIs - Projects pagination [\#72](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/pull/72) ([matty271828](https://github.com/matty271828))
- \[AV-65452\] CREATE bucket with optional fields [\#68](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/pull/68) ([nidhi07kumar](https://github.com/nidhi07kumar))
- AV-66047 Add PR template [\#67](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/pull/67) ([rijuCB](https://github.com/rijuCB))
- Bump google.golang.org/grpc from 1.57.0 to 1.57.1 [\#66](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/pull/66) ([dependabot[bot]](https://github.com/apps/dependabot))
- \[AV-65773\] Allowlists Datasource - Pagination [\#65](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/pull/65) ([matty271828](https://github.com/matty271828))
- \[AV-65899\] PP Bugs - Move project roles into same array [\#64](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/pull/64) ([matty271828](https://github.com/matty271828))
- \[AV-63471\] User Resource - Update user using patch request [\#62](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/pull/62) ([matty271828](https://github.com/matty271828))
- \[AV-65088\] Better access example for creating db user [\#61](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/pull/61) ([Talina06](https://github.com/Talina06))
- \[AV-65076\] Fixed template.tfvars files for examples [\#60](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/pull/60) ([nidhi07kumar](https://github.com/nidhi07kumar))
- \[AV-64976\] User refresh state for users deleted from UI [\#59](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/pull/59) ([nidhi07kumar](https://github.com/nidhi07kumar))
- Fix added for various resources creation failing in main branch [\#58](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/pull/58) ([aniket-Kumar-c](https://github.com/aniket-Kumar-c))
- AV-65056: acceptance test poc for project [\#54](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/pull/54) ([aniket-Kumar-c](https://github.com/aniket-Kumar-c))
- Bump golang.org/x/net from 0.13.0 to 0.17.0 [\#51](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/pull/51) ([dependabot[bot]](https://github.com/apps/dependabot))
- \[AV-64572\] Code Health - Extract Schema State Validation [\#50](https://github.com/couchbasecloud/terraform-provider-couchbase-capella/pull/50) ([matty271828](https://github.com/matty271828))



\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
99 changes: 99 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)

BINARY_NAME=terraform-provider-couchbase-capella
DESTINATION=./bin/$(BINARY_NAME)

GOFLAGS=-mod=vendor
GOOPTS="-p 2"
GOFMT_FILES?=$$(find . -name '*.go')

GITTAG=$(shell git describe --always --tags)
VERSION=$(GITTAG:v%=%)
LINKER_FLAGS=-s -w -X 'github.com/couchbasecloud/terraform-provider-couchbase-cloud/version.ProviderVersion=${VERSION}'

GOLANGCI_VERSION=v1.55.2

export PATH := $(shell go env GOPATH)/bin:$(PATH)
export SHELL := env PATH=$(PATH) /bin/bash

default: build

# Tries to configure GOPATH if it isn't set.
ifndef $(GOPATH)
GOPATH=$(shell go env GOPATH)
endif

.PHONY: help
help:
@grep -h -E '^[a-zA-Z_-]+:.*?$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

.PHONY: build
build: fmt
go build -ldflags "$(LINKER_FLAGS)" -o $(DESTINATION)

.PHONY: fmt
fmt:
@echo "==> Fixing source code with gofmt..."
gofmt -s -w $(GOFMT_FILES)

.PHONY: vet
vet:
@echo "==> Running go vet ."
@go vet ./... ; if [ $$? -ne 0 ]; then \
echo ""; \
echo "Vet found suspicious constructs. Please check the reported constructs"; \
echo "and fix them if necessary before submitting the code for review."; \
exit 1; \
fi

.PHONY: lint-fix
lint-fix:
@echo "==> Fixing linters errors..."
fieldalignment -json -fix ./...
golangci-lint run --fix

.PHONY: setup
setup: ## Install dev tools
@echo "==> Installing dependencies..."
go install github.com/client9/misspell/cmd/misspell@latest
go install golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment@latest
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin $(GOLANGCI_VERSION)

.PHONY: check
check: tffmt tfcheck fmt docs-lint lint-fix test testacc

.PHONY: docs-lint
docs-lint:
@echo "==> Checking docs against linters..."
@misspell -error -source=text docs/

.PHONY: docs
docs:
@echo "Use this site to preview markdown rendering: https://registry.terraform.io/tools/doc-preview"

.PHONY: terraform-check tfcheck
tfcheck: terraform-check
terraform-check:
@terraform fmt -check=true -diff -recursive .

.PHONY: terraform-fmt tffmt
tffmt: terraform-fmt
terraform-fmt:
@terraform fmt -write -recursive -diff .
.PHONY: terraform-check tfcheck

TEST_FLAGS ?= -short -cover -race

.PHONY: test
test:
go test $(TEST_FLAGS) ./...

.PHONY: test-acceptance testacc
testacc: test-acceptance
test-acceptance:
@[ "${TF_VAR_auth_token}" ] || ( echo "export TF_VAR_auth_token before running the acceptance tests"; exit 1 )
@[ "${TF_VAR_host}" ] || ( echo "export TF_VAR_host before running the acceptance tests"; exit 1 )
@[ "${TF_VAR_organization_id}" ] || ( echo "export TF_VAR_organization_id before running the acceptance tests"; exit 1 )
TF_ACC=1 go test -timeout=300m -v ./... -run TestAccOrganizationDataSource -run TestAccProjectResource -run TestAccCreateProjectWithReqFields -run TestAccCreateProjectOptFields -run TestAccValidProjectUpdate -run TestAccInvalidProjectResource -run TestAccDeleteProjectBeforeDestroy -run TestAccClusterResourceAzure -run TestAccClusterResourceGCP -run TestAccClusterResourceWithOnlyReqFieldAWS


Loading

0 comments on commit a46967a

Please sign in to comment.