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

Add table azure_security_center_automation closes #469 #481

Merged
merged 3 commits into from
May 4, 2022

Conversation

ParthaI
Copy link
Contributor

@ParthaI ParthaI commented Apr 28, 2022

Integration test logs

Logs
No env file present for the current environment:  staging 
 Falling back to .env config
No env file present for the current environment:  staging
customEnv TURBOT_TEST_EXPECTED_TIMEOUT undefined

SETUP: tests/azure_security_center_automation []

PRETEST: tests/azure_security_center_automation

TEST: tests/azure_security_center_automation
Running terraform
data.azurerm_client_config.current: Refreshing state...
data.null_data_source.resource: Refreshing state...
azurerm_resource_group.named_test_resource: Creating...
azurerm_resource_group.named_test_resource: Creation complete after 3s [id=/subscriptions/d46d7416-f95f-4771-bbb5-529d4c345du3/resourceGroups/turbottest77421]
azurerm_eventhub_namespace.named_test_resource: Creating...
azurerm_eventhub_namespace.named_test_resource: Still creating... [10s elapsed]
azurerm_eventhub_namespace.named_test_resource: Still creating... [20s elapsed]
azurerm_eventhub_namespace.named_test_resource: Still creating... [30s elapsed]
azurerm_eventhub_namespace.named_test_resource: Still creating... [40s elapsed]
azurerm_eventhub_namespace.named_test_resource: Still creating... [50s elapsed]
azurerm_eventhub_namespace.named_test_resource: Still creating... [1m0s elapsed]
azurerm_eventhub_namespace.named_test_resource: Still creating... [1m10s elapsed]
azurerm_eventhub_namespace.named_test_resource: Creation complete after 1m15s [id=/subscriptions/d46d7416-f95f-4771-bbb5-529d4c345du3/resourceGroups/turbottest77421/providers/Microsoft.EventHub/namespaces/turbottest77421]
azurerm_eventhub.named_test_resource: Creating...
azurerm_eventhub.named_test_resource: Creation complete after 9s [id=/subscriptions/d46d7416-f95f-4771-bbb5-529d4c345du3/resourceGroups/turbottest77421/providers/Microsoft.EventHub/namespaces/turbottest77421/eventhubs/turbottest77421]
azurerm_eventhub_authorization_rule.named_test_resource: Creating...
azurerm_eventhub_authorization_rule.named_test_resource: Still creating... [10s elapsed]
azurerm_eventhub_authorization_rule.named_test_resource: Creation complete after 10s [id=/subscriptions/d46d7416-f95f-4771-bbb5-529d4c345du3/resourceGroups/turbottest77421/providers/Microsoft.EventHub/namespaces/turbottest77421/eventhubs/turbottest77421/authorizationRules/turbottest77421]
azurerm_security_center_automation.named_test_resource: Creating...
azurerm_security_center_automation.named_test_resource: Creation complete after 10s [id=/subscriptions/d46d7416-f95f-4771-bbb5-529d4c345du3/resourcegroups/turbottest77421/providers/Microsoft.Security/automations/turbottest77421]

