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

SUMO-245309 Add the terraform support for Azure metric sources #710

Merged
merged 12 commits into from
Jan 23, 2025

Conversation

yuting-liu
Copy link
Contributor

@yuting-liu yuting-liu commented Jan 6, 2025

In this PR, we added the terraform support for Azure metrics sources.

Changes

  1. Added new authentication type used by Azure metrics sources. Eg:
authentication {
  type = "AzureClientSecretAuthentication"
  tenant_id = "<azure_tenant_id>"
  client_id = "<azure_client_id>"
  client_secret = "<azure_client_id>"
}
  1. Added new path type used by Azure metric sources.
path {
	type = "AzureMetricsPath"
	environment = "Azure"
	limit_to_namespaces = ["Microsoft.ClassicStorage/storageAccounts"]
	azure_tag_filters {
		type = "AzureTagFilters"
		namespace = "Microsoft.ClassicStorage/storageAccounts"
		tags {
			name = "test-name-1"
			values = ["value1", "value2"]
		}
	}
}

One thing to mention here for TagFilters field in Azure metrics sources, we added a new azure_tag_filters instead of using the same tag_filters as CloudWatch sources and kinesis metrics sources. The major reason is that for tags, the schemas are different and it requires to have a detailed schema definition in terraform world, which is why we added this new field. And for azure_tag_filters, we required type = "AzureTagFilters" to be required.

Test

  • Added the unit test for azure metrics source
  • Run the test locally
--- PASS: TestAccSumologicAzureMetricsSource_create (4.36s)
PASS
ok  	github.com/SumoLogic/terraform-provider-sumologic/sumologic	4.891s
--- PASS: TestAccSumologicAzureMetricsSource_update (5.58s)
PASS
ok  	github.com/SumoLogic/terraform-provider-sumologic/sumologic	6.100s
  • However Tests / Matrix Test (1.0.3) (pull_request) are not passing with the following error:
  
  Error: ***
    "status" : 400,
    "id" : "57TBO-MK628-NNH3R",
    "code" : "collectors.validation.fields.invalid",
    "message" : "Permission denied for Azure API: 'reason=Self-suppression not permitted'."
  ***

The reason is that we need to ask the terraform team to help us to configure the following secrets for the test to run:

        SUMOLOGIC_TEST_AZURE_TENANT_ID:  ${{ secrets.SUMOLOGIC_TEST_AZURE_TENANT_ID }}
        SUMOLOGIC_TEST_AZURE_CLIENT_ID:  ${{ secrets.SUMOLOGIC_TEST_AZURE_CLIENT_ID }}
        SUMOLOGIC_TEST_AZURE_CLIENT_SECRET:  ${{ secrets.SUMOLOGIC_TEST_AZURE_CLIENT_SECRET }}

I'll work with the team on fixing it: slack: #terraform-team

@yuting-liu yuting-liu force-pushed the yuting-SUMO-245309-terraform-support branch 4 times, most recently from f59c28c to 68ade3d Compare January 7, 2025 18:41
@yuting-liu yuting-liu force-pushed the yuting-SUMO-245309-terraform-support branch from 68ade3d to 5397700 Compare January 8, 2025 00:31
@yuting-liu yuting-liu force-pushed the yuting-SUMO-245309-terraform-support branch 2 times, most recently from de76dfc to 9ccf1a2 Compare January 9, 2025 18:34
@yuting-liu yuting-liu force-pushed the yuting-SUMO-245309-terraform-support branch 6 times, most recently from 2a5c0b5 to a10c426 Compare January 13, 2025 10:00
@yuting-liu yuting-liu force-pushed the yuting-SUMO-245309-terraform-support branch from a10c426 to df9b4b0 Compare January 13, 2025 18:51
@yuting-liu yuting-liu force-pushed the yuting-SUMO-245309-terraform-support branch from 9606f54 to c0deeeb Compare January 14, 2025 00:21
@yuting-liu yuting-liu marked this pull request as ready for review January 14, 2025 01:17
@yuting-liu yuting-liu requested review from maimaisie, vsinghal13 and a team as code owners January 14, 2025 01:17
@yuting-liu yuting-liu requested a review from samjsong January 14, 2025 01:18
@yuting-liu yuting-liu added the collection Item is related to data collection aspect of Sumo Logic. label Jan 14, 2025
CHANGELOG.md Outdated Show resolved Hide resolved
@yuting-liu
Copy link
Contributor Author

@ErikAtSumo The current the unit test failure is about the azure event hub sources, which irrelevant with the changes in this PR. Can you please help to try to merge this PR?

@ErikAtSumo
Copy link
Collaborator

@ErikAtSumo The current the unit test failure is about the azure event hub sources, which irrelevant with the changes in this PR. Can you please help to try to merge this PR?

Hi @yuting-liu , I'll have a look now.

@ErikAtSumo
Copy link
Collaborator

@ErikAtSumo The current the unit test failure is about the azure event hub sources, which irrelevant with the changes in this PR. Can you please help to try to merge this PR?

@yuting-liu Indeed, these tests are also failing on master for the same reason. I'll merge this PR and figure it out separately.

@ErikAtSumo
Copy link
Collaborator

@yuting-liu would you please correct the conflict in CHANGELOG.md ?

@yuting-liu
Copy link
Contributor Author

@ErikAtSumo I've already corrected the Changelog.md and put the new resource under UNRELEASED section

@ErikAtSumo ErikAtSumo merged commit 5a1e5b0 into master Jan 23, 2025
5 checks passed
@ErikAtSumo ErikAtSumo deleted the yuting-SUMO-245309-terraform-support branch January 23, 2025 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
collection Item is related to data collection aspect of Sumo Logic.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants