-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Test Alert Channels during TF Create (#133)
https://lacework.atlassian.net/browse/ALLY-331 *Example of adding Test Integration to TF Create of Alert Channels Alert Channel resources run "Test Integration" `v2/AlertChannels/IntGuid/test` during Terraform Create. The resource is deleted upon failing the Test. Skip running the Test Integration with `test_integration` flag ``` resource "lacework_alert_channel_datadog" "example" { name = var.channel_name ... test_integration = true } ``` Signed-off-by: Darren Murray <darren.murray@lacework.net>
- Loading branch information
1 parent
e359b88
commit 3df183d
Showing
22 changed files
with
311 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package lacework | ||
|
||
import ( | ||
"github.com/pkg/errors" | ||
|
||
"github.com/lacework/go-sdk/api" | ||
) | ||
|
||
// VerifyAlertChannel tests the integration of an alert channel | ||
func VerifyAlertChannel(id string, lacework *api.Client) error { | ||
if err := lacework.V2.AlertChannels.Test(id); err != nil { | ||
// rollback terraform create upon error testing integration | ||
if deleteErr := lacework.V2.AlertChannels.Delete(id); deleteErr != nil { | ||
return errors.Wrapf(deleteErr, "Unable to rollback changes: %v", err) | ||
} | ||
return err | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.