Skip to content

Commit

Permalink
Merge pull request #2 from terraform-providers/master
Browse files Browse the repository at this point in the history
re-merge fork
  • Loading branch information
damoodamoo authored Oct 9, 2019
2 parents 28e93e4 + 29fbd47 commit fa68ff5
Show file tree
Hide file tree
Showing 1,964 changed files with 165,691 additions and 20,718 deletions.
36 changes: 36 additions & 0 deletions .golangci-travisrest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
run:
deadline: 30m10s
modules-download-mode: vendor

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

linters:
disable-all: true
enable:
- deadcode
- errcheck
- gofmt
- goimports
- gosimple
- govet
- ineffassign
- interfacer
- nakedret
- misspell
- structcheck
- typecheck
- unused
- unconvert
- varcheck
- vet
- vetshadow
- whitespace

linters-settings:
errcheck:
ignore: github.com/hashicorp/terraform-plugin-sdk/helper/schema:ForceNew|Set,fmt:.*,io:Close
misspell:
ignore-words:
- hdinsight
5 changes: 3 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ linters:
- varcheck
- vet
- vetshadow
- whitespace

linters-settings:
errcheck:
ignore: github.com/hashicorp/terraform/helper/schema:ForceNew|Set,fmt:.*,io:Close
ignore: github.com/hashicorp/terraform-plugin-sdk/helper/schema:ForceNew|Set,fmt:.*,io:Close
misspell:
ignore-words:
- hdinsight
- hdinsight
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ matrix:
allow_failures:
- go: tip
include:
- name: "make lint"
script: GOGC=20 make lint
- name: "make lintstatic"
script: GOGC=15 make lintstatic
- name: "make linttravis"
script: GOGC=15 make lintrest
- name: "make tflint"
script: make tflint
- name: "make test"
Expand Down
231 changes: 152 additions & 79 deletions CHANGELOG.md

Large diffs are not rendered by default.

18 changes: 17 additions & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fmt:
# This logic should match the search logic in scripts/gofmtcheck.sh
find . -name '*.go' | grep -v vendor | xargs gofmt -s -w

# Currently required by tf-deploy compile
# Currently required by tf-deploy compile, duplicated by linters
fmtcheck:
@sh "$(CURDIR)/scripts/gofmtcheck.sh"

Expand All @@ -40,12 +40,28 @@ lint:
@echo "==> Checking source code against linters..."
golangci-lint run ./...

# we have split off static check because it causes travis to fail with an OOM error
lintstatic:
@echo "==> Checking source code against static check linters..."
(while true; do sleep 300; echo "(I'm still alive and linting!)"; done) & PID=$$!; echo $$PID; \
golangci-lint run ./... -v --no-config --concurrency 1 --deadline=30m10s --disable-all --enable=staticcheck; ES=$$?; kill -9 $$PID; exit $$ES

lintrest:
@echo "==> Checking source code against linters..."
(while true; do sleep 300; echo "(I'm still alive and linting!)"; done) & PID=$$!; echo $$PID; \
golangci-lint run ./... -v --concurrency 1 --deadline=30m10s --config .golangci-travisrest.yml ; ES=$$?; kill -9 $$PID; exit $$ES

tflint:
@echo "==> Checking source code against terraform provider linters..."
@tfproviderlint \
-R001 -R002 -R003 -R004\
-S001 -S002 -S003 -S004 -S005 -S006 -S007 -S008 -S009 -S010 -S011 -S012 -S013 -S014 -S015 -S016 -S017 -S018 -S019\
./$(PKG_NAME)

whitespace:
@echo "==> Fixing source code with whitespace linter..."
golangci-lint run ./... --no-config --disable-all --enable=whitespace --fix

test-docker:
docker run --rm -v $$(pwd):/go/src/github.com/terraform-providers/terraform-provider-azurerm -w /go/src/github.com/terraform-providers/terraform-provider-azurerm golang:1.13 make test

