-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Trying to fix Issue #18971 #18999
Trying to fix Issue #18971 #18999
Conversation
….com:sinc59/terraform-provider-azurerm into issue_18971_security_center_contact_resource
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR @sinc59, unfortunately it looks like we have a test failure:
------- Stdout: -------
=== RUN TestAccSecurityCenterContact
=== RUN TestAccSecurityCenterContact/contact
=== RUN TestAccSecurityCenterContact/contact/update
testcase.go:117: ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected.
(map[string]string) {
}
(map[string]string) (len=1) {
(string) (len=4) "name": (string) (len=12) "test-account"
}
=== RUN TestAccSecurityCenterContact/contact/requiresImport
testcase.go:117: Step 2/2, expected an error but got none
=== RUN TestAccSecurityCenterContact/contact/phoneOptional
testcase.go:117: ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected.
(map[string]string) {
}
(map[string]string) (len=1) {
(string) (len=4) "name": (string) (len=12) "test-account"
}
=== RUN TestAccSecurityCenterContact/contact/basic
testcase.go:117: ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected.
(map[string]string) {
}
(map[string]string) (len=1) {
(string) (len=4) "name": (string) (len=12) "test-account"
}
--- FAIL: TestAccSecurityCenterContact (497.63s)
--- FAIL: TestAccSecurityCenterContact/contact (497.63s)
--- FAIL: TestAccSecurityCenterContact/contact/update (165.09s)
--- FAIL: TestAccSecurityCenterContact/contact/requiresImport (158.78s)
--- FAIL: TestAccSecurityCenterContact/contact/phoneOptional (86.93s)
--- FAIL: TestAccSecurityCenterContact/contact/basic (86.83s)
FAIL
HI @stephybun
I don't know why i get this error, after a manual import of the ressource, i get the contact name in the state ressource. Sébastien |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @sinc59 - looks like we have a test failure (by not failing)
------- Stdout: -------
=== RUN TestAccSecurityCenterContact
=== RUN TestAccSecurityCenterContact/contact
=== RUN TestAccSecurityCenterContact/contact/basic
=== RUN TestAccSecurityCenterContact/contact/update
=== RUN TestAccSecurityCenterContact/contact/requiresImport
testcase.go:117: Step 2/2, expected an error but got none
=== RUN TestAccSecurityCenterContact/contact/phoneOptional
--- FAIL: TestAccSecurityCenterContact (477.09s)
--- FAIL: TestAccSecurityCenterContact/contact (477.09s)
--- PASS: TestAccSecurityCenterContact/contact/basic (94.99s)
--- PASS: TestAccSecurityCenterContact/contact/update (150.93s)
--- FAIL: TestAccSecurityCenterContact/contact/requiresImport (146.30s)
--- PASS: TestAccSecurityCenterContact/contact/phoneOptional (84.87s)
FAIL
@@ -42,6 +36,13 @@ func resourceSecurityCenterContact() *pluginsdk.Resource { | |||
}, | |||
|
|||
Schema: map[string]*pluginsdk.Schema{ | |||
"name": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we are adding this property we'll need to update the docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely, i have not yet run the scaffold website command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the docs still need updating & we'll need to make this Optional/Defaulted in 3.x / make this Required in 4.0 since otherwise this is a breaking change
@sinc59 the test that's currently failing is expecting an error from this line terraform-provider-azurerm/internal/services/securitycenter/security_center_contact_resource.go Line 89 in d1b0da6
So something is amiss within that block. Also if my understanding is correct it's possible to create multiple contacts with custom names now? This means we can split the tests out instead of grouping them which will make it possible to run them individually and might help with debugging the issue. |
Yes @stephybun we can set multiple contacts with custom names. But it's certainly a misapprehension from my part. Sébastien |
Just to clarify, the |
8e221e0
to
fbb9951
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left one comment inline but otherwise 👍
@@ -42,6 +36,13 @@ func resourceSecurityCenterContact() *pluginsdk.Resource { | |||
}, | |||
|
|||
Schema: map[string]*pluginsdk.Schema{ | |||
"name": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the docs still need updating & we'll need to make this Optional/Defaulted in 3.x / make this Required in 4.0 since otherwise this is a breaking change
This functionality has been released in v3.30.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
A PR to trying to fix the issue #18971.
Add the name argument and the ability to add one or more ressources with non-hardcoded contact name.
The API REST accept one or more contacts and the name "default1" is not anymore required see documentation.
Testing on an azure account:
Result (using the azure cli to list accounts):
Best regards,
Sébastien Caloone