Skip to content

Commit

Permalink
Add import_only to random_password
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisShannon committed Jan 24, 2024
1 parent c475f2b commit bcc94ff
Show file tree
Hide file tree
Showing 16 changed files with 102 additions and 2,864 deletions.
56 changes: 12 additions & 44 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
archives:
- files:
# Ensure only built binary is archived
- 'none*'
format: zip
- format: zip
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
before:
hooks:
Expand All @@ -16,62 +13,33 @@ builds:
- -trimpath
goos:
- darwin
- freebsd
- linux
- windows
goarch:
- '386'
- amd64
- arm
- arm64
ignore:
- goarch: arm
goos: windows
- goarch: arm64
goos: freebsd
- goarch: arm64
goos: windows
ldflags:
- -s -w -X main.Version={{.Version}}
- -s -w -X main.Version={{.Version}} -X main.Commit={{.Commit}}'
mod_timestamp: '{{ .CommitTimestamp }}'
checksum:
algorithm: sha256
extra_files:
- glob: 'terraform-registry-manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
milestones:
- close: true
publishers:
- checksum: true
# Terraform CLI 0.10 - 0.11 perform discovery via HTTP headers on releases.hashicorp.com
# For providers which have existed since those CLI versions, exclude
# discovery by setting the protocol version headers to 5.
cmd: |
hc-releases upload -product {{ .ProjectName }} -version {{ .Version }} -file={{ .ArtifactPath }}={{ .ArtifactName }} -header=x-terraform-protocol-version=5 -header=x-terraform-protocol-versions=5.0
env:
- HC_RELEASES_HOST={{ .Env.HC_RELEASES_HOST }}
- HC_RELEASES_KEY={{ .Env.HC_RELEASES_KEY }}
extra_files:
- glob: 'terraform-registry-manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
name: upload
signature: true
release:
extra_files:
- glob: 'terraform-registry-manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
ids:
- none
changelog:
skip: true
signs:
- args: ["sign", "--dearmor", "--file", "${artifact}", "--out", "${signature}"]
artifacts: checksum
cmd: signore
signature: ${artifact}.sig
- args: ["sign", "--dearmor", "--file", "${artifact}", "--out", "${signature}"]
artifacts: checksum
cmd: signore
id: key-id
signature: ${artifact}.72D7468F.sig
snapshot:
name_template: "{{ .Tag }}-next"
- args:
- "--batch"
- "--local-user"
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
- "--output"
- "${signature}"
- "--detach-sign"
- "${artifact}"
1 change: 1 addition & 0 deletions docs/resources/password.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ resource "aws_db_instance" "example" {

### Optional

- `import_only` (Boolean) Only allow import, password generation will throw an error. Default value is `false`.
- `keepers` (Map of String) Arbitrary map of values that, when changed, will trigger recreation of resource. See [the main provider documentation](../index.html) for more information.
- `lower` (Boolean) Include lowercase alphabet characters in the result. Default value is `true`.
- `min_lower` (Number) Minimum number of lowercase alphabet characters in the result. Default value is `0`.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/terraform-providers/terraform-provider-random
module github.com/AmazeCom/terraform-provider-random

go 1.20

Expand Down
11 changes: 11 additions & 0 deletions internal/diagnostics/diagnostics.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,14 @@ func RandomnessGenerationError(errMsg string) diag.Diagnostics {

return diags
}

func ImportOnlyError() diag.Diagnostics {
var diags diag.Diagnostics

diags.AddError(
"Import Only Error",
"While attempting to generate a random value for this resource, the import_only attribute was true.\n\n",
)

return diags
}
9 changes: 0 additions & 9 deletions internal/provider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@ func protoV5ProviderFactories() map[string]func() (tfprotov5.ProviderServer, err
}
}

func providerVersion221() map[string]resource.ExternalProvider {
return map[string]resource.ExternalProvider{
"random": {
VersionConstraint: "2.2.1",
Source: "hashicorp/random",
},
}
}

func providerVersion313() map[string]resource.ExternalProvider {
return map[string]resource.ExternalProvider{
"random": {
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/resource_bytes.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"

"github.com/terraform-providers/terraform-provider-random/internal/diagnostics"
"github.com/AmazeCom/terraform-provider-random/internal/diagnostics"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/resource_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"

"github.com/terraform-providers/terraform-provider-random/internal/diagnostics"
mapplanmodifiers "github.com/terraform-providers/terraform-provider-random/internal/planmodifiers/map"
"github.com/AmazeCom/terraform-provider-random/internal/diagnostics"
mapplanmodifiers "github.com/AmazeCom/terraform-provider-random/internal/planmodifiers/map"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/resource_integer.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"

mapplanmodifiers "github.com/terraform-providers/terraform-provider-random/internal/planmodifiers/map"
"github.com/terraform-providers/terraform-provider-random/internal/random"
mapplanmodifiers "github.com/AmazeCom/terraform-provider-random/internal/planmodifiers/map"
"github.com/AmazeCom/terraform-provider-random/internal/random"
)

var (
Expand Down
Loading

0 comments on commit bcc94ff

Please sign in to comment.