Skip to content

Commit

Permalink
Merge pull request #261 from vancluever/dependabot/go_modules/github.…
Browse files Browse the repository at this point in the history
…com/hashicorp/terraform-plugin-sdk/v2-2.23.0
  • Loading branch information
dependabot[bot] committed Oct 3, 2022
2 parents b8888d0 + 69a0a31 commit 17cef03
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 39 deletions.
20 changes: 15 additions & 5 deletions acme/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,21 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

var testAccProviders map[string]*schema.Provider
func testAccProviderAcme() *schema.Provider {
return Provider()
}

func testAccProviderAcmeConfig(serverUrl string) *Config {
return &Config{
ServerURL: serverUrl,
}
}

var testAccProviders = map[string]func() (*schema.Provider, error){
"acme": func() (*schema.Provider, error) {
return testAccProviderAcme(), nil
},
}

// Path to the pebble CA cert list, from GOPATH
const pebbleCACerts = "src/github.com/letsencrypt/pebble/test/certs/pebble.minica.pem"
Expand Down Expand Up @@ -139,10 +153,6 @@ func init() {

// Set lego's CA certs to pebble's CA for testing w/pebble
os.Setenv("LEGO_CA_CERTIFICATES", filepath.Join(build.Default.GOPATH, pebbleCACerts))

testAccProviders = map[string]*schema.Provider{
"acme": Provider(),
}
}

