Skip to content

Commit

Permalink
Merge pull request #20 from form3tech-oss/fmatavelli-update-drp-provider
Browse files Browse the repository at this point in the history
Fixes nil param type definition
  • Loading branch information
fabiomatavelli-f3 authored May 26, 2023
2 parents f794fbd + 53ae1c6 commit 73d215f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drpv4/resource_drp_profile_param.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ func getParamSchemaType(c *Config, name string) string {
return "string"
}

if param.Schema == nil || param.Schema.(map[string]interface{})["type"] == nil {
return "string"
}

s := param.Schema.(map[string]interface{})["type"].(string)

return s
Expand Down
17 changes: 17 additions & 0 deletions drpv4/resource_drp_profile_param_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,23 @@ func TestAccResourceProfileParam(t *testing.T) {
resource.TestCheckResourceAttr(fmt.Sprintf("drp_profile_param.%s", profileParamName), "value", "test2"),
),
},
{
Config: fmt.Sprintf(`
resource "drp_param" "%s" {
name = "test_nil_schema"
description = "Testing nil schema"
}
resource "drp_profile_param" "%s" {
profile = "global"
name = drp_param.%s.name
value = "test"
}
`, profileParamName, profileParamName, profileParamName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(fmt.Sprintf("drp_profile_param.%s", profileParamName), "value", "test"),
),
},
{
Config: fmt.Sprintf(`
resource "drp_param" "%s" {
Expand Down

0 comments on commit 73d215f

Please sign in to comment.