-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from draios/add-setup-cloud-env
[instruqt-setup-script] support install for cloudVision Terraform installer + isolate option to set region for track's sysdig tab
- Loading branch information
Showing
6 changed files
with
482 additions
and
38 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
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,44 @@ | ||
terraform { | ||
required_providers { | ||
sysdig = { | ||
source = "sysdiglabs/sysdig" | ||
} | ||
} | ||
} | ||
|
||
variable "training_secure_api_token" { | ||
type = string | ||
description = "The Sysdig API token" | ||
} | ||
|
||
variable "training_secure_url" { | ||
type = string | ||
description = "The Sysdig Secure URL" | ||
} | ||
|
||
variable "training_aws_region" { | ||
type = string | ||
description = "The AWS Region" | ||
} | ||
|
||
variable "deploy_scanner" { | ||
type = bool | ||
description = "If true, deploys the Sysdig Scanner for ECR and Fargate" | ||
} | ||
|
||
provider "sysdig" { | ||
sysdig_secure_url = var.training_secure_url | ||
sysdig_secure_api_token = var.training_secure_api_token | ||
} | ||
|
||
provider "aws" { | ||
region = var.training_aws_region | ||
} | ||
|
||
module "secure-for-cloud_example_single-account" { | ||
source = "sysdiglabs/secure-for-cloud/aws//examples/single-account" | ||
|
||
deploy_image_scanning_ecs = var.deploy_scanner | ||
deploy_image_scanning_ecr = var.deploy_scanner | ||
deploy_beta_image_scanning_ecr = var.deploy_scanner | ||
} |
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,45 @@ | ||
terraform { | ||
required_providers { | ||
sysdig = { | ||
source = "sysdiglabs/sysdig" | ||
} | ||
} | ||
} | ||
|
||
variable "training_secure_api_token" { | ||
type = string | ||
description = "The Sysdig API token" | ||
} | ||
|
||
variable "training_secure_url" { | ||
type = string | ||
description = "The Sysdig Secure URL" | ||
} | ||
|
||
variable "training_azure_subscription" { | ||
type = string | ||
description = "Azure Subscription ID" | ||
} | ||
|
||
variable "deploy_scanner" { | ||
type = bool | ||
description = "If true, deploys the Sysdig Scanner for ECR and Fargate" | ||
} | ||
|
||
provider "sysdig" { | ||
sysdig_secure_url = var.training_secure_url | ||
sysdig_secure_api_token = var.training_secure_api_token | ||
} | ||
|
||
provider "azurerm" { | ||
features { } | ||
subscription_id = var.training_azure_subscription | ||
} | ||
|
||
module "secure_for_cloud_example_single_subscription" { | ||
source = "sysdiglabs/secure-for-cloud/azurerm//examples/single-subscription" | ||
|
||
deploy_scanning = var.deploy_scanner | ||
|
||
deploy_active_directory = false | ||
} |
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,60 @@ | ||
terraform { | ||
required_providers { | ||
sysdig = { | ||
source = "sysdiglabs/sysdig" | ||
} | ||
} | ||
} | ||
|
||
variable "training_secure_api_token" { | ||
type = string | ||
description = "The Sysdig API token" | ||
} | ||
|
||
variable "training_secure_url" { | ||
type = string | ||
description = "The Sysdig Secure URL" | ||
} | ||
|
||
variable "training_gcp_region" { | ||
type = string | ||
description = "The Sysdig Secure Region" | ||
} | ||
|
||
variable "training_gcp_project" { | ||
type = string | ||
description = "The Sysdig Secure Region" | ||
} | ||
|
||
variable "gcp_creds" { | ||
type = string | ||
description = "Auth credentials for the GCP SA from Instruqt" | ||
} | ||
|
||
variable "deploy_scanner" { | ||
type = bool | ||
description = "If true, deploys the Sysdig Scanner for ECR and Fargate" | ||
} | ||
|
||
provider "sysdig" { | ||
sysdig_secure_url = var.training_secure_url | ||
sysdig_secure_api_token = var.training_secure_api_token | ||
} | ||
|
||
provider "google" { | ||
project = var.training_gcp_project | ||
region = var.training_gcp_region | ||
credentials = var.gcp_creds | ||
} | ||
|
||
provider "google-beta" { | ||
project = var.training_gcp_project | ||
region = var.training_gcp_region | ||
credentials = var.gcp_creds | ||
} | ||
|
||
module "secure-for-cloud_example_single-project" { | ||
source = "sysdiglabs/secure-for-cloud/google//examples/single-project" | ||
|
||
deploy_scanning = var.deploy_scanner | ||
} |
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,63 @@ | ||
#!/usr/bin/env bash | ||
## | ||
# Deploy the Sysdig Secure for Cloud infra for different cloud vendors | ||
# | ||
# Usage: | ||
# install_with_terraform.sh $PROVIDER $SYSDIG_SECURE_API_TOKEN $SECURE_URL $CLOUD_REGION $CLOUD_ACCOUNT_ID | ||
## | ||
|
||
# logs | ||
OUTPUT=/opt/sysdig/cloud/terraform_install.out | ||
mkdir -p /opt/sysdig/cloud/ | ||
touch $OUTPUT | ||
|
||
PROVIDER=$1 | ||
SYSDIG_SECURE_API_TOKEN=$2 | ||
SECURE_URL=$3 | ||
CLOUD_REGION=$4 | ||
CLOUD_ACCOUNT_ID=$5 | ||
|
||
cd /root/prepare-track/cloud | ||
|
||
if [ "$PROVIDER" == "aws" ] | ||
then | ||
cd aws | ||
echo " Initializing Terraform modules, backend and provider plugins" \ | ||
&& terraform init >> ${OUTPUT} 2>&1 \ | ||
&& echo " Terraform has been successfully initialized. Applying... (this will take a few minutes)" \ | ||
&& terraform apply -auto-approve \ | ||
-var="training_secure_api_token=$SYSDIG_SECURE_API_TOKEN" \ | ||
-var="training_secure_url=$SECURE_URL" \ | ||
-var="training_aws_region=$CLOUD_REGION" \ | ||
-var="deploy_scanner=$USE_CLOUD_SCAN_ENGINE" \ | ||
>> ${OUTPUT} 2>&1 \ | ||
&& echo " Terraform apply completed! Check all TF deployment logs at: $OUTPUT" | ||
fi | ||
|
||
if [ "$PROVIDER" == "gcp" ] | ||
then | ||
cd gcp | ||
echo " Initializing Terraform modules, backend and provider plugins" \ | ||
&& terraform init >> ${OUTPUT} 2>&1 \ | ||
&& echo " Terraform has been successfully initialized. Applying... (this will take a few minutes)" \ | ||
&& terraform apply -auto-approve \ | ||
-var="training_secure_api_token=$SYSDIG_SECURE_API_TOKEN" \ | ||
-var="training_secure_url=$SECURE_URL" \ | ||
-var="training_gcp_region=$CLOUD_REGION" \ | ||
-var="training_gcp_project=$CLOUD_ACCOUNT_ID" \ | ||
-var="gcp_creds=$GOOGLE_CREDENTIALS" \ | ||
-var="deploy_scanner=$USE_CLOUD_SCAN_ENGINE" \ | ||
>> ${OUTPUT} 2>&1 \ | ||
&& echo " Terraform apply completed! Check all TF deployment logs at: $OUTPUT" | ||
fi | ||
|
||
if [ "$PROVIDER" == "azure" ] | ||
then | ||
cd azure | ||
terraform init && terraform apply -auto-approve \ | ||
-var="training_secure_api_token=$SYSDIG_SECURE_API_TOKEN" \ | ||
-var="training_secure_url=$SECURE_URL" \ | ||
-var="training_azure_subscription=$CLOUD_ACCOUNT_ID" \ | ||
-var="deploy_scanner=$USE_CLOUD_SCAN_ENGINE" #\ | ||
#-y >> ${OUTPUT} 2>&1 | ||
fi |
Oops, something went wrong.