Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_api_management_named_value - fix the non empty plan when secret is true #6834

Merged
merged 6 commits into from May 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -149,7 +149,10 @@ func resourceArmApiManagementNamedValueRead(d *schema.ResourceData, meta interfa
if properties := resp.NamedValueContractProperties; properties != nil {
d.Set("display_name", properties.DisplayName)
d.Set("secret", properties.Secret)
d.Set("value", properties.Value)
// API will not return `value` when `secret` is `true`, in which case we shall not set the `value`. Refer to the issue : #6688
if properties.Secret != nil && !*properties.Secret {
d.Set("value", properties.Value)
}
d.Set("tags", properties.Tags)
}

Expand Down
Expand Up @@ -23,10 +23,6 @@ func TestAccAzureRMAPIManagementNamedValue_basic(t *testing.T) {
Config: testAccAzureRMAPIManagementNamedValue_basic(data),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMAPIManagementNamedValueExists(data.ResourceName),
resource.TestCheckResourceAttr(data.ResourceName, "display_name", fmt.Sprintf("TestProperty%d", data.RandomInteger)),
resource.TestCheckResourceAttr(data.ResourceName, "value", "Test Value"),
resource.TestCheckResourceAttr(data.ResourceName, "tags.0", "tag1"),
resource.TestCheckResourceAttr(data.ResourceName, "tags.1", "tag2"),
),
},
data.ImportStep(),
Expand All @@ -46,24 +42,16 @@ func TestAccAzureRMAPIManagementNamedValue_update(t *testing.T) {
Config: testAccAzureRMAPIManagementNamedValue_basic(data),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMAPIManagementNamedValueExists(data.ResourceName),
resource.TestCheckResourceAttr(data.ResourceName, "display_name", fmt.Sprintf("TestProperty%d", data.RandomInteger)),
resource.TestCheckResourceAttr(data.ResourceName, "value", "Test Value"),
resource.TestCheckResourceAttr(data.ResourceName, "tags.0", "tag1"),
resource.TestCheckResourceAttr(data.ResourceName, "tags.1", "tag2"),
),
},
data.ImportStep(),
{
Config: testAccAzureRMAPIManagementNamedValue_update(data),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMAPIManagementNamedValueExists(data.ResourceName),
resource.TestCheckResourceAttr(data.ResourceName, "display_name", fmt.Sprintf("TestProperty2%d", data.RandomInteger)),
resource.TestCheckResourceAttr(data.ResourceName, "value", "Test Value2"),
resource.TestCheckResourceAttr(data.ResourceName, "secret", "true"),
resource.TestCheckResourceAttr(data.ResourceName, "tags.0", "tag3"),
resource.TestCheckResourceAttr(data.ResourceName, "tags.1", "tag4"),
),
},
data.ImportStep(),
data.ImportStep("value"),
},
})
}
Expand Down