Skip to content

Commit

Permalink
Merge pull request #3 from terraform-providers/master
Browse files Browse the repository at this point in the history
sync
  • Loading branch information
martinbjorgan authored Jun 29, 2020
2 parents 49fac29 + 3c26dd0 commit 3e72bc1
Show file tree
Hide file tree
Showing 8,321 changed files with 2,030,708 additions and 611,493 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/Bug_Report.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ If you are running into one of these scenarios, we recommend opening an issue in

<!--- Thank you for keeping this note for the community --->

### Terraform Version
### Terraform (and AzureRM Provider) Version

<!--- Please run `terraform -v` to show the Terraform core version and provider version(s). If you are not running the latest version of Terraform or the provider, please upgrade because your issue may have already been fixed. [Terraform documentation on provider versioning](https://www.terraform.io/docs/configuration/providers.html#provider-versions). --->

### Affected Resource(s)

<!--- Please list the affected resources and data sources. --->

* azurerm_XXXXX
* `azurerm_XXXXX`

### Terraform Configuration Files

Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/Feature_Request.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: 🚀 Feature Request
about: I have a suggestion (and might want to implement myself 🙂)!
title: Support for [thing]

---

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/Question.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ so we recommend using our other community resources instead of asking here 👍.

If you have a support request or question please submit them to one of these resources:

* [Terraform community resources](https://www.terraform.io/docs/extend/community/index.html)
* [HashiCorp Community Forums](https://discuss.hashicorp.com/c/terraform-providers)
* [HashiCorp support](https://support.hashicorp.com) (Terraform Enterprise customers)
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ website/node_modules
*.backup
./*.tfstate
.terraform/
*.tfvars
*.auto.tfvars
*.log
*.bak
*~
.*.swp
.idea
*.iml
*.test
*.iml
.terraform.tfstate.lock.info

website/vendor

Expand All @@ -33,3 +35,12 @@ website/vendor
!command/test-fixtures/**/.terraform/

.env.sh

# generated by the example acceptance tests
examples/**/test.tf
examples/**/test.tfvars
examples/**/terraform
examples/**/terraform.zip

# never upload the build to git
terraform-provider-azurerm
1 change: 1 addition & 0 deletions .go-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.14.2
39 changes: 39 additions & 0 deletions .golangci-travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
run:
deadline: 60m10s
modules-download-mode: vendor

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

linters:
disable-all: true
enable:
- deadcode
- errcheck
- gocritic
- gofmt
- goimports
- gosimple
- govet
- ineffassign
- interfacer
- nakedret
- misspell
- staticcheck
- structcheck
- typecheck
- unconvert
- unparam
- 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
- exportfs
40 changes: 40 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
run:
deadline: 10m10s
modules-download-mode: vendor

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

linters:
disable-all: true
enable:
- deadcode
- errcheck
- gocritic
- gofmt
- goimports
- gosimple
- govet
- ineffassign
- interfacer
- nakedret
- misspell
- staticcheck
- structcheck
- typecheck
- unused
- unconvert
- unparam
- 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
- exportfs
26 changes: 26 additions & 0 deletions .hashibot.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
queued_behavior "release_commenter" "releases" {
repo_prefix = "terraform-provider-"

message = <<-EOF
This has been released in [version ${var.release_version} of the provider](${var.changelog_link}). Please see the [Terraform documentation on provider versioning](https://www.terraform.io/docs/configuration/providers.html#provider-versions) or reach out if you need any assistance upgrading. As an example:
```hcl
provider "${var.project_name}" {
version = "~> ${var.release_version}"
}
# ... other configuration ...
```
EOF
}

poll "closed_issue_locker" "locker" {
schedule = "0 50 14 * * *"
closed_for = "720h" # 30 days
max_issues = 500
sleep_between_issues = "5s"

message = <<-EOF
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!
EOF
}
2 changes: 2 additions & 0 deletions .teamcity/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target/
*.iml
10 changes: 10 additions & 0 deletions .teamcity/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
default: tools

tools:
mvn -U dependency:sources

test: validate
mvn test -DtestPackage=tests

validate:
mvn teamcity-configs:generate
28 changes: 28 additions & 0 deletions .teamcity/components/build_azure.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import jetbrains.buildServer.configs.kotlin.v2019_2.ParametrizedWithType

class ClientConfiguration(var clientId: String,
var clientSecret: String,
val subscriptionId : String,
val tenantId : String,
val clientIdAlt: String,
val clientSecretAlt: String,
val subscriptionIdAlt : String) {
}

class LocationConfiguration(var primary : String, var secondary : String, var ternary : String, var rotate : Boolean) {
}

fun ParametrizedWithType.ConfigureAzureSpecificTestParameters(environment: String, config: ClientConfiguration, locationsForEnv: LocationConfiguration) {
hiddenPasswordVariable("env.ARM_CLIENT_ID", config.clientId, "The ID of the Service Principal used for Testing")
hiddenPasswordVariable("env.ARM_CLIENT_ID_ALT", config.clientIdAlt, "The ID of the Alternate Service Principal used for Testing")
hiddenPasswordVariable("env.ARM_CLIENT_SECRET", config.clientSecret, "The Client Secret of the Service Principal used for Testing")
hiddenPasswordVariable("env.ARM_CLIENT_SECRET_ALT", config.clientSecretAlt, "The Client Secret of the Alternate Service Principal used for Testing")
hiddenVariable("env.ARM_ENVIRONMENT", environment, "The Azure Environment in which the tests are running")
hiddenVariable("env.ARM_PROVIDER_DYNAMIC_TEST", "%b".format(locationsForEnv.rotate), "Should tests rotate between the supported regions?")
hiddenPasswordVariable("env.ARM_SUBSCRIPTION_ID", config.subscriptionId, "The ID of the Azure Subscription used for Testing")
hiddenPasswordVariable("env.ARM_SUBSCRIPTION_ID_ALT", config.subscriptionIdAlt, "The ID of the Alternate Azure Subscription used for Testing")
hiddenPasswordVariable("env.ARM_TENANT_ID", config.tenantId, "The ID of the Azure Tenant used for Testing")
hiddenVariable("env.ARM_TEST_LOCATION", locationsForEnv.primary, "The Primary region which should be used for testing")
hiddenVariable("env.ARM_TEST_LOCATION_ALT", locationsForEnv.secondary, "The Primary region which should be used for testing")
hiddenVariable("env.ARM_TEST_LOCATION_ALT2", locationsForEnv.ternary, "The Primary region which should be used for testing")
}
108 changes: 108 additions & 0 deletions .teamcity/components/build_components.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import jetbrains.buildServer.configs.kotlin.v2019_2.*
import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.GolangFeature
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.ScriptBuildStep
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.schedule

// NOTE: in time this could be pulled out into a separate Kotlin package

// unfortunately TeamCity's Go Test Json parser appears to be broken
// as such for the moment let's use the old method with a feature-flag
const val useTeamCityGoTest = false

fun BuildFeatures.Golang() {
if (useTeamCityGoTest) {
feature(GolangFeature {
testFormat = "json"
})
}
}

fun BuildSteps.ConfigureGoEnv() {
step(ScriptBuildStep {
name = "Configure Go Version"
scriptContent = "goenv install -s \$(goenv local) && goenv rehash"
})
}

fun BuildSteps.RunAcceptanceTests(providerName : String, packageName: String) {
var servicePath = "./%s/internal/services/%s/tests".format(providerName, packageName)

if (useTeamCityGoTest) {
step(ScriptBuildStep {
name = "Run Tests"
scriptContent = "go test -v \"$servicePath\" -timeout=\"%TIMEOUT%h\" -test.parallel=\"%PARALLELISM%\" -run=\"%TEST_PREFIX%\" -json"
})
} else {
step(ScriptBuildStep {
name = "Compile Test Binary"
scriptContent = "go test -c -o test-binary"
workingDir = servicePath
})

step(ScriptBuildStep {
// ./test-binary -test.list=TestAccAzureRMResourceGroup_ | teamcity-go-test -test ./test-binary -timeout 1s
name = "Run via jen20/teamcity-go-test"
scriptContent = "./test-binary -test.list=\"%TEST_PREFIX%\" | teamcity-go-test -test ./test-binary -parallelism \"%PARALLELISM%\" -timeout \"%TIMEOUT%h\""
workingDir = servicePath
})
}
}

fun BuildSteps.RunAcceptanceTestsForPullRequest(providerName : String, packageName: String) {
var servicePath = "./%s/internal/services/%s/...".format(providerName, packageName)
if (useTeamCityGoTest) {
step(ScriptBuildStep {
name = "Run Tests"
scriptContent = "go test -v \"$servicePath\" -timeout=\"%TIMEOUT%h\" -test.parallel=\"%PARALLELISM%\" -run=\"%TEST_PREFIX%\" -json"
})
} else {
// Building a binary with teamcity-go-test doesn't work for multiple packages, so fallback to this
step(ScriptBuildStep {
name = "Install tombuildsstuff/teamcity-go-test-json"
scriptContent = "wget https://github.com/tombuildsstuff/teamcity-go-test-json/releases/download/v0.2.0/teamcity-go-test-json_linux_amd64 && chmod +x teamcity-go-test-json_linux_amd64"
})

step(ScriptBuildStep {
name = "Run Tests"
scriptContent = "GOFLAGS=\"-mod=vendor\" ./teamcity-go-test-json_linux_amd64 -scope \"$servicePath\" -prefix \"%TEST_PREFIX%\" -count=1 -parallelism=%PARALLELISM% -timeout %TIMEOUT%"
})
}
}

fun ParametrizedWithType.TerraformAcceptanceTestParameters(parallelism : Int, prefix : String, timeout: String) {
text("PARALLELISM", "%d".format(parallelism))
text("TEST_PREFIX", prefix)
text("TIMEOUT", timeout)
}

fun ParametrizedWithType.ReadOnlySettings() {
hiddenVariable("teamcity.ui.settings.readOnly", "true", "Requires build configurations be edited via Kotlin")
}

fun ParametrizedWithType.TerraformAcceptanceTestsFlag() {
hiddenVariable("env.TF_ACC", "1", "Set to a value to run the Acceptance Tests")
}

fun ParametrizedWithType.TerraformShouldPanicForSchemaErrors() {
hiddenVariable("env.TF_SCHEMA_PANIC_ON_ERROR", "1", "Panic if unknown/unmatched fields are set into the state")
}

fun ParametrizedWithType.hiddenVariable(name: String, value: String, description: String) {
text(name, value, "", description, ParameterDisplay.HIDDEN)
}

fun ParametrizedWithType.hiddenPasswordVariable(name: String, value: String, description: String) {
password(name, value, "", description, ParameterDisplay.HIDDEN)
}

fun Triggers.RunNightly(nightlyTestsEnabled: Boolean, startHour: Int) {
schedule{
enabled = nightlyTestsEnabled
branchFilter = "+:refs/heads/master"

schedulingPolicy = daily {
hour = startHour
timezone = "SERVER"
}
}
}
48 changes: 48 additions & 0 deletions .teamcity/components/build_config_pull_request.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import jetbrains.buildServer.configs.kotlin.v2019_2.*

class pullRequest(displayName: String, environment: String) {
val displayName = displayName
val environment = environment

fun buildConfiguration(providerName : String) : BuildType {
return BuildType {
// TC needs a consistent ID for dynamically generated packages
id(uniqueID(providerName))

name = displayName

vcs {
root(providerRepository)
cleanCheckout = true
}

steps {
var packageName = "\"%SERVICES%\""

ConfigureGoEnv()
RunAcceptanceTestsForPullRequest(providerName, packageName)
}

failureConditions {
errorMessage = true
}

features {
Golang()
}

params {
TerraformAcceptanceTestParameters(defaultParallelism, "TestAcc", "12")
TerraformAcceptanceTestsFlag()
TerraformShouldPanicForSchemaErrors()
ReadOnlySettings()

text("SERVICES", "portal")
}
}
}

fun uniqueID(provider : String) : String {
return "%s_PR_%s".format(provider.toUpperCase(), environment.toUpperCase())
}
}
Loading

0 comments on commit 3e72bc1

Please sign in to comment.