Expand Down
25 changes: 15 additions & 10 deletions azurerm/automation_variable.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import (
"time"

"github.com/Azure/azure-sdk-for-go/services/automation/mgmt/2015-10-31/automation"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

Expand Down Expand Up @@ -122,8 +123,9 @@ func datasourceAutomationVariableCommonSchema(attType schema.ValueType) map[stri
}

func resourceAutomationVariableCreateUpdate(d *schema.ResourceData, meta interface{}, varType string) error {
client := meta.(*ArmClient).automation.VariableClient
ctx := meta.(*ArmClient).StopContext
client := meta.(*ArmClient).Automation.VariableClient
ctx, cancel := timeouts.ForCreateUpdate(meta.(*ArmClient).StopContext, d)
defer cancel()

name := d.Get("name").(string)
resourceGroup := d.Get("resource_group_name").(string)
Expand Down Expand Up @@ -190,8 +192,9 @@ func resourceAutomationVariableCreateUpdate(d *schema.ResourceData, meta interfa
}

func resourceAutomationVariableRead(d *schema.ResourceData, meta interface{}, varType string) error {
client := meta.(*ArmClient).automation.VariableClient
ctx := meta.(*ArmClient).StopContext
client := meta.(*ArmClient).Automation.VariableClient
ctx, cancel := timeouts.ForRead(meta.(*ArmClient).StopContext, d)
defer cancel()

id, err := azure.ParseAzureResourceID(d.Id())
if err != nil {
Expand Down Expand Up @@ -236,9 +239,10 @@ func resourceAutomationVariableRead(d *schema.ResourceData, meta interface{}, va
return nil
}

func datasourceAutomationVariableRead(d *schema.ResourceData, meta interface{}, varType string) error {
client := meta.(*ArmClient).automation.VariableClient
ctx := meta.(*ArmClient).StopContext
func dataSourceAutomationVariableRead(d *schema.ResourceData, meta interface{}, varType string) error {
client := meta.(*ArmClient).Automation.VariableClient
ctx, cancel := timeouts.ForRead(meta.(*ArmClient).StopContext, d)
defer cancel()

resourceGroup := d.Get("resource_group_name").(string)
accountName := d.Get("automation_account_name").(string)
Expand Down Expand Up @@ -281,8 +285,9 @@ func datasourceAutomationVariableRead(d *schema.ResourceData, meta interface{},
}

func resourceAutomationVariableDelete(d *schema.ResourceData, meta interface{}, varType string) error {
client := meta.(*ArmClient).automation.VariableClient
ctx := meta.(*ArmClient).StopContext
client := meta.(*ArmClient).Automation.VariableClient
ctx, cancel := timeouts.ForDelete(meta.(*ArmClient).StopContext, d)
defer cancel()

id, err := azure.ParseAzureResourceID(d.Id())
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions azurerm/automation_variable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"testing"
"time"

"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

Expand Down Expand Up @@ -90,7 +90,7 @@ func testCheckAzureRMAutomationVariableExists(resourceName string, varType strin
resourceGroup := rs.Primary.Attributes["resource_group_name"]
accountName := rs.Primary.Attributes["automation_account_name"]

client := testAccProvider.Meta().(*ArmClient).automation.VariableClient
client := testAccProvider.Meta().(*ArmClient).Automation.VariableClient
ctx := testAccProvider.Meta().(*ArmClient).StopContext

if resp, err := client.Get(ctx, resourceGroup, accountName, name); err != nil {
Expand All @@ -105,7 +105,7 @@ func testCheckAzureRMAutomationVariableExists(resourceName string, varType strin
}

func testCheckAzureRMAutomationVariableDestroy(s *terraform.State, varType string) error {
client := testAccProvider.Meta().(*ArmClient).automation.VariableClient
client := testAccProvider.Meta().(*ArmClient).Automation.VariableClient
ctx := testAccProvider.Meta().(*ArmClient).StopContext

resourceName := fmt.Sprintf("azurerm_automation_variable_%s", strings.ToLower(varType))
Expand Down
13 changes: 8 additions & 5 deletions azurerm/common_hdinsight.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ import (
"log"

"github.com/Azure/azure-sdk-for-go/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tags"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func hdinsightClusterUpdate(clusterKind string, readFunc schema.ReadFunc) schema.UpdateFunc {
return func(d *schema.ResourceData, meta interface{}) error {
client := meta.(*ArmClient).hdinsight.ClustersClient
ctx := meta.(*ArmClient).StopContext
client := meta.(*ArmClient).HDInsight.ClustersClient
ctx, cancel := timeouts.ForUpdate(meta.(*ArmClient).StopContext, d)
defer cancel()

id, err := azure.ParseAzureResourceID(d.Id())
if err != nil {
Expand Down Expand Up @@ -61,8 +63,9 @@ func hdinsightClusterUpdate(clusterKind string, readFunc schema.ReadFunc) schema

func hdinsightClusterDelete(clusterKind string) schema.DeleteFunc {
return func(d *schema.ResourceData, meta interface{}) error {
client := meta.(*ArmClient).hdinsight.ClustersClient
ctx := meta.(*ArmClient).StopContext
client := meta.(*ArmClient).HDInsight.ClustersClient
ctx, cancel := timeouts.ForDelete(meta.(*ArmClient).StopContext, d)
defer cancel()

id, err := azure.ParseAzureResourceID(d.Id())
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions azurerm/common_hdinsight_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package azurerm
import (
"fmt"

"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

Expand All @@ -15,7 +15,7 @@ func testCheckAzureRMHDInsightClusterDestroy(terraformResourceName string) func(
continue
}

client := testAccProvider.Meta().(*ArmClient).hdinsight.ClustersClient
client := testAccProvider.Meta().(*ArmClient).HDInsight.ClustersClient
ctx := testAccProvider.Meta().(*ArmClient).StopContext
name := rs.Primary.Attributes["name"]
resourceGroup := rs.Primary.Attributes["resource_group_name"]
Expand Down Expand Up @@ -43,7 +43,7 @@ func testCheckAzureRMHDInsightClusterExists(resourceName string) resource.TestCh
clusterName := rs.Primary.Attributes["name"]
resourceGroup := rs.Primary.Attributes["resource_group_name"]

client := testAccProvider.Meta().(*ArmClient).hdinsight.ClustersClient
client := testAccProvider.Meta().(*ArmClient).HDInsight.ClustersClient
ctx := testAccProvider.Meta().(*ArmClient).StopContext
resp, err := client.Get(ctx, resourceGroup, clusterName)
if err != nil {
Expand Down
Loading

0 comments on commit fa68ff5

Please sign in to comment.