@@ -22,14 +22,20 @@ func Test_adaptContact(t *testing.T) {
2222 name : "defined" ,
2323 terraform : `
2424 resource "azurerm_security_center_contact" "example" {
25+ email = "contact@example.com"
2526 phone = "+1-555-555-5555"
2627 alert_notifications = true
28+ alerts_to_admins = true
2729 }
2830` ,
2931 expected : securitycenter.Contact {
3032 Metadata : iacTypes .NewTestMetadata (),
3133 EnableAlertNotifications : iacTypes .Bool (true , iacTypes .NewTestMetadata ()),
34+ EnableAlertsToAdmins : iacTypes .Bool (true , iacTypes .NewTestMetadata ()),
35+ Email : iacTypes .String ("contact@example.com" , iacTypes .NewTestMetadata ()),
3236 Phone : iacTypes .String ("+1-555-555-5555" , iacTypes .NewTestMetadata ()),
37+ IsEnabled : iacTypes.BoolValue {},
38+ MinimalSeverity : iacTypes.StringValue {},
3339 },
3440 },
3541 {
@@ -41,7 +47,11 @@ func Test_adaptContact(t *testing.T) {
4147 expected : securitycenter.Contact {
4248 Metadata : iacTypes .NewTestMetadata (),
4349 EnableAlertNotifications : iacTypes .Bool (false , iacTypes .NewTestMetadata ()),
50+ EnableAlertsToAdmins : iacTypes .Bool (false , iacTypes .NewTestMetadata ()),
51+ Email : iacTypes .String ("" , iacTypes .NewTestMetadata ()),
4452 Phone : iacTypes .String ("" , iacTypes .NewTestMetadata ()),
53+ IsEnabled : iacTypes.BoolValue {},
54+ MinimalSeverity : iacTypes.StringValue {},
4555 },
4656 },
4757 }
@@ -107,8 +117,10 @@ func Test_adaptSubscription(t *testing.T) {
107117func TestLines (t * testing.T ) {
108118 src := `
109119 resource "azurerm_security_center_contact" "example" {
120+ email = "contact@example.com"
110121 phone = "+1-555-555-5555"
111122 alert_notifications = true
123+ alerts_to_admins = true
112124 }
113125
114126 resource "azurerm_security_center_subscription_pricing" "example" {
@@ -124,12 +136,18 @@ func TestLines(t *testing.T) {
124136 contact := adapted .Contacts [0 ]
125137 sub := adapted .Subscriptions [0 ]
126138
127- assert .Equal (t , 3 , contact .Phone .GetMetadata ().Range ().GetStartLine ())
128- assert .Equal (t , 3 , contact .Phone .GetMetadata ().Range ().GetEndLine ())
139+ assert .Equal (t , 3 , contact .Email .GetMetadata ().Range ().GetStartLine ())
140+ assert .Equal (t , 3 , contact .Email .GetMetadata ().Range ().GetEndLine ())
129141
130- assert .Equal (t , 4 , contact .EnableAlertNotifications .GetMetadata ().Range ().GetStartLine ())
131- assert .Equal (t , 4 , contact .EnableAlertNotifications .GetMetadata ().Range ().GetEndLine ())
142+ assert .Equal (t , 4 , contact .Phone .GetMetadata ().Range ().GetStartLine ())
143+ assert .Equal (t , 4 , contact .Phone .GetMetadata ().Range ().GetEndLine ())
132144
133- assert .Equal (t , 8 , sub .Tier .GetMetadata ().Range ().GetStartLine ())
134- assert .Equal (t , 8 , sub .Tier .GetMetadata ().Range ().GetEndLine ())
145+ assert .Equal (t , 5 , contact .EnableAlertNotifications .GetMetadata ().Range ().GetStartLine ())
146+ assert .Equal (t , 5 , contact .EnableAlertNotifications .GetMetadata ().Range ().GetEndLine ())
147+
148+ assert .Equal (t , 6 , contact .EnableAlertsToAdmins .GetMetadata ().Range ().GetStartLine ())
149+ assert .Equal (t , 6 , contact .EnableAlertsToAdmins .GetMetadata ().Range ().GetEndLine ())
150+
151+ assert .Equal (t , 10 , sub .Tier .GetMetadata ().Range ().GetStartLine ())
152+ assert .Equal (t , 10 , sub .Tier .GetMetadata ().Range ().GetEndLine ())
135153}
0 commit comments