broad-zoo-34077
03/07/2022, 12:45 AMwhite-airport-8778
miniature-megabyte-75526
03/07/2022, 2:25 AMwhite-airport-8778
miniature-megabyte-75526
03/13/2022, 2:50 AMbusy-agent-35515
03/14/2022, 1:18 PMbusy-agent-35515
03/14/2022, 1:24 PMminiature-megabyte-75526
03/14/2022, 2:16 PMbusy-agent-35515
03/14/2022, 3:06 PMwhite-airport-8778
miniature-megabyte-75526
03/14/2022, 3:09 PMminiature-megabyte-75526
03/25/2022, 5:37 PMminiature-megabyte-75526
03/25/2022, 5:38 PMminiature-megabyte-75526
03/25/2022, 5:38 PMARGS="--run TestSentinelDataConnectorAwsCloudTrail -v -update" make test_azure
INFRACOST_LOG_LEVEL=warn go test -timeout 30m -ldflags="-X '<http://github.com/infracost/infracost/internal/version.Version=v0.9.19+53-g898e0213-dirty|github.com/infracost/infracost/internal/version.Version=v0.9.19+53-g898e0213-dirty>'" ./internal/providers/terraform/azure --run TestSentinelDataConnectorAwsCloudTrail -v -update
=== RUN TestSentinelDataConnectorAwsCloudTrailGoldenFile
=== PAUSE TestSentinelDataConnectorAwsCloudTrailGoldenFile
=== CONT TestSentinelDataConnectorAwsCloudTrailGoldenFile
=== RUN TestSentinelDataConnectorAwsCloudTrailGoldenFile/HCL
level=warning msg="Using eastus for resource azurerm_sentinel_data_connector_aws_cloud_trail.sentinel_data_connector_aws_cloud_trail as its 'location' property could not be found."
testutil.go:201: Unexpected log write. To capture logs remove t.Parallel and use GoldenFileOptions { CaptureLogs = true }: level=warning msg="Using eastus for resource azurerm_sentinel_data_connector_aws_cloud_trail.sentinel_data_connector_aws_cloud_trail as its 'location' property could not be found."
testutil.go:177: Wrote golden file testdata/sentinel_data_connector_aws_cloud_trail_test/sentinel_data_connector_aws_cloud_trail_test.golden
=== RUN TestSentinelDataConnectorAwsCloudTrailGoldenFile/Terraform_CLI
level=warning msg="Using eastus for resource azurerm_sentinel_data_connector_aws_cloud_trail.sentinel_data_connector_aws_cloud_trail as its 'location' property could not be found."
testutil.go:201: Unexpected log write. To capture logs remove t.Parallel and use GoldenFileOptions { CaptureLogs = true }: level=warning msg="Using eastus for resource azurerm_sentinel_data_connector_aws_cloud_trail.sentinel_data_connector_aws_cloud_trail as its 'location' property could not be found."
--- FAIL: TestSentinelDataConnectorAwsCloudTrailGoldenFile (10.73s)
--- FAIL: TestSentinelDataConnectorAwsCloudTrailGoldenFile/HCL (0.14s)
--- FAIL: TestSentinelDataConnectorAwsCloudTrailGoldenFile/Terraform_CLI (10.59s)
FAIL
FAIL <http://github.com/infracost/infracost/internal/providers/terraform/azure|github.com/infracost/infracost/internal/providers/terraform/azure> 14.854s
FAIL
make: *** [Makefile:88: test_azure] Error 1miniature-megabyte-75526
03/25/2022, 5:39 PMprovider "azurerm" {
skip_provider_registration = true
features {}
}
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "eastus"
}
# Add example resources for SentinelDataConnectorAwsCloudTrail below
resource "azurerm_log_analytics_workspace" "sentinel_data_connector_aws_cloud_trail" {
name = "example-workspace"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
sku = "PerGB2018"
}
resource "azurerm_log_analytics_solution" "sentinel_data_connector_aws_cloud_trail" {
solution_name = "exampleinsights"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
workspace_resource_id = azurerm_log_analytics_workspace.sentinel_data_connector_aws_cloud_trail.id
workspace_name = azurerm_log_analytics_workspace.sentinel_data_connector_aws_cloud_trail.name
plan {
publisher = "Microsoft"
product = "OMSGallery/SecurityInsights"
}
}
resource "azurerm_sentinel_data_connector_aws_cloud_trail" "sentinel_data_connector_aws_cloud_trail" {
name = "example"
log_analytics_workspace_id = azurerm_log_analytics_solution.sentinel_data_connector_aws_cloud_trail.workspace_resource_id
aws_role_arn = "arn:aws:iam::000000000000:role/role1"
}miniature-megabyte-75526
03/25/2022, 5:41 PMcrooked-daybreak-55253
03/25/2022, 6:12 PMlocation field on the resource, it tries to look it up using a reference to the āparent resourceā (and throws the warning if it canāt find one). So in this case it looks like the parent resource for azurerm_sentinel_data_connector_aws_cloud_trail is referenced through log_analytics_workspace_idcrooked-daybreak-55253
03/25/2022, 6:14 PMlog_analytics_workspace_id as a ReferenceAttribute in the RegistryItem, and passing it to lookupRegion in parentResourceKeyscrooked-daybreak-55253
03/25/2022, 6:15 PMminiature-megabyte-75526
03/25/2022, 6:15 PMlog_analytics_workspace_id as a ReferenceAttribute in the RegistryItem but I may have missed something else?miniature-megabyte-75526
03/25/2022, 6:16 PMfunc getSentinelDataConnectorAwsCloudTrailRegistryItem() *schema.RegistryItem {
return &schema.RegistryItem{
Name: "azurerm_sentinel_data_connector_aws_cloud_trail",
RFunc: newSentinelDataConnectorAwsCloudTrail,
ReferenceAttributes: []string{
"resource_group_name",
"log_analytics_workspace_id",
},
}
}crooked-daybreak-55253
03/25/2022, 6:17 PMregion := lookupRegion(d, []string{"log_analytics_workspace_id"}) too?miniature-megabyte-75526
03/25/2022, 6:18 PMminiature-megabyte-75526
03/25/2022, 6:18 PMminiature-megabyte-75526
03/25/2022, 6:19 PMminiature-megabyte-75526
03/25/2022, 6:19 PMcrooked-daybreak-55253
03/25/2022, 6:20 PMminiature-megabyte-75526
03/25/2022, 6:23 PMcrooked-daybreak-55253
03/25/2022, 6:28 PMcrooked-daybreak-55253
03/25/2022, 6:29 PMminiature-megabyte-75526
03/25/2022, 8:49 PMlog_analytics_workspace . Where am I updating the log_analytics_workspace ? In infracost-usage-example.yml? Or within each of the resource *.usage.yml file within terraform/azure/testdata? From my understanding there is no cost component for the resources.crooked-daybreak-55253
03/25/2022, 9:27 PMmonthly_sentinel_data_ingestion_gb to the azurerm_log_analytics_workspace block in infracost-usage-example.yml so that people know it is available (thatās sort of the documentation for usage costs). And you should add it to terraform/azure/testdata/log_analytics_workspace_test/log_analytics_workspace_test.usage.yml so there is test coverage. I assume you will need to add a new resource block to terraform/azure/testdata/log_analytics_workspace_test/log_analytics_workspace_test.tf with the sentinel enabled.crooked-daybreak-55253
03/25/2022, 9:28 PMFrom my understanding there is no cost component for the resources.Iām not sure what you mean by this ā the task is to add a new
Sentinel data ingestion cost component to internal/resources/azure/log_analytics_workspace.gominiature-megabyte-75526
03/25/2022, 9:30 PMlog_analytics_workspace_id to support reverse references.miniature-megabyte-75526
03/25/2022, 9:42 PMSentinel data ingestion cost component to internal/resources/azure/log_analytics_workspace.gocrooked-daybreak-55253
03/25/2022, 9:43 PMminiature-megabyte-75526
03/25/2022, 9:47 PMcrooked-daybreak-55253
03/25/2022, 9:50 PMinternal/resources/azure/log_analytics_workspace.go . As far as the tests⦠I guess it would be best to have a test case for each sentinel_data_connector resource, so a testdata dir with a .tf file with azurerm_log_analytics_workspace and azurerm_sentinel_data_connector_... resource block pairs. And there would be two cases for each connector resource, one with usage and one without.crooked-daybreak-55253
03/25/2022, 9:51 PMlog_analytics_workspace_test is sufficient.miniature-megabyte-75526
03/25/2022, 9:54 PMminiature-megabyte-75526
04/02/2022, 3:11 AMmake lint and make fmt. After doing this, i noticed there are extra test files. Are these needed to be included with the PR?crooked-daybreak-55253
04/02/2022, 3:14 AMtestdata/⦠directory? it should just be the .tf .golden and .usage.yml files.miniature-megabyte-75526
04/02/2022, 3:16 AMmake lint and make fmt. Mind you, I didn't run this before I started making changes.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: internal/providers/terraform/aws/testdata/glue_job_test/glue_job_test.tf
modified: internal/providers/terraform/aws/testdata/vpc_endpoint_test/vpc_endpoint_test.tf
modified: internal/providers/terraform/azure/testdata/container_registry_test/container_registry_test.tf
modified: internal/providers/terraform/azure/testdata/frontdoor_test/frontdoor_test.tf
modified: internal/providers/terraform/azure/testdata/lb_outbound_rule_test/lb_outbound_rule_test.tfcrooked-daybreak-55253
04/02/2022, 12:46 PMrefactor: make fmt; make lint
I guess we need to add check to our build to ensure the code has been formatted and linted.miniature-megabyte-75526
04/21/2022, 12:16 AMSentinelEnabled: sentinelEnabled at the bottom of the file, and I received an error, with this piece of code. I received an error invalid argument: ref (variable of type int) for lencompilerInvalidLen). I'm still learning the Go language, so this error kind of stumped me a little bit. Any suggestions?
sentinelEnabled := false
for ref, _ := range sentinelRefs {
if len(ref) > 0 {
sentinelEnabled = true
break
}
}busy-agent-35515
04/21/2022, 10:12 AMfor _, ref as the first argument is integer index, and second one is the struct.busy-agent-35515
04/21/2022, 10:14 AMminiature-megabyte-75526
04/28/2022, 1:25 PMbusy-agent-35515
04/28/2022, 1:29 PMminiature-megabyte-75526
04/28/2022, 1:36 PM