Warning: Deprecated Resource

  on variables.tf line 30, in data "null_data_source" "resource":
  30: data "null_data_source" "resource" {

The null_data_source was historically used to construct intermediate values to
re-use elsewhere in configuration, the same can now be achieved using locals


Apply complete! Resources: 5 added, 0 changed, 0 destroyed.

Outputs:

resource_aka = azure:///subscriptions/d46d7416-f95f-4771-bbb5-529d4c345du3/resourcegroups/turbottest77421/providers/Microsoft.Security/automations/turbottest77421
resource_aka_lower = azure:///subscriptions/d46d7416-f95f-4771-bbb5-529d4c345du3/resourcegroups/turbottest77421/providers/microsoft.security/automations/turbottest77421
resource_id = /subscriptions/d46d7416-f95f-4771-bbb5-529d4c345du3/resourcegroups/turbottest77421/providers/Microsoft.Security/automations/turbottest77421
resource_name = turbottest77421
subscription_id = d46d7416-f95f-4771-bbb5-529d4c345du3

Running SQL query: test-get-query.sql
[
  {
    "id": "/subscriptions/d46d7416-f95f-4771-bbb5-529d4c345du3/resourcegroups/turbottest77421/providers/Microsoft.Security/automations/turbottest77421",
    "name": "turbottest77421"
  }
]
✔ PASSED

Running SQL query: test-list-query.sql
[
  {
    "id": "/subscriptions/d46d7416-f95f-4771-bbb5-529d4c345du3/resourcegroups/turbottest77421/providers/Microsoft.Security/automations/turbottest77421",
    "name": "turbottest77421"
  }
]
✔ PASSED

Running SQL query: test-not-found-query.sql
null
✔ PASSED

Running SQL query: test-turbot-query.sql
[
  {
    "akas": [
      "azure:///subscriptions/d46d7416-f95f-4771-bbb5-529d4c345du3/resourcegroups/turbottest77421/providers/Microsoft.Security/automations/turbottest77421",
      "azure:///subscriptions/d46d7416-f95f-4771-bbb5-529d4c345du3/resourcegroups/turbottest77421/providers/microsoft.security/automations/turbottest77421"
    ],
    "name": "turbottest77421",
    "title": "turbottest77421"
  }
]
✔ PASSED

POSTTEST: tests/azure_security_center_automation

TEARDOWN: tests/azure_security_center_automation

SUMMARY:

1/1 passed.

Example query results

Results
> select
  name,
  type,
  s ->> 'eventSource' as event_source,
  r ->> 'operator' as operator,
  r ->> 'propertyType' as property_type,
  r ->> 'expectedValue' as expected_value,
  r ->> 'propertyJPath' as property_jpath
from
  azure_security_center_automation,
  jsonb_array_elements(sources) as s,
  jsonb_array_elements(s -> 'ruleSets') as rs,
  jsonb_array_elements(rs -> 'rules') as r ;
+--------+--------------------------------+--------------+----------+---------------+----------------+------------------------------+
| name   | type                           | event_source | operator | property_type | expected_value | property_jpath               |
+--------+--------------------------------+--------------+----------+---------------+----------------+------------------------------+
| test12 | Microsoft.Security/automations | Assessments  | Equals   | String        | High           | properties.metadata.severity |
+--------+--------------------------------+--------------+----------+---------------+----------------+------------------------------+
> select
  id,
  name,
  type,
  kind
from
   azure_security_center_automation;
+------------------------------------------------------------------------------------------------------------------------------+--------+--------------------------------+------
| id                                                                                                                           | name   | type                           | kind 
+------------------------------------------------------------------------------------------------------------------------------+--------+--------------------------------+------
| /subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourcegroups/turbot_rg/providers/Microsoft.Security/automations/test12 | test12 | Microsoft.Security/automations | <null
+------------------------------------------------------------------------------------------------------------------------------+--------+--------------------------------+------
> select
  id,
  name,
  type,
  is_enabled
from
  azure_security_center_automation
where is_enabled;
+------------------------------------------------------------------------------------------------------------------------------+--------+--------------------------------+------
| id                                                                                                                           | name   | type                           | is_en
+------------------------------------------------------------------------------------------------------------------------------+--------+--------------------------------+------
| /subscriptions/d46d7416-f95f-4771-bbb5-529d4c674hd3/resourcegroups/turbot_rg/providers/Microsoft.Security/automations/test12 | test12 | Microsoft.Security/automations | true 
+------------------------------------------------------------------------------------------------------------------------------+--------+--------------------------------+------

@ParthaI ParthaI self-assigned this Apr 28, 2022
@ParthaI ParthaI linked an issue Apr 28, 2022 that may be closed by this pull request
Copy link
Contributor

@bigdatasourav bigdatasourav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bigdatasourav bigdatasourav merged commit f183741 into main May 4, 2022
@bigdatasourav bigdatasourav deleted the issue-469 branch May 4, 2022 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add table azure_security_center_automation
2 participants