From 0c85f892c5db68c76cc11fa0a3ef67be50399dd9 Mon Sep 17 00:00:00 2001 From: Salim Afiune Date: Thu, 21 Jul 2022 09:23:53 -0700 Subject: [PATCH] test: Use unique API token for all integration tests (#347) Signed-off-by: Salim Afiune Maya --- integration/integration.go | 15 +++++++++++++++ .../resource_lacework_agent_access_token_test.go | 2 ++ ..._lacework_alert_channel_aws_cloudwatch_test.go | 1 + ...resource_lacework_alert_channel_aws_s3_test.go | 1 + ...rce_lacework_alert_channel_cisco_webex_test.go | 1 + ...esource_lacework_alert_channel_datadog_test.go | 1 + .../resource_lacework_alert_channel_email_test.go | 1 + ...rce_lacework_alert_channel_gcp_pub_sub_test.go | 2 ++ ...urce_lacework_alert_channel_ibm_qradar_test.go | 1 + ...urce_lacework_alert_channel_jira_cloud_test.go | 1 + ...rce_lacework_alert_channel_jira_server_test.go | 1 + ...lacework_alert_channel_microsoft_teams_test.go | 1 + .../resource_lacework_alert_channel_slack_test.go | 1 + ...esource_lacework_alert_channel_webhook_test.go | 1 + .../resource_lacework_alert_profile_test.go | 2 ++ integration/resource_lacework_alert_rule_test.go | 3 +++ ...lacework_integration_aws_eks_audit_log_test.go | 1 + .../resource_lacework_integration_ecr_test.go | 3 +++ .../resource_lacework_integration_gar_test.go | 1 + ...lacework_integration_gcp_gke_audit_log_test.go | 1 + .../resource_lacework_integration_ghcr_test.go | 1 + ...resource_lacework_integration_newrelic_test.go | 1 + ...esource_lacework_integration_pagerduty_test.go | 1 + ...ource_lacework_integration_service_now_test.go | 1 + .../resource_lacework_integration_splunk_test.go | 1 + ...esource_lacework_integration_victorops_test.go | 1 + .../resource_lacework_policy_exception_test.go | 1 + integration/resource_lacework_policy_test.go | 1 + integration/resource_lacework_query_test.go | 1 + integration/resource_lacework_report_rule_test.go | 1 + ...source_lacework_resource_group_account_test.go | 1 + .../resource_lacework_resource_group_aws_test.go | 1 + ...resource_lacework_resource_group_azure_test.go | 1 + ...urce_lacework_resource_group_container_test.go | 1 + .../resource_lacework_resource_group_gcp_test.go | 1 + ...source_lacework_resource_group_machine_test.go | 1 + integration/resource_lacework_team_member_test.go | 2 ++ ...work_vulnerability_exception_container_test.go | 1 + ..._lacework_vulnerability_exception_host_test.go | 1 + integration/rollback_alert_channel_test.go | 1 + 40 files changed, 62 insertions(+) diff --git a/integration/integration.go b/integration/integration.go index 4c24b2eb4..b8cb9dfc2 100644 --- a/integration/integration.go +++ b/integration/integration.go @@ -11,11 +11,26 @@ import ( var ( LwClient *api.Client LwOrgClient *api.Client + LwApiToken string + tokenEnvVar map[string]string ) func init() { LwClient = lwTestCLient() LwOrgClient = lwOrgTestClient() + LwApiToken = generateUniqueApiToken() + tokenEnvVar = map[string]string{ + "LW_API_TOKEN": LwApiToken, + } +} + +func generateUniqueApiToken() string { + token, err := LwClient.GenerateToken() + if err != nil { + log.Fatalf("Failed to generate API token, %v", err) + } + + return token.Token } func lwTestCLient() (lw *api.Client) { diff --git a/integration/resource_lacework_agent_access_token_test.go b/integration/resource_lacework_agent_access_token_test.go index ba0c3a173..51743d738 100644 --- a/integration/resource_lacework_agent_access_token_test.go +++ b/integration/resource_lacework_agent_access_token_test.go @@ -18,6 +18,7 @@ func TestAgentAccessTokenCreate(t *testing.T) { // Create new Agent Access Token terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_agent_access_token", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "token_name": tokenName, }, @@ -31,6 +32,7 @@ func TestAgentAccessTokenCreate(t *testing.T) { // Read Agent Access Token dataTerraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/data_source_lacework_agent_access_token", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "token_name": tokenName, }}) diff --git a/integration/resource_lacework_alert_channel_aws_cloudwatch_test.go b/integration/resource_lacework_alert_channel_aws_cloudwatch_test.go index f4b87e9e0..9eed80281 100644 --- a/integration/resource_lacework_alert_channel_aws_cloudwatch_test.go +++ b/integration/resource_lacework_alert_channel_aws_cloudwatch_test.go @@ -21,6 +21,7 @@ func TestAlertChannelCloudWatchCreate(t *testing.T) { }, EnvVars: map[string]string{ "TF_VAR_event_bus_arn": eventBusArn, + "LW_API_TOKEN": LwApiToken, }, }) defer terraform.Destroy(t, terraformOptions) diff --git a/integration/resource_lacework_alert_channel_aws_s3_test.go b/integration/resource_lacework_alert_channel_aws_s3_test.go index f4ef9b136..5ed1c616b 100644 --- a/integration/resource_lacework_alert_channel_aws_s3_test.go +++ b/integration/resource_lacework_alert_channel_aws_s3_test.go @@ -24,6 +24,7 @@ func TestAlertChannelAwsS3Create(t *testing.T) { }, EnvVars: map[string]string{ "TF_VAR_bucket_arn": s3BucketArn, + "LW_API_TOKEN": LwApiToken, }, }) defer terraform.Destroy(t, terraformOptions) diff --git a/integration/resource_lacework_alert_channel_cisco_webex_test.go b/integration/resource_lacework_alert_channel_cisco_webex_test.go index 1fa338c4a..14ad3bd5a 100644 --- a/integration/resource_lacework_alert_channel_cisco_webex_test.go +++ b/integration/resource_lacework_alert_channel_cisco_webex_test.go @@ -15,6 +15,7 @@ import ( func TestAlertChannelCiscoWebexCreate(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_alert_channel_cisco_webex", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "channel_name": "Cisco Webex Alert Channel Example", "webhook_url": "https://webexapis.com/v1/webhooks/incoming/api-token", diff --git a/integration/resource_lacework_alert_channel_datadog_test.go b/integration/resource_lacework_alert_channel_datadog_test.go index 54e13e5db..2a40694a4 100644 --- a/integration/resource_lacework_alert_channel_datadog_test.go +++ b/integration/resource_lacework_alert_channel_datadog_test.go @@ -14,6 +14,7 @@ func TestDatadogAlertChannelCreate(t *testing.T) { apiKey := "vatasha-fake-dd-api-key" terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_alert_channel_datadog", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "channel_name": "Datadog Alert Channel Example", "datadog_site": "com", diff --git a/integration/resource_lacework_alert_channel_email_test.go b/integration/resource_lacework_alert_channel_email_test.go index 8121c3a5e..35fe6b625 100644 --- a/integration/resource_lacework_alert_channel_email_test.go +++ b/integration/resource_lacework_alert_channel_email_test.go @@ -15,6 +15,7 @@ import ( func TestAlertChannelEmailCreate(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_alert_channel_email", + EnvVars: tokenEnvVar, }) defer terraform.Destroy(t, terraformOptions) diff --git a/integration/resource_lacework_alert_channel_gcp_pub_sub_test.go b/integration/resource_lacework_alert_channel_gcp_pub_sub_test.go index 7a48f3a16..eb15631ce 100644 --- a/integration/resource_lacework_alert_channel_gcp_pub_sub_test.go +++ b/integration/resource_lacework_alert_channel_gcp_pub_sub_test.go @@ -28,6 +28,7 @@ func TestAlertChannelGcpPubSubCreate(t *testing.T) { }, EnvVars: map[string]string{ "TF_VAR_private_key": gcreds.PrivateKey, + "LW_API_TOKEN": LwApiToken, }, }) defer terraform.Destroy(t, terraformOptions) @@ -48,6 +49,7 @@ func TestAlertChannelGcpPubSubCreate(t *testing.T) { } terraformOptions.EnvVars = map[string]string{ "TF_VAR_private_key": gcreds.PrivateKey, + "LW_API_TOKEN": LwApiToken, } update := terraform.ApplyAndIdempotent(t, terraformOptions) diff --git a/integration/resource_lacework_alert_channel_ibm_qradar_test.go b/integration/resource_lacework_alert_channel_ibm_qradar_test.go index 1f7b3df0d..792eaaee1 100644 --- a/integration/resource_lacework_alert_channel_ibm_qradar_test.go +++ b/integration/resource_lacework_alert_channel_ibm_qradar_test.go @@ -13,6 +13,7 @@ import ( func TestIbmQRadarAlertChannelCreate(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_alert_channel_qradar", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "channel_name": "IbmQRadar Alert Channel Example", "host_url": "https://qradar-lacework.com", diff --git a/integration/resource_lacework_alert_channel_jira_cloud_test.go b/integration/resource_lacework_alert_channel_jira_cloud_test.go index d2f5c6031..dad470a0f 100644 --- a/integration/resource_lacework_alert_channel_jira_cloud_test.go +++ b/integration/resource_lacework_alert_channel_jira_cloud_test.go @@ -15,6 +15,7 @@ import ( func TestAlertChannelJiraCloudCreate(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_alert_channel_jira_cloud", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "channel_name": "My Jira Cloud Example", "jira_url": "test-lacework.atlassian.net", diff --git a/integration/resource_lacework_alert_channel_jira_server_test.go b/integration/resource_lacework_alert_channel_jira_server_test.go index 5945ee1f2..4bc67ff00 100644 --- a/integration/resource_lacework_alert_channel_jira_server_test.go +++ b/integration/resource_lacework_alert_channel_jira_server_test.go @@ -15,6 +15,7 @@ import ( func TestAlertChannelJiraServerCreate(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_alert_channel_jira_server", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "channel_name": "My Jira Server Example", "jira_url": "test-lacework.atlassian.net", diff --git a/integration/resource_lacework_alert_channel_microsoft_teams_test.go b/integration/resource_lacework_alert_channel_microsoft_teams_test.go index 759cfc7b0..5df3f0f00 100644 --- a/integration/resource_lacework_alert_channel_microsoft_teams_test.go +++ b/integration/resource_lacework_alert_channel_microsoft_teams_test.go @@ -15,6 +15,7 @@ import ( func TestAlertChannelMicrosoftTeams(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_alert_channel_microsoft_teams", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "channel_name": "Test Name", "webhook_url": "https://outlook.office.com/webhook/api-token", diff --git a/integration/resource_lacework_alert_channel_slack_test.go b/integration/resource_lacework_alert_channel_slack_test.go index 98b73adb1..45309d5d3 100644 --- a/integration/resource_lacework_alert_channel_slack_test.go +++ b/integration/resource_lacework_alert_channel_slack_test.go @@ -15,6 +15,7 @@ import ( func TestAlertChannelSlackCreate(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_alert_channel_slack", + EnvVars: tokenEnvVar, }) defer terraform.Destroy(t, terraformOptions) diff --git a/integration/resource_lacework_alert_channel_webhook_test.go b/integration/resource_lacework_alert_channel_webhook_test.go index 8bfda9f56..8d11f3d16 100644 --- a/integration/resource_lacework_alert_channel_webhook_test.go +++ b/integration/resource_lacework_alert_channel_webhook_test.go @@ -13,6 +13,7 @@ import ( func TestWebhookAlertChannelCreate(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_alert_channel_webhook", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "channel_name": "Webhook Alert Channel Example", "webhook_url": "https://hook.com/webhook?api-token=123", diff --git a/integration/resource_lacework_alert_profile_test.go b/integration/resource_lacework_alert_profile_test.go index 6a371a6bc..8bcc56bd8 100644 --- a/integration/resource_lacework_alert_profile_test.go +++ b/integration/resource_lacework_alert_profile_test.go @@ -15,6 +15,7 @@ import ( func TestAlertProfileCreate(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_alert_profile", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "name": "CUSTOM_PROFILE_TERRAFORM_TEST", "extends": "LW_CFG_GCP_DEFAULT_PROFILE", @@ -65,6 +66,7 @@ func TestAlertProfileCreate(t *testing.T) { func TestAlertProfileValidate(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_alert_profile", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "name": "LW_PROFILE_TERRAFORM_TEST", "extends": "LW_CFG_GCP_DEFAULT_PROFILE", diff --git a/integration/resource_lacework_alert_rule_test.go b/integration/resource_lacework_alert_rule_test.go index b64f25202..ffe5a4be0 100644 --- a/integration/resource_lacework_alert_rule_test.go +++ b/integration/resource_lacework_alert_rule_test.go @@ -21,6 +21,7 @@ func _TestAlertRuleCreate(t *testing.T) { name := fmt.Sprintf("Alert Rule - %s", time.Now()) terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_alert_rule", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "name": name, "description": "Alert Rule created by Terraform", @@ -94,6 +95,7 @@ func _TestAlertRuleSeverities(t *testing.T) { name := fmt.Sprintf("Alert Rule - %s", time.Now()) terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_alert_rule", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "name": name, "severities": []string{"Critical", "high", "mEdIuM", "LOW"}, @@ -137,6 +139,7 @@ func _TestAlertRuleCategories(t *testing.T) { name := fmt.Sprintf("Alert Rule - %s", time.Now()) terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_alert_rule", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "name": name, "event_categories": []string{"Compliance", "APP", "CloUD", "fIlE", "machine", "uSER", "PlatforM"}, diff --git a/integration/resource_lacework_integration_aws_eks_audit_log_test.go b/integration/resource_lacework_integration_aws_eks_audit_log_test.go index 0601f9139..e1005c484 100644 --- a/integration/resource_lacework_integration_aws_eks_audit_log_test.go +++ b/integration/resource_lacework_integration_aws_eks_audit_log_test.go @@ -15,6 +15,7 @@ import ( func TestIntegrationAwsEksAuditLog(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_integration_aws_eks_audit_log", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "role_arn": "arn:aws:iam::249446771485:role/lacework-iam-example-role", "external_id": "12345", diff --git a/integration/resource_lacework_integration_ecr_test.go b/integration/resource_lacework_integration_ecr_test.go index 2c2750757..a51f59814 100644 --- a/integration/resource_lacework_integration_ecr_test.go +++ b/integration/resource_lacework_integration_ecr_test.go @@ -18,6 +18,7 @@ func TestIntegrationECRCreate(t *testing.T) { if assert.Nil(t, err, "this test requires you to set AWS_ECR_IAM environment variable") { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_integration_ecr/iam_role", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "integration_name": "Amazon Elastic Container Registry Example", "role_arn": awsCreds.RoleArn, @@ -53,6 +54,7 @@ func TestIntegrationECRCreate(t *testing.T) { func TestIntegrationECRNumImagesValidation(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_integration_ecr/iam_role", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "integration_name": "Amazon Elastic Container Registry Example", "num_images": 0, @@ -93,6 +95,7 @@ func TestIntegrationECRNumImagesValidation(t *testing.T) { //Test omit num images terraformOptions = terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_integration_ecr/iam_role", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "integration_name": "Amazon Elastic Container Registry Example", }, diff --git a/integration/resource_lacework_integration_gar_test.go b/integration/resource_lacework_integration_gar_test.go index 93ed62f84..2c48a99da 100644 --- a/integration/resource_lacework_integration_gar_test.go +++ b/integration/resource_lacework_integration_gar_test.go @@ -25,6 +25,7 @@ func TestIntegrationGARCreate(t *testing.T) { }, EnvVars: map[string]string{ "TF_VAR_private_key": gcreds.PrivateKey, // @afiune this will avoid printing secrets in our pipeline + "LW_API_TOKEN": LwApiToken, }, }) defer terraform.Destroy(t, terraformOptions) diff --git a/integration/resource_lacework_integration_gcp_gke_audit_log_test.go b/integration/resource_lacework_integration_gcp_gke_audit_log_test.go index 88119dbb0..33818978c 100644 --- a/integration/resource_lacework_integration_gcp_gke_audit_log_test.go +++ b/integration/resource_lacework_integration_gcp_gke_audit_log_test.go @@ -17,6 +17,7 @@ func TestIntegrationGcpGkeAuditLog(t *testing.T) { if assert.Nil(t, err, "this test requires you to set GOOGLE_CREDENTIALS environment variable") { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_integration_gcp_gke_audit_log", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "name": "GCP GKE audit log integration example", "client_id": gcreds.ClientID, diff --git a/integration/resource_lacework_integration_ghcr_test.go b/integration/resource_lacework_integration_ghcr_test.go index 5ebfa2f06..ff9f062ef 100644 --- a/integration/resource_lacework_integration_ghcr_test.go +++ b/integration/resource_lacework_integration_ghcr_test.go @@ -24,6 +24,7 @@ func TestIntegrationGHCRCreate(t *testing.T) { }, EnvVars: map[string]string{ "TF_VAR_password": creds.Token, + "LW_API_TOKEN": LwApiToken, }, }) defer terraform.Destroy(t, terraformOptions) diff --git a/integration/resource_lacework_integration_newrelic_test.go b/integration/resource_lacework_integration_newrelic_test.go index 9727e2e90..6e4ea04da 100644 --- a/integration/resource_lacework_integration_newrelic_test.go +++ b/integration/resource_lacework_integration_newrelic_test.go @@ -13,6 +13,7 @@ import ( func TestNewRelicAlertChannelCreate(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_alert_channel_newrelic", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "channel_name": "NewRelic Insights Alert Channel Example", "insert_key": "x-xx-xxxxxxxxxxxxxxxxxx", diff --git a/integration/resource_lacework_integration_pagerduty_test.go b/integration/resource_lacework_integration_pagerduty_test.go index c7c46448e..ce5d750f3 100644 --- a/integration/resource_lacework_integration_pagerduty_test.go +++ b/integration/resource_lacework_integration_pagerduty_test.go @@ -13,6 +13,7 @@ import ( func TestPagerDutyAlertChannelCreate(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_alert_channel_pagerduty", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "channel_name": "PagerDuty Alert Channel Example", "integration_key": "1234abc8901abc567abc123abc78e012", diff --git a/integration/resource_lacework_integration_service_now_test.go b/integration/resource_lacework_integration_service_now_test.go index aad950def..06c1efbfa 100644 --- a/integration/resource_lacework_integration_service_now_test.go +++ b/integration/resource_lacework_integration_service_now_test.go @@ -13,6 +13,7 @@ import ( func TestServiceNowRestAlertChannelCreate(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_alert_channel_service_now", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "channel_name": "Service Now Alert Channel Example", "instance_url": "https://dev123.service-now.com", diff --git a/integration/resource_lacework_integration_splunk_test.go b/integration/resource_lacework_integration_splunk_test.go index 2ca3511f3..9ea9da929 100644 --- a/integration/resource_lacework_integration_splunk_test.go +++ b/integration/resource_lacework_integration_splunk_test.go @@ -13,6 +13,7 @@ import ( func TestSplunkAlertChannelCreate(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_alert_channel_splunk", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "channel_name": "Splunk Alert Channel Example", "channel": "Splunk Channel", diff --git a/integration/resource_lacework_integration_victorops_test.go b/integration/resource_lacework_integration_victorops_test.go index 98819e4c0..78fcad6ce 100644 --- a/integration/resource_lacework_integration_victorops_test.go +++ b/integration/resource_lacework_integration_victorops_test.go @@ -13,6 +13,7 @@ import ( func TestVictorOpsAlertChannelCreate(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_alert_channel_victorops", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "channel_name": "VictorOps Alert Channel Example", "webhook_url": "https://alert.victorops.com/integrations/generic/20131114/alert/31e945ee-5cad-44e7-afb0-97c20ea80dd8/database", diff --git a/integration/resource_lacework_policy_exception_test.go b/integration/resource_lacework_policy_exception_test.go index 53637e106..432e03056 100644 --- a/integration/resource_lacework_policy_exception_test.go +++ b/integration/resource_lacework_policy_exception_test.go @@ -15,6 +15,7 @@ import ( func TestPolicyExceptionCreate(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_policy_exception", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "policy_id": "lacework-global-46", "description": "Policy Exception Created via Terraform", diff --git a/integration/resource_lacework_policy_test.go b/integration/resource_lacework_policy_test.go index a4edf60ca..031332e98 100644 --- a/integration/resource_lacework_policy_test.go +++ b/integration/resource_lacework_policy_test.go @@ -19,6 +19,7 @@ import ( func TestPolicyCreate(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_policy", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "title": "lql-terraform-policy", "severity": "High", diff --git a/integration/resource_lacework_query_test.go b/integration/resource_lacework_query_test.go index d0e040de0..9ae41a1ad 100644 --- a/integration/resource_lacework_query_test.go +++ b/integration/resource_lacework_query_test.go @@ -19,6 +19,7 @@ func TestQueryCreateCloudtrail(t *testing.T) { queryID := fmt.Sprintf("Lql_Terraform_Query_%d", time.Now().UnixMilli()) terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_query", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "query_id": queryID, "query": queryString}, diff --git a/integration/resource_lacework_report_rule_test.go b/integration/resource_lacework_report_rule_test.go index fca00b12b..48cddbc81 100644 --- a/integration/resource_lacework_report_rule_test.go +++ b/integration/resource_lacework_report_rule_test.go @@ -22,6 +22,7 @@ func _TestReportRuleCreate(t *testing.T) { resourceGroupName := fmt.Sprintf("Used for Report Rule Test - %s", time.Now()) terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_report_rule", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "name": name, "description": "Report Rule created by Terraform", diff --git a/integration/resource_lacework_resource_group_account_test.go b/integration/resource_lacework_resource_group_account_test.go index e2e8dedcc..7ca68f156 100644 --- a/integration/resource_lacework_resource_group_account_test.go +++ b/integration/resource_lacework_resource_group_account_test.go @@ -22,6 +22,7 @@ func TestResourceGroupLwAccountCreate(t *testing.T) { name := fmt.Sprintf("Terraform Test LwAccount Resource Group - %s", time.Now()) terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_resource_group_account", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "resource_group_name": name, "description": "Terraform Test LwAccount Resource Group", diff --git a/integration/resource_lacework_resource_group_aws_test.go b/integration/resource_lacework_resource_group_aws_test.go index 0d754e9f6..5d6307097 100644 --- a/integration/resource_lacework_resource_group_aws_test.go +++ b/integration/resource_lacework_resource_group_aws_test.go @@ -18,6 +18,7 @@ func TestResourceGroupAwsCreate(t *testing.T) { name := fmt.Sprintf("Terraform Test Aws Resource Group - %s", time.Now()) terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_resource_group_aws", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "resource_group_name": name, "description": "Terraform Test Aws Resource Group", diff --git a/integration/resource_lacework_resource_group_azure_test.go b/integration/resource_lacework_resource_group_azure_test.go index 42638e98f..00ee5a9b5 100644 --- a/integration/resource_lacework_resource_group_azure_test.go +++ b/integration/resource_lacework_resource_group_azure_test.go @@ -18,6 +18,7 @@ func TestResourceGroupAzureCreate(t *testing.T) { name := fmt.Sprintf("Terraform Test Azure Resource Group - %s", time.Now()) terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_resource_group_azure", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "resource_group_name": name, "description": "Terraform Test Azure Resource Group", diff --git a/integration/resource_lacework_resource_group_container_test.go b/integration/resource_lacework_resource_group_container_test.go index 565fa05e7..ab35ee42e 100644 --- a/integration/resource_lacework_resource_group_container_test.go +++ b/integration/resource_lacework_resource_group_container_test.go @@ -18,6 +18,7 @@ func TestResourceGroupContainerCreate(t *testing.T) { name := fmt.Sprintf("Terraform Test Machine Resource Group - %s", time.Now()) terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_resource_group_container", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "resource_group_name": name, "description": "Terraform Test Container Resource Group", diff --git a/integration/resource_lacework_resource_group_gcp_test.go b/integration/resource_lacework_resource_group_gcp_test.go index c1f5149ec..d5f40e3c0 100644 --- a/integration/resource_lacework_resource_group_gcp_test.go +++ b/integration/resource_lacework_resource_group_gcp_test.go @@ -18,6 +18,7 @@ func TestResourceGroupGcpCreate(t *testing.T) { name := fmt.Sprintf("Terraform Test LwAccount Resource Group - %s", time.Now()) terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_resource_group_gcp", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "resource_group_name": name, "description": "Terraform Test Gcp Resource Group", diff --git a/integration/resource_lacework_resource_group_machine_test.go b/integration/resource_lacework_resource_group_machine_test.go index 2d4f63091..9bd115ac8 100644 --- a/integration/resource_lacework_resource_group_machine_test.go +++ b/integration/resource_lacework_resource_group_machine_test.go @@ -18,6 +18,7 @@ func TestResourceGroupMachineCreate(t *testing.T) { name := fmt.Sprintf("Terraform Test Machine Resource Group - %s", time.Now()) terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_resource_group_machine", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "resource_group_name": name, "description": "Terraform Test Machine Resource Group", diff --git a/integration/resource_lacework_team_member_test.go b/integration/resource_lacework_team_member_test.go index 93fef699c..bd847a040 100644 --- a/integration/resource_lacework_team_member_test.go +++ b/integration/resource_lacework_team_member_test.go @@ -20,6 +20,7 @@ func TestTeamMemberStandalone(t *testing.T) { email := fmt.Sprintf("vatasha.white+%d@lacework.net", time.Now().Unix()) terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_team_member_standalone", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{"email": email}, }) defer terraform.Destroy(t, terraformOptions) @@ -64,6 +65,7 @@ func TestTeamMemberOrg(t *testing.T) { } terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_team_member_organization", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "email": email, "user_accounts": []string{account}, diff --git a/integration/resource_lacework_vulnerability_exception_container_test.go b/integration/resource_lacework_vulnerability_exception_container_test.go index c5c5bf34f..8e2be0a05 100644 --- a/integration/resource_lacework_vulnerability_exception_container_test.go +++ b/integration/resource_lacework_vulnerability_exception_container_test.go @@ -16,6 +16,7 @@ import ( func TestVulnerabilityExceptionContainerCreate(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_vulnerability_exception_container", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "name": "Terraform Vulnerability Exception Container Test", "description": "Vulnerability Exception Container created by Terraform", diff --git a/integration/resource_lacework_vulnerability_exception_host_test.go b/integration/resource_lacework_vulnerability_exception_host_test.go index a131c318e..f8b87c117 100644 --- a/integration/resource_lacework_vulnerability_exception_host_test.go +++ b/integration/resource_lacework_vulnerability_exception_host_test.go @@ -15,6 +15,7 @@ import ( func TestVulnerabilityExceptionHostCreate(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_vulnerability_exception_host", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "name": "Terraform Vulnerability Exception Host Test", "description": "Vulnerability Exception Host created by Terraform", diff --git a/integration/rollback_alert_channel_test.go b/integration/rollback_alert_channel_test.go index 40ee11138..8ba7baf60 100644 --- a/integration/rollback_alert_channel_test.go +++ b/integration/rollback_alert_channel_test.go @@ -13,6 +13,7 @@ import ( func TestAlertChannelRollback(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_alert_channel_microsoft_teams", + EnvVars: tokenEnvVar, Vars: map[string]interface{}{ "channel_name": "Test Name", "webhook_url": "https://outlook.office.com/webhook/api-token",