func TestProvider(t *testing.T) {
Expand Down
30 changes: 15 additions & 15 deletions acme/resource_acme_certificate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var certURLRegexp = regexp.MustCompile(`^https://localhost:1400[01]/certZ/[a-z0-

func TestAccACMECertificate_basic(t *testing.T) {
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
ProviderFactories: testAccProviders,
ExternalProviders: testAccExternalProviders,
CheckDestroy: testAccCheckACMECertificateStatus("acme_certificate.certificate", certificateStatusRevoked),
Steps: []resource.TestStep{
Expand All @@ -51,7 +51,7 @@ func TestAccACMECertificate_basic(t *testing.T) {

func TestAccACMECertificate_CSR(t *testing.T) {
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
ProviderFactories: testAccProviders,
ExternalProviders: testAccExternalProviders,
Steps: []resource.TestStep{
{
Expand All @@ -69,7 +69,7 @@ func TestAccACMECertificate_CSR(t *testing.T) {

func TestAccACMECertificate_CSR_PreferredChain(t *testing.T) {
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
ProviderFactories: testAccProviders,
ExternalProviders: testAccExternalProviders,
Steps: []resource.TestStep{
{
Expand All @@ -88,7 +88,7 @@ func TestAccACMECertificate_CSR_PreferredChain(t *testing.T) {
func TestAccACMECertificate_forceRenewal(t *testing.T) {
var certURL string
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
ProviderFactories: testAccProviders,
ExternalProviders: testAccExternalProviders,
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -128,7 +128,7 @@ func TestAccACMECertificate_forceRenewal(t *testing.T) {

func TestAccACMECertificate_wildcard(t *testing.T) {
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
ProviderFactories: testAccProviders,
ExternalProviders: testAccExternalProviders,
Steps: []resource.TestStep{
{
Expand All @@ -146,7 +146,7 @@ func TestAccACMECertificate_wildcard(t *testing.T) {

func TestAccACMECertificate_p12Password(t *testing.T) {
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
ProviderFactories: testAccProviders,
ExternalProviders: testAccExternalProviders,
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -176,7 +176,7 @@ func TestAccACMECertificate_preCheckDelay(t *testing.T) {
const delay = 15

resource.Test(t, resource.TestCase{
Providers: testAccProviders,
ProviderFactories: testAccProviders,
ExternalProviders: testAccExternalProviders,
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -238,7 +238,7 @@ func TestAccACMECertificate_preCheckDelay(t *testing.T) {

func TestAccACMECertificate_duplicateDomain(t *testing.T) {
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
ProviderFactories: testAccProviders,
ExternalProviders: testAccExternalProviders,
Steps: []resource.TestStep{
{
Expand All @@ -256,7 +256,7 @@ func TestAccACMECertificate_duplicateDomain(t *testing.T) {

func TestAccACMECertificate_preferredChain(t *testing.T) {
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
ProviderFactories: testAccProviders,
ExternalProviders: testAccExternalProviders,
Steps: []resource.TestStep{
{
Expand All @@ -274,7 +274,7 @@ func TestAccACMECertificate_preferredChain(t *testing.T) {

func TestAccACMECertificate_http(t *testing.T) {
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
ProviderFactories: testAccProviders,
ExternalProviders: testAccExternalProviders,
Steps: []resource.TestStep{
{
Expand All @@ -298,7 +298,7 @@ func TestAccACMECertificate_httpWebroot(t *testing.T) {
defer closeServer()

resource.Test(t, resource.TestCase{
Providers: testAccProviders,
ProviderFactories: testAccProviders,
ExternalProviders: testAccExternalProviders,
Steps: []resource.TestStep{
{
Expand All @@ -322,7 +322,7 @@ func TestAccACMECertificate_httpMemcache(t *testing.T) {
defer closeServer()

resource.Test(t, resource.TestCase{
Providers: testAccProviders,
ProviderFactories: testAccProviders,
ExternalProviders: testAccExternalProviders,
Steps: []resource.TestStep{
{
Expand All @@ -346,7 +346,7 @@ func TestAccACMECertificate_httpProxy(t *testing.T) {
defer closeServer()

resource.Test(t, resource.TestCase{
Providers: testAccProviders,
ProviderFactories: testAccProviders,
ExternalProviders: testAccExternalProviders,
Steps: []resource.TestStep{
{
Expand All @@ -364,7 +364,7 @@ func TestAccACMECertificate_httpProxy(t *testing.T) {

func TestAccACMECertificate_tls(t *testing.T) {
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
ProviderFactories: testAccProviders,
ExternalProviders: testAccExternalProviders,
Steps: []resource.TestStep{
{
Expand All @@ -382,7 +382,7 @@ func TestAccACMECertificate_tls(t *testing.T) {

func TestAccACMECertificate_noRevoke(t *testing.T) {
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
ProviderFactories: testAccProviders,
ExternalProviders: testAccExternalProviders,
CheckDestroy: testAccCheckACMECertificateStatus("acme_certificate.certificate", certificateStatusValid),
Steps: []resource.TestStep{
Expand Down
22 changes: 11 additions & 11 deletions acme/resource_acme_registration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (

func TestAccACMERegistration_basic(t *testing.T) {
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
ProviderFactories: testAccProviders,
ExternalProviders: testAccExternalProviders,
CheckDestroy: testAccCheckACMERegistrationValid("acme_registration.reg", false),
CheckDestroy: testAccCheckACMERegistrationValid("acme_registration.reg", false, pebbleDirBasic),
Steps: []resource.TestStep{
{
Config: testAccACMERegistrationConfig(),
Expand All @@ -22,7 +22,7 @@ func TestAccACMERegistration_basic(t *testing.T) {
"acme_registration.reg", "id",
"acme_registration.reg", "registration_url",
),
testAccCheckACMERegistrationValid("acme_registration.reg", true),
testAccCheckACMERegistrationValid("acme_registration.reg", true, pebbleDirBasic),
),
},
},
Expand All @@ -31,9 +31,9 @@ func TestAccACMERegistration_basic(t *testing.T) {

func TestAccACMERegistration_eab(t *testing.T) {
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
ProviderFactories: testAccProviders,
ExternalProviders: testAccExternalProviders,
CheckDestroy: testAccCheckACMERegistrationValid("acme_registration.reg", false),
CheckDestroy: testAccCheckACMERegistrationValid("acme_registration.reg", false, pebbleDirEAB),
Steps: []resource.TestStep{
{
Config: testAccACMERegistrationConfigEAB(),
Expand All @@ -42,7 +42,7 @@ func TestAccACMERegistration_eab(t *testing.T) {
"acme_registration.reg", "id",
"acme_registration.reg", "registration_url",
),
testAccCheckACMERegistrationValid("acme_registration.reg", true),
testAccCheckACMERegistrationValid("acme_registration.reg", true, pebbleDirEAB),
),
},
},
Expand All @@ -52,7 +52,7 @@ func TestAccACMERegistration_eab(t *testing.T) {
func TestAccACMERegistration_refreshDeactivated(t *testing.T) {
var state *terraform.State
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
ProviderFactories: testAccProviders,
ExternalProviders: testAccExternalProviders,
Steps: []resource.TestStep{
{
Expand All @@ -66,14 +66,14 @@ func TestAccACMERegistration_refreshDeactivated(t *testing.T) {
"acme_registration.reg", "id",
"acme_registration.reg", "registration_url",
),
testAccCheckACMERegistrationValid("acme_registration.reg", true),
testAccCheckACMERegistrationValid("acme_registration.reg", true, pebbleDirBasic),
),
},
{
PreConfig: func() {
rs := state.RootModule().Resources["acme_registration.reg"]
d := testAccCheckACMERegistrationResourceData(rs)
client, _, err := expandACMEClient(d, testAccProviders["acme"].Meta(), true)
client, _, err := expandACMEClient(d, testAccProviderAcmeConfig(pebbleDirBasic), true)
if err != nil {
panic(err)
}
Expand All @@ -90,7 +90,7 @@ func TestAccACMERegistration_refreshDeactivated(t *testing.T) {
})
}

func testAccCheckACMERegistrationValid(n string, exists bool) resource.TestCheckFunc {
func testAccCheckACMERegistrationValid(n string, exists bool, acmeServerUrl string) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n]
if !ok {
Expand Down Expand Up @@ -130,7 +130,7 @@ func testAccCheckACMERegistrationValid(n string, exists bool) resource.TestCheck

d := testAccCheckACMERegistrationResourceData(rs)

client, _, err := expandACMEClient(d, testAccProviders["acme"].Meta(), true)
client, _, err := expandACMEClient(d, testAccProviderAcmeConfig(acmeServerUrl), true)
if err != nil {
if regGone(err) && !exists {
return nil
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/google/go-cmp v0.5.9
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-uuid v1.0.3
github.com/hashicorp/terraform-plugin-sdk/v2 v2.21.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.23.0
github.com/mitchellh/copystructure v1.2.0
github.com/oklog/run v1.1.0 // indirect
github.com/rainycape/memcache v0.0.0-20150622160815-1031fa0ce2f2
Expand Down
15 changes: 8 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -349,23 +349,23 @@ github.com/hashicorp/hc-install v0.4.0 h1:cZkRFr1WVa0Ty6x5fTvL1TuO1flul231rWkGH9
github.com/hashicorp/hc-install v0.4.0/go.mod h1:5d155H8EC5ewegao9A4PUTMNPZaq+TbOzkJJZ4vrXeI=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/hcl/v2 v2.13.0 h1:0Apadu1w6M11dyGFxWnmhhcMjkbAiKCv7G1r/2QgCNc=
github.com/hashicorp/hcl/v2 v2.13.0/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0=
github.com/hashicorp/hcl/v2 v2.14.0 h1:jX6+Q38Ly9zaAJlAjnFVyeNSNCKKW8D0wvyg7vij5Wc=
github.com/hashicorp/hcl/v2 v2.14.0/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0=
github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y=
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
github.com/hashicorp/terraform-exec v0.17.2 h1:EU7i3Fh7vDUI9nNRdMATCEfnm9axzTnad8zszYZ73Go=
github.com/hashicorp/terraform-exec v0.17.2/go.mod h1:tuIbsL2l4MlwwIZx9HPM+LOV9vVyEfBYu2GsO1uH3/8=
github.com/hashicorp/terraform-exec v0.17.3 h1:MX14Kvnka/oWGmIkyuyvL6POx25ZmKrjlaclkx3eErU=
github.com/hashicorp/terraform-exec v0.17.3/go.mod h1:+NELG0EqQekJzhvikkeQsOAZpsw0cv/03rbeQJqscAI=
github.com/hashicorp/terraform-json v0.14.0 h1:sh9iZ1Y8IFJLx+xQiKHGud6/TSUCM0N8e17dKDpqV7s=
github.com/hashicorp/terraform-json v0.14.0/go.mod h1:5A9HIWPkk4e5aeeXIBbkcOvaZbIYnAIkEyqP2pNSckM=
github.com/hashicorp/terraform-plugin-go v0.14.0 h1:ttnSlS8bz3ZPYbMb84DpcPhY4F5DsQtcAS7cHo8uvP4=
github.com/hashicorp/terraform-plugin-go v0.14.0/go.mod h1:2nNCBeRLaenyQEi78xrGrs9hMbulveqG/zDMQSvVJTE=
github.com/hashicorp/terraform-plugin-log v0.7.0 h1:SDxJUyT8TwN4l5b5/VkiTIaQgY6R+Y2BQ0sRZftGKQs=
github.com/hashicorp/terraform-plugin-log v0.7.0/go.mod h1:p4R1jWBXRTvL4odmEkFfDdhUjHf9zcs/BCoNHAc7IK4=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.21.0 h1:eIJjFlI4k6BMso6Wq/bq56U0RukXc4JbwJJ8Oze2/tg=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.21.0/go.mod h1:mYPs/uchNcBq7AclQv9QUtSf9iNcfp1Ag21jqTlDf2M=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.23.0 h1:D4EeQm0piYXIHp6ZH3zjyP2Elq6voC64x3GZptaiefA=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.23.0/go.mod h1:xkJGavPvP9kYS/VbiW8o7JuTNgPwm7Tiw/Ie/b46r4c=
github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c h1:D8aRO6+mTqHfLsK/BC3j5OAoogv1WLRWzY1AaTo3rBg=
github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c/go.mod h1:Wn3Na71knbXc1G8Lh+yu/dQWWJeFQEpDeJMtWMtlmNI=
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0=
Expand Down Expand Up @@ -690,8 +690,9 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1
github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s=
github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8=
github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk=
github.com/zclconf/go-cty v1.10.0 h1:mp9ZXQeIcN8kAwuqorjH+Q+njbJKjLrvB2yIh4q7U+0=
github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk=
github.com/zclconf/go-cty v1.11.0 h1:726SxLdi2SDnjY+BStqB9J1hNp4+2WlzyXLuimibIe0=
github.com/zclconf/go-cty v1.11.0/go.mod h1:s9IfD1LK5ccNMSWCVFCE2rJfHiZgi7JijgeWIMfhLvA=
github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
Expand Down

0 comments on commit 17cef03

Please sign in to comment.