Skip to content

Commit

Permalink
Revert "chore: merge v4 into main (06-11-2023) (#1428)"
Browse files Browse the repository at this point in the history
This reverts commit b836824.
  • Loading branch information
Serpentiel committed Nov 6, 2023
1 parent b836824 commit b468a01
Show file tree
Hide file tree
Showing 39 changed files with 1,451 additions and 1,563 deletions.
14 changes: 0 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,6 @@ nav_order: 1
- Migrate `aiven_service_integration` to the Plugin Framework
- Deprecating `project_user`, `account_team` and `account_team_member` resources

## [X.Y.Z] - YYYY-MM-DD

- Fix unmarshalling empty userconfig crash

## [4.9.3] - 2023-10-27

- Deprecating `project_user`, `account_team` and `account_team_member` resources
- Fix incorrect read context in MySQL user resource
- Improve Kafka Topic creation and read performance

## [4.9.2] - 2023-10-04

- Fix `aiven_organization_user` created time serialization

## [4.9.1] - 2023-10-03

- Allow to modify `pg_user` replication settings
Expand Down
51 changes: 18 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: build build-dev debug test test-unit test-acc test-examples lint lint-go lint-test lint-docs fmt fmt-test fmt-imports clean clean-tools clean-examples sweep generate gen-go docs
.PHONY: build build-dev test test-unit test-acc test-examples lint lint-go lint-test lint-docs fmt fmt-test docs clean clean-tools sweep go-generate generate imports

#################################################
# Global
Expand Down Expand Up @@ -34,7 +34,6 @@ $(TERRAFMT): $(TOOLS_BIN_DIR) $(TOOLS_DIR)/go.mod
# See https://github.com/hashicorp/terraform/blob/main/tools/protobuf-compile/protobuf-compile.go#L215
ARCH ?= $(shell $(GO) env GOOS GOARCH | tr '\n' '_' | sed '$$s/_$$//')
BUILD_DEV_DIR ?= ~/.terraform.d/plugins/registry.terraform.io/aiven-dev/aiven/0.0.0+dev/$(ARCH)
BUILD_DEV_BIN ?= $(BUILD_DEV_DIR)/terraform-provider-aiven_v0.0.0+dev

$(BUILD_DEV_DIR):
mkdir -p $(BUILD_DEV_DIR)
Expand All @@ -58,14 +57,7 @@ build:
# }
#}
build-dev: $(BUILD_DEV_DIR)
$(GO) build -gcflags='all=-N -l' -o $(BUILD_DEV_BIN)

#################################################
# Debug
#################################################

debug: build-dev
$(BUILD_DEV_BIN) -debug
$(GO) build -o $(BUILD_DEV_DIR)/terraform-provider-aiven_v0.0.0+dev

#################################################
# Test
Expand All @@ -91,6 +83,8 @@ test-acc:
TF_ACC=1 $(GO) test ./$(PKG_PATH)/... \
-v -count $(TEST_COUNT) -parallel $(ACC_TEST_PARALLELISM) $(RUNARGS) $(TESTARGS) -timeout $(ACC_TEST_TIMEOUT)

clean-examples:
find ./examples -type f -name '*.tfstate*' -delete

test-examples: build-dev clean-examples
AIVEN_PROVIDER_PATH=$(BUILD_DEV_DIR) $(GO) test --tags=examples ./examples_tests/... \
Expand Down Expand Up @@ -118,52 +112,43 @@ lint-docs: $(TFPLUGINDOCS)
# Format
#################################################

fmt: fmt-test fmt-imports

fmt: imports fmt-test

fmt-test: $(TERRAFMT)
$(TERRAFMT) fmt ./internal -fv


# macOS requires to install GNU sed first. Use `brew install gnu-sed` to install it.
# It has to be added to PATH as `sed` command, to replace default BSD sed.
# See `brew info gnu-sed` for more details on how to add it to PATH.
fmt-imports:
# On MACOS requires gnu-sed. Run `brew info gnu-sed` and follow instructions to replace default sed.
# Negative lookbehind tries to find "= `" pattern to not affect go templates for code generation
imports:
find . -type f -name '*.go' -exec sed -zi 's/(?<== `\s+)"\n\+\t"/"\n"/g' {} +
goimports -local "github.com/aiven/terraform-provider-aiven" -w .

#################################################
# Docs
#################################################

docs: $(TFPLUGINDOCS)
$(TFPLUGINDOCS) generate

#################################################
# Clean
#################################################

clean: clean-tools clean-examples sweep
clean: clean-tools sweep


clean-tools: $(TOOLS_BIN_DIR)
rm -rf $(TOOLS_BIN_DIR)


clean-examples:
find ./examples -type f -name '*.tfstate*' -delete


SWEEP ?= global

sweep:
@echo 'WARNING: This will destroy infrastructure. Use only in development accounts.'
$(GO) test ./internal/sweep -v -tags=sweep -sweep=$(SWEEP) $(SWEEP_ARGS) -timeout 15m

#################################################
# Generate
#################################################

generate: gen-go docs


gen-go:
go-generate:
go generate ./...
$(MAKE) fmt-imports


docs: $(TFPLUGINDOCS)
$(TFPLUGINDOCS) generate
generate: go-generate imports docs
5 changes: 1 addition & 4 deletions internal/schemautil/schemautil.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,7 @@ func unmarshalUserConfig(src interface{}) ([]map[string]interface{}, error) {
return nil, fmt.Errorf("%w: expected []interface{}", errInvalidStateType)
}

// For some reason, it looks like this is never empty, even if the user config is not set.
// We will keep this check here just in case, but the actual check that breaks the code is
// the one where we check if the first element is nil.
if len(configList) == 0 || configList[0] == nil {
if len(configList) == 0 {
return nil, nil
}

Expand Down
Loading

0 comments on commit b468a01

Please sign in to comment.