From 28ff86b71cdfd53cbc38955604f60587c6ffb89e Mon Sep 17 00:00:00 2001 From: DigbijayineeClara07 Date: Thu, 13 Aug 2026 09:03:48 +0530 Subject: [PATCH] terraform-module-revamp --- azure_oidc/main.tf | 10 +- azure_oidc/output.tf | 14 + azure_oidc/provider.tf | 2 +- azure_static/main.tf | 20 +- azure_static/output.tf | 21 ++ azure_static/provider.tf | 2 +- stackguardian_connector_cloud/main.tf | 14 +- stackguardian_connector_cloud/provider.tf | 8 +- stackguardian_connector_cloud/variables.tf | 5 + stackguardian_connector_vcs/main.tf | 282 +++++++++++++++++--- stackguardian_connector_vcs/outputs.tf | 8 +- stackguardian_connector_vcs/provider.tf | 8 +- stackguardian_connector_vcs/variables.tf | 295 ++++++++++++++++++--- stackguardian_role/provider.tf | 8 +- stackguardian_role/variables.tf | 4 + stackguardian_role_assignment/provider.tf | 8 +- stackguardian_role_assignment/variables.tf | 4 + stackguardian_workflow_group/provider.tf | 8 +- stackguardian_workflow_group/variables.tf | 5 + 19 files changed, 619 insertions(+), 107 deletions(-) create mode 100644 azure_oidc/output.tf create mode 100644 azure_static/output.tf diff --git a/azure_oidc/main.tf b/azure_oidc/main.tf index b7817f2..4cfd2f1 100644 --- a/azure_oidc/main.tf +++ b/azure_oidc/main.tf @@ -15,11 +15,11 @@ resource "azuread_service_principal" "sg_sp" { } # Assign Contributor role to the Service Principal at the subscription level -resource "azurerm_role_assignment" "example" { - principal_id = azuread_service_principal.sg_sp.object_id - role_definition_name = "Contributor" - scope = data.azurerm_subscription.current.id -} +# resource "azurerm_role_assignment" "example" { +# principal_id = azuread_service_principal.sg_sp.object_id +# role_definition_name = "Contributor" +# scope = data.azurerm_subscription.current.id +# } # Configure Workload Identity (Federated Credential) resource "azuread_application_federated_identity_credential" "sg_fed_id_creds" { diff --git a/azure_oidc/output.tf b/azure_oidc/output.tf new file mode 100644 index 0000000..b6db983 --- /dev/null +++ b/azure_oidc/output.tf @@ -0,0 +1,14 @@ +output "azure_oidc" { + description = "Azure OIDC configuration details" + + value = { + client_id = azuread_application.app_registration.client_id + application_id = azuread_application.app_registration.id + service_principal_id = azuread_service_principal.sg_sp.object_id + tenant_id = data.azuread_client_config.current.tenant_id + subscription_id = data.azurerm_subscription.current.subscription_id + issuer = azuread_application_federated_identity_credential.sg_fed_id_creds.issuer + subject = azuread_application_federated_identity_credential.sg_fed_id_creds.subject + audience = azuread_application_federated_identity_credential.sg_fed_id_creds.audiences[0] + } +} \ No newline at end of file diff --git a/azure_oidc/provider.tf b/azure_oidc/provider.tf index 6b606c5..f8d74c4 100644 --- a/azure_oidc/provider.tf +++ b/azure_oidc/provider.tf @@ -2,7 +2,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "=4.6.0" + version = "=5.0.1" } azuread = { source = "hashicorp/azuread" diff --git a/azure_static/main.tf b/azure_static/main.tf index e73f66e..12cf662 100644 --- a/azure_static/main.tf +++ b/azure_static/main.tf @@ -22,22 +22,10 @@ resource "azurerm_role_assignment" "example" { } # Step 3: Create a Client Secret for the Service Principal -resource "azuread_service_principal_password" "client_secret" { - service_principal_id = azuread_service_principal.sg_sp.id -} - -# Step 4: Output the Client Secret Value (ID will be available in the Service Principal) -output "client_secret_value" { - value = azuread_service_principal_password.client_secret.value - sensitive = true -} -# Step 5: Output the Client ID (Application ID) -output "client_id" { - value = azuread_application.app_registration.client_id +resource "azuread_application_password" "client_secret" { + application_id = azuread_application.app_registration.id + display_name = "Terraform Client Secret" + end_date = "2027-02-07T23:59:59Z" } -# Step 6: Output the Client Secret ID (from the service principal password) -output "client_secret_id" { - value = azuread_service_principal_password.client_secret.id -} \ No newline at end of file diff --git a/azure_static/output.tf b/azure_static/output.tf new file mode 100644 index 0000000..23d262d --- /dev/null +++ b/azure_static/output.tf @@ -0,0 +1,21 @@ +output "azure_service_principal" { + description = "Azure Service Principal details" + + value = { + client_id = azuread_application.app_registration.client_id + application_id = azuread_application.app_registration.id + service_principal_id = azuread_service_principal.sg_sp.object_id + tenant_id = data.azuread_client_config.current.tenant_id + } +} + +# output "client_secret" { +# description = "Client secret for the Azure Service Principal" +# value = azuread_service_principal_password.client_secret.value +# sensitive = true +# } +output "client_secret" { + description = "Client secret for the Azure App Registration" + value = azuread_application_password.client_secret.value + sensitive = true +} \ No newline at end of file diff --git a/azure_static/provider.tf b/azure_static/provider.tf index 6b606c5..f8d74c4 100644 --- a/azure_static/provider.tf +++ b/azure_static/provider.tf @@ -2,7 +2,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "=4.6.0" + version = "=5.0.1" } azuread = { source = "hashicorp/azuread" diff --git a/stackguardian_connector_cloud/main.tf b/stackguardian_connector_cloud/main.tf index 27af7fc..1e9e67d 100644 --- a/stackguardian_connector_cloud/main.tf +++ b/stackguardian_connector_cloud/main.tf @@ -73,10 +73,10 @@ resource "stackguardian_connector" "sg_azure_static_connector" { settings = { kind = var.connector_type, config = [{ - armTenantId = var.armTenantId, - armSubscriptionId = var.armSubscriptionId, - armClientId = var.armClientId, - armClientSecret = var.armClientSecret + arm_tenant_id = var.armTenantId, + arm_subscription_id = var.armSubscriptionId, + arm_client_id = var.armClientId, + arm_client_secret = var.armClientSecret }] } } @@ -95,9 +95,9 @@ resource "stackguardian_connector" "sg_azure_oidc_connector" { settings = { kind = var.connector_type, config = [{ - armTenantId = var.armTenantId, - armSubscriptionId = var.armSubscriptionId, - armClientId = var.armClientId, + arm_tenant_id = var.armTenantId, + arm_subscription_id = var.armSubscriptionId, + arm_client_id = var.armClientId, }] } } diff --git a/stackguardian_connector_cloud/provider.tf b/stackguardian_connector_cloud/provider.tf index 65bfd24..379f988 100644 --- a/stackguardian_connector_cloud/provider.tf +++ b/stackguardian_connector_cloud/provider.tf @@ -2,7 +2,13 @@ terraform { required_providers { stackguardian = { source = "StackGuardian/stackguardian" - version = "1.3.1" + version = "1.12.0" } } +} + +provider "stackguardian" { + org_name = var.org_name + api_key = var.api_key + api_uri = var.sg_api_uri } \ No newline at end of file diff --git a/stackguardian_connector_cloud/variables.tf b/stackguardian_connector_cloud/variables.tf index ab92a41..7c7cde8 100644 --- a/stackguardian_connector_cloud/variables.tf +++ b/stackguardian_connector_cloud/variables.tf @@ -9,6 +9,11 @@ variable "org_name" { description = "Your organization name on StackGuardian Platform" } +variable "sg_api_uri" { + type = string + description = "Your organization name on StackGuardian Platform" +} + variable "connector_type" { type = string description = "type of connector. You can select anyone of the following AWS_STATIC, AWS_RBAC, AWS_OIDC, AZURE_STATIC, AZURE_OIDC, GCP_OIDC" diff --git a/stackguardian_connector_vcs/main.tf b/stackguardian_connector_vcs/main.tf index 4dcd9b2..28adb7d 100644 --- a/stackguardian_connector_vcs/main.tf +++ b/stackguardian_connector_vcs/main.tf @@ -1,39 +1,257 @@ -# resource "stackguardian_connector" "sg_vcs_connector" { -# resource_name = var.stackguardian_connector_vcs_name -# description = "Onboarding example of terraform-provider-stackguardian for ConnectorVcs" -# settings = { -# kind = var.vcs_kind +check "github_com" { + assert { + condition = var.vcs_connectors != "GITHUB_COM" || ( + var.github_com_url != null && + var.github_http_url != null + ) + + error_message = "Variables github_com_url and github_http_url must be set when vcs_connectors is GITHUB_COM." + } +} + +resource "stackguardian_connector" "sg_github_com_connector" { + count = var.vcs_connectors == "GITHUB_COM" ? 1 : 0 + resource_name = var.vcs_connector_name + + description = "Onboarding example of terraform-provider-stackguardian for GitHub.com VCS Connector" + + settings = { + kind = var.vcs_connectors + + config = [{ + github_com_url = var.github_com_url + github_http_url = var.github_http_url + }] + } +} + +check "github_app_custom" { + assert { + condition = var.vcs_connectors != "GITHUB_APP_CUSTOM" || ( + var.github_app_client_id != null && + var.github_app_client_secret != null && + var.github_app_id != null && + var.github_app_pem_file_content != null && + var.github_app_webhook_secret != null && + var.github_app_webhook_url != null + ) + + error_message = "Variables github_app_client_id, github_app_client_secret, github_app_id, github_app_pem_file_content, github_app_webhook_secret, and github_app_webhook_url must be set when vcs_connectors is GITHUB_APP_CUSTOM." + } +} + +resource "stackguardian_connector" "sg_github_app_custom_connector" { + count = var.vcs_connectors == "GITHUB_APP_CUSTOM" ? 1 : 0 + resource_name = var.vcs_connector_name + + description = "Onboarding example of terraform-provider-stackguardian for GitHub App Custom VCS Connector" + + settings = { + kind = var.vcs_connectors + + config = [{ + github_app_client_id = var.github_app_client_id + github_app_client_secret = var.github_app_client_secret + github_app_id = var.github_app_id + github_app_pem_file_content = var.github_app_pem_file_content + github_app_webhook_secret = var.github_app_webhook_secret + github_app_webhook_url = var.github_app_webhook_url + }] + } +} + +check "bitbucket_org" { + assert { + condition = var.vcs_connectors != "BITBUCKET_ORG" || ( + var.bitbucket_creds != null + ) + + error_message = "Variable bitbucket_creds must be set when vcs_connectors is BITBUCKET_ORG." + } +} + +resource "stackguardian_connector" "sg_bitbucket_org_connector" { + count = var.vcs_connectors == "BITBUCKET_ORG" ? 1 : 0 + resource_name = var.vcs_connector_name + + description = "Onboarding example of terraform-provider-stackguardian for Bitbucket Organization VCS Connector" + + settings = { + kind = var.vcs_connectors + + config = [{ + bitbucket_creds = var.bitbucket_creds + }] + } +} + +check "gitlab_com" { + assert { + condition = var.vcs_connectors != "GITLAB_COM" || ( + var.gitlab_api_url != null && + var.gitlab_creds != null && + var.gitlab_http_url != null + ) + + error_message = "Variables gitlab_api_url, gitlab_creds, and gitlab_http_url must be set when vcs_connectors is GITLAB_COM." + } +} + +resource "stackguardian_connector" "sg_gitlab_com_connector" { + count = var.vcs_connectors == "GITLAB_COM" ? 1 : 0 + resource_name = var.vcs_connector_name + + description = "Onboarding example of terraform-provider-stackguardian for GitLab.com VCS Connector" + + settings = { + kind = var.vcs_connectors + + config = [{ + gitlab_api_url = var.gitlab_api_url + gitlab_creds = var.gitlab_creds + gitlab_http_url = var.gitlab_http_url + }] + } +} + +check "azure_devops" { + assert { + condition = var.vcs_connectors != "AZURE_DEVOPS" || ( + var.azure_devops_api_url != null && + var.azure_devops_http_url != null && + var.azure_creds != null + ) + + error_message = "Variables azure_devops_api_url, azure_devops_http_url, and azure_creds must be set when vcs_connectors is AZURE_DEVOPS." + } +} + +resource "stackguardian_connector" "sg_azure_devops_connector" { + count = var.vcs_connectors == "AZURE_DEVOPS" ? 1 : 0 + resource_name = var.vcs_connector_name + + description = "Onboarding example of terraform-provider-stackguardian for Azure DevOps VCS Connector" + + settings = { + kind = var.vcs_connectors + + config = [{ + azure_devops_api_url = var.azure_devops_api_url + azure_devops_http_url = var.azure_devops_http_url + azure_creds = var.azure_creds + }] + } +} + +# check "aws_rbac_vars" { +# assert { +# condition = var.vcs_connectors!= "AWS_RBAC" || (var.role_arn != null && var.role_external_id != null) +# error_message = "Variables role_arn and role_external_id must be set when vcs_connectorsis AWS_RBAC." +# } +# } + +# resource "stackguardian_connector" "sg_aws_rbac_connector" { +# count = (var.vcs_connectors== "AWS_RBAC") ? 1 : 0 +# resource_name = var.cloud_connector_name +# description = "Onboarding an AWS Role with RBAC" +# settings = { +# kind = var.connector_type, # config = [{ -# gitlab_creds = var.gitlab_credentials +# role_arn = var.role_arn +# external_id = var.role_external_id +# duration_seconds = 3600 # }] # } # } -resource "stackguardian_connector" "sg_vcs_connector" { - for_each = { - for key, value in var.vcs_connectors : - key => value if( - # Check if any credentials are provided for gitlab, github or bitbucket - ( - (lookup(value.config[0], "gitlab_creds", null) != null) || - (lookup(value.config[0], "github_creds", null) != null) || - (lookup(value.config[0], "bitbucket_creds", null) != null) - ) - ) - } +# check "azure_static_vars" { +# assert { +# condition = var.vcs_connectors!= "AZURE_STATIC" || (var.armTenantId != null && var.armSubscriptionId != null && var.armClientId != null && var.armClientSecret != null) +# error_message = "Variables armTenantId, armSubscriptionId, armClientId, and armClientSecret must be set when vcs_connectorsis AZURE_STATIC." +# } +# } - resource_name = each.value.name - description = "Onboarding VCS connector" +# resource "stackguardian_connector" "sg_azure_static_connector" { +# count = (var.vcs_connectors== "AZURE_STATIC") ? 1 : 0 +# resource_name = var.cloud_connector_name +# description = "Onboarding example of terraform-provider-stackguardian for AzureConnectorCloud" +# settings = { +# kind = var.connector_type, +# config = [{ +# arm_tenant_id = var.armTenantId, +# arm_subscription_id = var.armSubscriptionId, +# arm_client_id = var.armClientId, +# arm_client_secret = var.armClientSecret +# }] +# } +# } - settings = { - kind = each.value.kind - config = flatten([ - for config_item in each.value.config : { - # Dynamically handle different connector types and jsonencode here - gitlab_creds = lookup(config_item, "gitlab_creds", null) != null ? jsonencode(lookup(config_item, "gitlab_creds", null)) : null - github_creds = lookup(config_item, "github_creds", null) != null ? jsonencode(lookup(config_item, "github_creds", null)) : null - bitbucket_creds = lookup(config_item, "bitbucket_creds", null) != null ? jsonencode(lookup(config_item, "bitbucket_creds", null)) : null - } - ]) - } -} \ No newline at end of file +# check "azure_oidc_vars" { +# assert { +# condition = var.vcs_connectors!= "AZURE_OIDC" || (var.armTenantId != null && var.armSubscriptionId != null && var.armClientId != null) +# error_message = "Variables armTenantId, armSubscriptionId, and armClientId must be set when vcs_connectorsis AZURE_OIDC." +# } +# } + +# resource "stackguardian_connector" "sg_azure_oidc_connector" { +# count = (var.vcs_connectors== "AZURE_OIDC") ? 1 : 0 +# resource_name = var.cloud_connector_name +# description = "Onboarding example of terraform-provider-stackguardian for AzureConnectorCloud" +# settings = { +# kind = var.connector_type, +# config = [{ +# arm_tenant_id = var.armTenantId, +# arm_subscription_id = var.armSubscriptionId, +# arm_client_id = var.armClientId, +# }] +# } +# } + +# check "gcp_oidc_vars" { +# assert { +# condition = var.vcs_connectors!= "GCP_OIDC" || var.gcp_config_file_content != null +# error_message = "Variable gcp_config_file_content must be set when vcs_connectorsis GCP_OIDC." +# } +# } + +# resource "stackguardian_connector" "sg_gcp_oidc_connector" { +# count = (var.vcs_connectors== "GCP_OIDC") ? 1 : 0 +# resource_name = var.cloud_connector_name +# description = "Onboarding example of terraform-provider-stackguardian for AzureConnectorCloud" +# settings = { +# kind = var.connector_type, +# config = [{ +# gcp_config_file_content = var.gcp_config_file_content +# }] +# } +# } + + +# resource "stackguardian_connector" "sg_vcs_connector" { +# for_each = { +# for key, value in var.vcs_connectors : +# key => value if( +# # Check if any credentials are provided for gitlab, github or bitbucket +# ( +# (lookup(value.config[0], "gitlab_creds", null) != null) || +# (lookup(value.config[0], "github_creds", null) != null) || +# (lookup(value.config[0], "bitbucket_creds", null) != null) +# ) +# ) +# } + +# resource_name = each.value.name +# description = "Onboarding VCS connector" + +# settings = { +# kind = each.value.kind +# config = flatten([ +# for config_item in each.value.config : { +# # Dynamically handle different connector types and jsonencode here +# gitlab_creds = lookup(config_item, "gitlab_creds", null) != null ? jsonencode(lookup(config_item, "gitlab_creds", null)) : null +# github_creds = lookup(config_item, "github_creds", null) != null ? jsonencode(lookup(config_item, "github_creds", null)) : null +# bitbucket_creds = lookup(config_item, "bitbucket_creds", null) != null ? jsonencode(lookup(config_item, "bitbucket_creds", null)) : null +# } +# ]) +# } +# } \ No newline at end of file diff --git a/stackguardian_connector_vcs/outputs.tf b/stackguardian_connector_vcs/outputs.tf index 802db5d..6cbd1bb 100644 --- a/stackguardian_connector_vcs/outputs.tf +++ b/stackguardian_connector_vcs/outputs.tf @@ -1,4 +1,4 @@ -output "connector_vcs" { - description = "Created VCS connector" - value = [for con in var.vcs_connectors : con.name] -} \ No newline at end of file +# output "connector_vcs" { +# description = "Created VCS connector" +# value = [for con in var.vcs_connectors : con.name] +# } \ No newline at end of file diff --git a/stackguardian_connector_vcs/provider.tf b/stackguardian_connector_vcs/provider.tf index 65bfd24..379f988 100644 --- a/stackguardian_connector_vcs/provider.tf +++ b/stackguardian_connector_vcs/provider.tf @@ -2,7 +2,13 @@ terraform { required_providers { stackguardian = { source = "StackGuardian/stackguardian" - version = "1.3.1" + version = "1.12.0" } } +} + +provider "stackguardian" { + org_name = var.org_name + api_key = var.api_key + api_uri = var.sg_api_uri } \ No newline at end of file diff --git a/stackguardian_connector_vcs/variables.tf b/stackguardian_connector_vcs/variables.tf index a7c015a..a09f129 100644 --- a/stackguardian_connector_vcs/variables.tf +++ b/stackguardian_connector_vcs/variables.tf @@ -1,46 +1,269 @@ variable "api_key" { type = string - description = "API key to authenticate to StackGuardian" + description = "Your organization's API key on the StackGuardian Platform" + sensitive = true } + variable "org_name" { type = string - description = "Organisation name in StackGuardian platform" + description = "Your organization name on StackGuardian Platform" +} + +variable "sg_api_uri" { + type = string + description = "Your organization name on StackGuardian Platform" } variable "vcs_connectors" { - description = "A map of connectors and their respective configurations" - type = map(any) - default = { - vcs_gitlab = { - kind = "GITLAB_COM" - name = "gitlab-connector" - config = [{ - gitlab_creds = { - gitlabCreds = "gitlabuser:gitlab_pat", - gitlabHttpUrl = "https://gitlab.com", - gitlabApiUrl = "https://gitlab.com/api/v4" - } - }] - }, - vcs_github = { - name = "github-connector" - kind = "GITHUB_COM" - config = [{ - github_creds = { - githubCreds = "username:personal_access_token" - github_com_url = "https://api.github.com" - github_http_url = "https://github.com" - } - }] - }, - vcs_bitbucket = { - name = "bitbucket-connector" - kind = "BITBUCKET_ORG" - config = [{ - bitbucket_creds = { - bitbucket_creds = "" - } - }] - } + type = string + description = "type of vcs connector. You can select anyone of the following GITHUB_COM, GITHUB_APP_CUSTOM, BITBUCKET_ORG, GITLAB_COM, AZURE_DEVOPS" + validation { + condition = contains([ + "GITHUB_COM", + "GITHUB_APP_CUSTOM", + "BITBUCKET_ORG", + "GITLAB_COM", + "AZURE_DEVOPS" + ], var.vcs_connectors) + error_message = "Variable vcs_connectors must be one of GITHUB_COM, GITHUB_APP_CUSTOM, BITBUCKET_ORG, GITLAB_COM, AZURE_DEVOPS." } } + +variable "vcs_connector_name" { + type = string + description = "Name of the VCS connector" +} + + +################ +# GITHUB_COM Credentials +################ + +variable "github_com_url" { + type = string + description = "github URL for accessing the GitHub website." + default = null # optional +} + +variable "github_http_url" { + type = string + description = "HTTP URL for accessing the GitHub repository" + default = null # optional +} + +################ +# GITHUB_APP_CUSTOM Credentials +################ + +variable "github_app_client_id" { + type = string + description = "GitHub App client ID" + default = null # optional +} + +variable "github_app_client_secret" { + type = string + description = "GitHub App client secret" + default = null # optional + sensitive = true +} + +variable "github_app_id" { + type = string + description = "GitHub App ID" + default = null # optional +} + +variable "github_app_pem_file_content" { + type = string + description = "GitHub App PEM file content" + default = null # optional + sensitive = true +} + +variable "github_app_webhook_secret" { + type = string + description = "GitHub App webhook secret" + default = null # optional + sensitive = true +} + +variable "github_app_webhook_url" { + type = string + description = "GitHub App webhook URL" + default = null # optional +} + +################ +# BITBUCKET_ORG Credentials +################ +variable "bitbucket_creds" { + type = string + description = "Bitbucket credentials" + sensitive = true + default = null +} + +################ +# GITLAB_COM Credentials +################ + +variable "gitlab_api_url" { + type = string + description = "GitLab API URL" + default = null +} + +variable "gitlab_creds" { + type = string + description = "GitLab credentials" + sensitive = true + default = null +} + +variable "gitlab_http_url" { + type = string + description = "GitLab HTTP URL" + default = null +} + +################ +# AZURE_DEVOPS Credentials +################ +variable "azure_devops_api_url" { + type = string + description = "Azure DevOps API URL" + default = null +} + +variable "azure_devops_http_url" { + type = string + description = "Azure DevOps HTTP URL" + default = null +} + +variable "azure_creds" { + type = string + description = "Azure DevOps credentials" + sensitive = true + default = null +} + +# variable "aws_secret_access_key" { +# type = string +# description = "your AWS account secret access key" +# default = null # optional +# sensitive = true +# } + +# variable "aws_default_region" { +# type = string +# description = "any default region you want to set, for all your deployments" +# default = null # optional +# } + +################ +# AZURE_STATIC Credentials +################ + +variable "armTenantId" { + type = string + description = "your azure account tenant id" + default = null # optional +} + +variable "armSubscriptionId" { + type = string + description = "your azure subscription id" + default = null # optional +} + +variable "armClientId" { + type = string + description = "your azure client id" + default = null # optional +} + +variable "armClientSecret" { + type = string + description = "your azure client secret" + default = null # optional + sensitive = true +} + +################ +# AWS_OIDC Credentials + AWS_RBAC Credentials +################ +variable "role_arn" { + type = string + description = "arn of the aws oidc role" + default = null # optional +} + +###### for AWS_RBAC the externalID is also needed +variable "role_external_id" { + type = string + description = "external id of the aws rbac role" + default = null # optional; ":" is recommended +} + +################ +# GCP_OIDC Credentials + GCP_STATIC Credentials +################ +variable "gcp_config_file_content" { + type = string + description = "the gco config content gor the connector" + default = null # optional +} + + +# variable "api_key" { +# type = string +# description = "API key to authenticate to StackGuardian" +# } +# variable "org_name" { +# type = string +# description = "Organisation name in StackGuardian platform" +# } +# variable "sg_api_uri" { +# type = string +# description = "Your organization name on StackGuardian Platform" +# } + +# variable "vcs_connectors" { +# description = "A map of connectors and their respective configurations" +# type = map(any) +# default = { +# vcs_gitlab = { +# kind = "GITLAB_COM" +# name = "gitlab-connector" +# config = [{ +# gitlab_creds = { +# gitlabCreds = "gitlabuser:gitlab_pat", +# gitlabHttpUrl = "https://gitlab.com", +# gitlabApiUrl = "https://gitlab.com/api/v4" +# } +# }] +# }, +# vcs_github = { +# name = "github-connector" +# kind = "GITHUB_COM" +# config = [{ +# github_creds = { +# githubCreds = "username:personal_access_token" +# github_com_url = "https://api.github.com" +# github_http_url = "https://github.com" +# } +# }] +# }, +# vcs_bitbucket = { +# name = "bitbucket-connector" +# kind = "BITBUCKET_ORG" +# config = [{ +# bitbucket_creds = { +# bitbucket_creds = "" +# } +# }] +# } +# } +# } diff --git a/stackguardian_role/provider.tf b/stackguardian_role/provider.tf index 65bfd24..379f988 100644 --- a/stackguardian_role/provider.tf +++ b/stackguardian_role/provider.tf @@ -2,7 +2,13 @@ terraform { required_providers { stackguardian = { source = "StackGuardian/stackguardian" - version = "1.3.1" + version = "1.12.0" } } +} + +provider "stackguardian" { + org_name = var.org_name + api_key = var.api_key + api_uri = var.sg_api_uri } \ No newline at end of file diff --git a/stackguardian_role/variables.tf b/stackguardian_role/variables.tf index 504685a..5c18ae0 100644 --- a/stackguardian_role/variables.tf +++ b/stackguardian_role/variables.tf @@ -7,6 +7,10 @@ variable "org_name" { type = string description = "name of the organization on StackGuardian that you want to work with" } +variable "sg_api_uri" { + type = string + description = "Your organization name on StackGuardian Platform" +} variable "workflow_groups" { type = list(string) description = "The list of workflow groups" diff --git a/stackguardian_role_assignment/provider.tf b/stackguardian_role_assignment/provider.tf index 65bfd24..379f988 100644 --- a/stackguardian_role_assignment/provider.tf +++ b/stackguardian_role_assignment/provider.tf @@ -2,7 +2,13 @@ terraform { required_providers { stackguardian = { source = "StackGuardian/stackguardian" - version = "1.3.1" + version = "1.12.0" } } +} + +provider "stackguardian" { + org_name = var.org_name + api_key = var.api_key + api_uri = var.sg_api_uri } \ No newline at end of file diff --git a/stackguardian_role_assignment/variables.tf b/stackguardian_role_assignment/variables.tf index b610071..f2288be 100644 --- a/stackguardian_role_assignment/variables.tf +++ b/stackguardian_role_assignment/variables.tf @@ -6,6 +6,10 @@ variable "org_name" { type = string description = "name of the organization on StackGuardian that you want to work with" } +variable "sg_api_uri" { + type = string + description = "Your organization name on StackGuardian Platform" +} variable "user_or_group" { type = string description = "Group or User that should be onboarded" diff --git a/stackguardian_workflow_group/provider.tf b/stackguardian_workflow_group/provider.tf index 65bfd24..379f988 100644 --- a/stackguardian_workflow_group/provider.tf +++ b/stackguardian_workflow_group/provider.tf @@ -2,7 +2,13 @@ terraform { required_providers { stackguardian = { source = "StackGuardian/stackguardian" - version = "1.3.1" + version = "1.12.0" } } +} + +provider "stackguardian" { + org_name = var.org_name + api_key = var.api_key + api_uri = var.sg_api_uri } \ No newline at end of file diff --git a/stackguardian_workflow_group/variables.tf b/stackguardian_workflow_group/variables.tf index 956794e..552a6f9 100644 --- a/stackguardian_workflow_group/variables.tf +++ b/stackguardian_workflow_group/variables.tf @@ -12,3 +12,8 @@ variable "org_name" { type = string description = "Your organization name on StackGuardian Platform" } + +variable "sg_api_uri" { + type = string + description = "Your organization name on StackGuardian Platform" +}