generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [PL-57366]: Onboarding TF Sanity to IE Clusters (#1097)
* feat:[PL-57366]: secret azureTest creation missing * feat:[PL-57366]: users got commented * OPA Test fix for TF sanity pipeline * OPA Test fix for TF * feat:[PL-57366]: gitops_tf * feat:[PL-57366]: gitops_tf removed * Test Fix * feat:[PL-57366]: CBP required connector tests * feat:[PL-57366]: account data tests * Added Dummy Tests for TF qa0 env * Pre-requisite for IE TF Sanity * added main.tf file * added required_providers * fix: azuretest * fix: azuretest * fix: azuretest * Delete connectorreport.xml * PL connectors to SM * fix: PL connectors to SM * fix: Pl_SM Referring in provider.go (#1096) * fix: PL connectors to SM * fix: Pl_SM Referring in provider.go (#1096) --------- Co-authored-by: Sameed Ul Haq <[email protected]> Co-authored-by: Ritek <[email protected]>
- Loading branch information
1 parent
51eb950
commit 6528a62
Showing
40 changed files
with
872 additions
and
160 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
resource "harness_platform_organization" "this" { | ||
identifier = "MyOrg" | ||
name = "My Otganization" | ||
name = "My Organization" | ||
description = "An example organization" | ||
tags = ["foo:bar", "baz:qux"] | ||
} |
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,118 @@ | ||
# main.tf | ||
|
||
terraform { | ||
required_providers { | ||
harness = { | ||
source = "harness/harness" | ||
} | ||
} | ||
} | ||
|
||
resource "harness_platform_secret_text" "azuretest" { | ||
identifier = "azuretest" | ||
name = "azuretest" | ||
description = "This is a test secret text" | ||
tags = ["foo:bar"] | ||
secret_manager_identifier = "harnessSecretManager" | ||
value_type = "Inline" | ||
value = "my_secret_value" | ||
} | ||
|
||
resource "harness_platform_secret_text" "doNotDeleteHSM" { | ||
identifier = "doNotDeleteHSM" | ||
name = "doNotDeleteHSM" | ||
description = "This is a test secret text" | ||
tags = ["foo:bar"] | ||
secret_manager_identifier = "harnessSecretManager" | ||
value_type = "Inline" | ||
value = "Harness@123" | ||
} | ||
|
||
resource "harness_platform_connector_vault" "my_vault_connector" { | ||
identifier = "my_vault_connector_id" | ||
name = "My Vault Connector" | ||
description = "Vault Connector example" | ||
tags = ["foo:bar"] | ||
|
||
app_role_id = "570acf09-ef2a-144b-2fb0-14a42e06ffe3" | ||
base_path = "vikas-test/" | ||
access_type = "APP_ROLE" | ||
default = false | ||
secret_id = "account.${harness_platform_secret_text.azuretest.id}" | ||
read_only = true | ||
renewal_interval_minutes = 60 | ||
secret_engine_manually_configured = true | ||
secret_engine_name = "harness-test" | ||
secret_engine_version = 2 | ||
use_aws_iam = false | ||
use_k8s_auth = false | ||
use_vault_agent = false | ||
delegate_selectors = ["harness-delegate"] | ||
vault_url = "https://vaultqa.harness.io" | ||
|
||
depends_on = [time_sleep.wait_8_seconds] | ||
} | ||
|
||
resource "harness_platform_service_account" "my_service_account" { | ||
identifier = "my_service_account_id" | ||
name = "My Service Account" | ||
email = "[email protected]" | ||
description = "This is a test service account" | ||
tags = ["foo:bar"] | ||
account_id = "your_harness_account_id" | ||
} | ||
|
||
resource "harness_platform_usergroup" "my_user_group" { | ||
identifier = "my_user_group_id" | ||
name = "My User Group" | ||
|
||
linked_sso_id = "linked_sso_id" | ||
externally_managed = false | ||
users = [] | ||
|
||
notification_configs { | ||
type = "SLACK" | ||
slack_webhook_url = "https://slack.webhook.url" | ||
} | ||
|
||
notification_configs { | ||
type = "EMAIL" | ||
group_email = "[email protected]" | ||
send_email_to_all_users = true | ||
} | ||
|
||
notification_configs { | ||
type = "MSTEAMS" | ||
microsoft_teams_webhook_url = "https://msteams.webhook.url" | ||
} | ||
|
||
notification_configs { | ||
type = "PAGERDUTY" | ||
pager_duty_key = "pagerDutyKey" | ||
} | ||
|
||
linked_sso_display_name = "SSO Display Name" | ||
sso_group_id = "sso_group_id" | ||
sso_group_name = "sso_group_name" | ||
linked_sso_type = "SAML" | ||
sso_linked = true | ||
} | ||
|
||
resource "harness_platform_organization" "my_organization" { | ||
identifier = "my_organization_id" | ||
name = "My Organization" | ||
description = "This is a test organization" | ||
tags = ["foo:bar", "baz:qux"] | ||
} | ||
|
||
resource "harness_platform_project" "my_project" { | ||
identifier = "my_project_id" | ||
name = "My Project" | ||
org_id = harness_platform_organization.my_organization.id | ||
} | ||
|
||
resource "time_sleep" "wait_8_seconds" { | ||
create_duration = "8s" | ||
} | ||
|
||
# Additional resources can be added as needed |
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,159 @@ | ||
package _PreRequisites | ||
|
||
import ( | ||
"fmt" | ||
"path/filepath" | ||
) | ||
|
||
// Helper functions for Creation of Resources | ||
func createConnectorVault_app_role(id string, name string, vault_secret string) string { | ||
return fmt.Sprintf(` | ||
resource "harness_platform_secret_text" "test" { | ||
identifier = "%[1]s" | ||
name = "%[2]s" | ||
description = "test" | ||
tags = ["foo:bar"] | ||
secret_manager_identifier = "harnessSecretManager" | ||
value_type = "Inline" | ||
value = "%[3]s" | ||
} | ||
resource "harness_platform_connector_vault" "test" { | ||
identifier = "%[1]s" | ||
name = "%[2]s" | ||
description = "test" | ||
tags = ["foo:bar"] | ||
app_role_id = "570acf09-ef2a-144b-2fb0-14a42e06ffe3" | ||
base_path = "vikas-test/" | ||
access_type = "APP_ROLE" | ||
default = false | ||
secret_id = "account.${harness_platform_secret_text.test.id}" | ||
read_only = true | ||
renewal_interval_minutes = 60 | ||
secret_engine_manually_configured = true | ||
secret_engine_name = "harness-test" | ||
secret_engine_version = 2 | ||
use_aws_iam = false | ||
use_k8s_auth = false | ||
use_vault_agent = false | ||
delegate_selectors = ["harness-delegate"] | ||
vault_url = "https://vaultqa.harness.io" | ||
depends_on = [time_sleep.wait_8_seconds] | ||
} | ||
resource "time_sleep" "wait_8_seconds" { | ||
depends_on = [harness_platform_secret_text.test] | ||
create_duration = "8s" | ||
} | ||
`, id, name, vault_secret) | ||
} | ||
|
||
func createSecretFile(id string, name string) string { | ||
return fmt.Sprintf(` | ||
resource "harness_platform_secret_file" "test" { | ||
identifier = "%[1]s" | ||
name = "%[2]s" | ||
description = "test" | ||
tags = ["foo:bar"] | ||
file_path = "%[3]s" | ||
secret_manager_identifier = "harnessSecretManager" | ||
} | ||
`, id, name, getAbsFilePath("../../../acctest/secret_files/secret.txt")) | ||
} | ||
|
||
func getAbsFilePath(file_path string) string { | ||
absPath, _ := filepath.Abs(file_path) | ||
return absPath | ||
} | ||
|
||
func createServiceAccount(id string, name string, accountId string) string { | ||
return fmt.Sprintf(` | ||
resource "harness_platform_service_account" "test" { | ||
identifier = "%[1]s" | ||
name = "%[2]s" | ||
email = "[email protected]" | ||
description = "test" | ||
tags = ["foo:bar"] | ||
account_id = "%[3]s" | ||
} | ||
`, id, name, accountId) | ||
} | ||
|
||
func createUserGroup(id string, name string) string { | ||
return fmt.Sprintf(` | ||
resource "harness_platform_usergroup" "test" { | ||
identifier = "%[1]s" | ||
name = "%[2]s" | ||
linked_sso_id = "linked_sso_id" | ||
externally_managed = false | ||
users = [] | ||
notification_configs { | ||
type = "SLACK" | ||
slack_webhook_url = "https://google.com" | ||
} | ||
notification_configs { | ||
type = "EMAIL" | ||
group_email = "[email protected]" | ||
send_email_to_all_users = true | ||
} | ||
notification_configs { | ||
type = "MSTEAMS" | ||
microsoft_teams_webhook_url = "https://google.com" | ||
} | ||
notification_configs { | ||
type = "PAGERDUTY" | ||
pager_duty_key = "pagerDutyKey" | ||
} | ||
linked_sso_display_name = "linked_sso_display_name" | ||
sso_group_id = "sso_group_id" | ||
sso_group_name = "sso_group_name" | ||
linked_sso_type = "SAML" | ||
sso_linked = true | ||
} | ||
`, id, name) | ||
} | ||
|
||
func createProject(id string, name string) string { | ||
return fmt.Sprintf(` | ||
resource "harness_platform_organization" "test" { | ||
identifier = "%[1]s" | ||
name = "%[2]s" | ||
} | ||
resource "harness_platform_project" "test" { | ||
identifier = "%[1]s" | ||
name = "%[2]s" | ||
org_id = harness_platform_organization.test.id | ||
} | ||
`, id, name) | ||
} | ||
|
||
func createOrganization(id string, name string) string { | ||
return fmt.Sprintf(` | ||
resource "harness_platform_organization" "test" { | ||
identifier = "%[1]s" | ||
name = "%[2]s" | ||
description = "test" | ||
tags = ["foo:bar", "baz:qux"] | ||
} | ||
`, id, name) | ||
} | ||
|
||
func createSecretText_inline(id string, name string, secretValue string) string { | ||
return fmt.Sprintf(` | ||
resource "harness_platform_secret_text" "test" { | ||
identifier = "%[1]s" | ||
name = "%[2]s" | ||
description = "test" | ||
tags = ["foo:bar"] | ||
secret_manager_identifier = "harnessSecretManager" | ||
value_type = "Inline" | ||
value = "%[3]s" | ||
} | ||
`, id, name, secretValue) | ||
} | ||
|
||
// Add more similar functions for other resources |
Oops, something went wrong.