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

fix: issue-10386 #5461

Merged
merged 1 commit into from
Nov 18, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mmv1/products/essentialcontacts/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ objects:
The identifier for the contact. Format: {resourceType}/{resource_id}/contacts/{contact_id}
- !ruby/object:Api::Type::String
name: 'email'
input: true
required: true
description: |
The email address to send notifications to. This does not need to be a Google account.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package google

import (
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccEssentialContactsContact_update(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"random_suffix": randString(t, 10),
}

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckEssentialContactsContactDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccEssentialContactsContact_v1(context),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("google_essential_contacts_contact.contact",
"email", "[email protected]"),
),
},
{
ResourceName: "google_essential_contacts_contact.contact",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"parent"},
},
{
Config: testAccEssentialContactsContact_v2(context),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("google_essential_contacts_contact.contact",
"email", "[email protected]"),
),
},
{
ResourceName: "google_essential_contacts_contact.contact",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"parent"},
},
},
})
}

func testAccEssentialContactsContact_v1(context map[string]interface{}) string {
return Nprintf(`
data "google_project" "project" {
}
resource "google_essential_contacts_contact" "contact" {
parent = data.google_project.project.id
email = "[email protected]"
language_tag = "en-GB"
notification_category_subscriptions = ["ALL"]
}
`, context)
}

func testAccEssentialContactsContact_v2(context map[string]interface{}) string {
return Nprintf(`
data "google_project" "project" {
}
resource "google_essential_contacts_contact" "contact" {
parent = data.google_project.project.id
email = "[email protected]"
language_tag = "en-GB"
notification_category_subscriptions = ["ALL"]
}
`, context)
}