From cb40e0d24bd205641a99560401f6574a4c0162f3 Mon Sep 17 00:00:00 2001 From: Whitney Smith Date: Thu, 25 May 2023 15:58:00 +0000 Subject: [PATCH] fix integration test for org acct --- .../main.tf | 1 - .../main.tf | 18 - ...gration_aws_org_agentless_scanning_test.go | 13 +- ...work_integration_gcp_agentless_scanning.go | 561 +++++++----------- .../terratest/modules/terraform/apply.go | 1 - .../terratest/modules/terraform/init.go | 4 - 6 files changed, 209 insertions(+), 389 deletions(-) diff --git a/examples/resource_lacework_integration_aws_org_agentless_scanning/main.tf b/examples/resource_lacework_integration_aws_org_agentless_scanning/main.tf index b7db122a7..b770726f2 100644 --- a/examples/resource_lacework_integration_aws_org_agentless_scanning/main.tf +++ b/examples/resource_lacework_integration_aws_org_agentless_scanning/main.tf @@ -11,7 +11,6 @@ provider "lacework" { } resource "lacework_integration_aws_org_agentless_scanning" "example" { - name = var.name query_text = var.query_text scan_frequency = 24 diff --git a/examples/resource_lacework_integration_gcp_agentless_scanning/main.tf b/examples/resource_lacework_integration_gcp_agentless_scanning/main.tf index dc3048f8c..ee6f254ff 100644 --- a/examples/resource_lacework_integration_gcp_agentless_scanning/main.tf +++ b/examples/resource_lacework_integration_gcp_agentless_scanning/main.tf @@ -66,10 +66,6 @@ variable "filter_list" { default = ["proj1", "proj2"] } -variable "org_account_mappings" { - -} - resource "lacework_integration_gcp_agentless_scanning" "example" { name = var.integration_name credentials { @@ -88,20 +84,6 @@ resource "lacework_integration_gcp_agentless_scanning" "example" { scan_host_vulnerabilities = true query_text = var.query_text filter_list = var.filter_list - - org_account_mappings { - default_lacework_account = "lw_account_1" - - mapping { - lacework_account = "lw_account_2" - gcp_projects = ["234556677", "774564564"] - } - - mapping { - lacework_account = "lw_account_3" - gcp_projects = ["553453453", "934534535"] - } - } } output "name" { diff --git a/integration/resource_lacework_integration_aws_org_agentless_scanning_test.go b/integration/resource_lacework_integration_aws_org_agentless_scanning_test.go index a8dd82650..74c2289da 100644 --- a/integration/resource_lacework_integration_aws_org_agentless_scanning_test.go +++ b/integration/resource_lacework_integration_aws_org_agentless_scanning_test.go @@ -15,10 +15,6 @@ import ( // nolint func TestIntegrationAwsOrgAgentlessScanningLog(t *testing.T) { - // awsCreds, err := awsLoadDefaultCredentials() - // if err != nil { - // println("Error when getting awscreds: ", err) - // } terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_integration_aws_org_agentless_scanning", Vars: map[string]interface{}{ @@ -27,6 +23,8 @@ func TestIntegrationAwsOrgAgentlessScanningLog(t *testing.T) { "scanning_account": "259832199722", "management_account": "259832199722", "monitored_accounts": []string{"327958430571", "460445523461"}, + "role_arn": "arn:aws:iam::249446771485:role/lacework-iam-example-role", + "external_id": "12345", "org_account_mappings": []map[string]interface{}{ { "default_lacework_account": "agentless", @@ -38,7 +36,8 @@ func TestIntegrationAwsOrgAgentlessScanningLog(t *testing.T) { }, }, }, - }}) + }, + }) defer terraform.Destroy(t, terraformOptions) @@ -62,12 +61,14 @@ func TestIntegrationAwsOrgAgentlessScanningLog(t *testing.T) { "scanning_account": "259832199722", "management_account": "259832199722", "monitored_accounts": []string{"327958430571", "460445523461"}, + "role_arn": "arn:aws:iam::249446771485:role/lacework-iam-example-role", + "external_id": "12345678", "org_account_mappings": []map[string]interface{}{ { "default_lacework_account": "agentless", "integration_mappings": []map[string]interface{}{ { - "lacework_account": "sub1", + "lacework_account": "sub2", "aws_accounts": []string{"327958430571"}, }, }, diff --git a/lacework/resource_lacework_integration_gcp_agentless_scanning.go b/lacework/resource_lacework_integration_gcp_agentless_scanning.go index e1b6edc90..7c7c166b1 100644 --- a/lacework/resource_lacework_integration_gcp_agentless_scanning.go +++ b/lacework/resource_lacework_integration_gcp_agentless_scanning.go @@ -2,7 +2,6 @@ package lacework import ( "context" - "encoding/json" "fmt" "log" "strings" @@ -19,222 +18,186 @@ func resourceLaceworkIntegrationGcpAgentlessScanning() *schema.Resource { Read: resourceLaceworkIntegrationGcpAgentlessScanningRead, Update: resourceLaceworkIntegrationGcpAgentlessScanningUpdate, Delete: resourceLaceworkIntegrationGcpAgentlessScanningDelete, - Schema: gcpAgentlessScanningIntegrationSchema, + Importer: &schema.ResourceImporter{ State: importLaceworkCloudAccount, }, - } -} -var gcpAgentlessScanningIntegrationSchema = map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: "The integration name.", - }, - "intg_guid": { - Type: schema.TypeString, - Computed: true, - }, - "enabled": { - Type: schema.TypeBool, - Optional: true, - Default: true, - Description: "The state of the external integration.", - }, - "retries": { - Type: schema.TypeInt, - Optional: true, - Default: 5, - Description: "The number of attempts to create the external integration.", - }, - "credentials": { - Type: schema.TypeList, - MaxItems: 1, - Required: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "client_id": { - Type: schema.TypeString, - Required: true, - Description: "Client Id from credentials file.", - }, - "private_key_id": { - Type: schema.TypeString, - Required: true, - DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { - return !d.HasChanges( - "name", "resource_level", "resource_id", "org_level", "enabled", - "credentials.0.client_id", - "credentials.0.client_email", - ) + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + Description: "The integration name.", + }, + "intg_guid": { + Type: schema.TypeString, + Computed: true, + }, + "enabled": { + Type: schema.TypeBool, + Optional: true, + Default: true, + Description: "The state of the external integration.", + }, + "retries": { + Type: schema.TypeInt, + Optional: true, + Default: 5, + Description: "The number of attempts to create the external integration.", + }, + "credentials": { + Type: schema.TypeList, + MaxItems: 1, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "client_id": { + Type: schema.TypeString, + Required: true, + Description: "Client Id from credentials file.", + }, + "private_key_id": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return !d.HasChanges( + "name", "resource_level", "resource_id", "org_level", "enabled", + "credentials.0.client_id", + "credentials.0.client_email", + ) + }, + Description: "Private Key Id from credentials file.", + }, + "client_email": { + Type: schema.TypeString, + Required: true, + Description: "Client email from credentials file.", + }, + "private_key": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + // @afiune we can't compare this element since our API, for security reasons, + // does NOT return the private key configured in the Lacework server. So if + // any other element changed from the credentials then we trigger a diff + return !d.HasChanges( + "name", "resource_level", "resource_id", "org_level", "enabled", + "credentials.0.client_id", + "credentials.0.client_email", + ) + }, + Description: "Private Key from credentials file.", + }, + "token_uri": { + Type: schema.TypeString, + Optional: true, + Default: "https://oauth2.googleapis.com/token", + Description: "Token URI from credentials file.", + }, }, - Description: "Private Key Id from credentials file.", - }, - "client_email": { - Type: schema.TypeString, - Required: true, - Description: "Client email from credentials file.", }, - "private_key": { - Type: schema.TypeString, - Required: true, - Sensitive: true, - DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { - // @afiune we can't compare this element since our API, for security reasons, - // does NOT return the private key configured in the Lacework server. So if - // any other element changed from the credentials then we trigger a diff - return !d.HasChanges( - "name", "resource_level", "resource_id", "org_level", "enabled", - "credentials.0.client_id", - "credentials.0.client_email", - ) - }, - Description: "Private Key from credentials file.", + }, + "resource_level": { + Type: schema.TypeString, + Optional: true, + Default: api.GcpProjectIntegration.String(), + StateFunc: func(val interface{}) string { + return strings.ToUpper(val.(string)) }, - "token_uri": { - Type: schema.TypeString, - Optional: true, - Default: "https://oauth2.googleapis.com/token", - Description: "Token URI from credentials file.", + ValidateFunc: func(value interface{}, key string) ([]string, []error) { + switch strings.ToUpper(value.(string)) { + case api.GcpProjectIntegration.String(), + api.GcpOrganizationIntegration.String(): + return nil, nil + default: + return nil, []error{ + fmt.Errorf("%s: can only be either '%s' or '%s'", + key, + api.GcpProjectIntegration.String(), + api.GcpOrganizationIntegration.String()), + } + } }, + Description: "Integration level - ORGANIZATION / PROJECT.", }, - }, - }, - "resource_level": { - Type: schema.TypeString, - Optional: true, - Default: api.GcpProjectIntegration.String(), - StateFunc: func(val interface{}) string { - return strings.ToUpper(val.(string)) - }, - ValidateFunc: func(value interface{}, key string) ([]string, []error) { - switch strings.ToUpper(value.(string)) { - case api.GcpProjectIntegration.String(), - api.GcpOrganizationIntegration.String(): - return nil, nil - default: - return nil, []error{ - fmt.Errorf("%s: can only be either '%s' or '%s'", - key, - api.GcpProjectIntegration.String(), - api.GcpOrganizationIntegration.String()), - } - } - }, - Description: "Integration level - ORGANIZATION / PROJECT.", - }, - "resource_id": { - Type: schema.TypeString, - Required: true, - Description: "Organization Id or Project Id.", - }, - "created_or_updated_time": { - Type: schema.TypeString, - Computed: true, - }, - "created_or_updated_by": { - Type: schema.TypeString, - Computed: true, - }, - "type_name": { - Type: schema.TypeString, - Computed: true, - }, - "org_level": { - Type: schema.TypeBool, - Computed: true, - }, - "server_token": { - Type: schema.TypeString, - Computed: true, - }, - "uri": { - Type: schema.TypeString, - Computed: true, - }, - "bucket_name": { - Type: schema.TypeString, - Required: true, - Description: "Bucket containing analysis results shared with Lacework platform.", - }, - "scanning_project_id": { - Type: schema.TypeString, - Required: true, - Description: "Project ID where scanner is deployed.", - }, - "scan_frequency": { - Type: schema.TypeInt, - Optional: true, - Default: 24, - Description: "How often in hours the scan will run in hours.", - }, - "scan_containers": { - Type: schema.TypeBool, - Optional: true, - Default: true, - Description: "Whether to includes scanning for containers.", - }, - "scan_host_vulnerabilities": { - Type: schema.TypeBool, - Optional: true, - Default: true, - Description: "Whether to includes scanning for host vulnerabilities.", - }, - "query_text": { - Type: schema.TypeString, - Optional: true, - Default: "", - Description: "The LQL query text.", - }, - "filter_list": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - StateFunc: func(val interface{}) string { - return strings.TrimSpace(val.(string)) + "resource_id": { + Type: schema.TypeString, + Required: true, + Description: "Organization Id or Project Id.", }, - }, - Default: nil, - Description: "List of Projects to specifically include/exclude.", - }, - "org_account_mappings": { - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Description: "Mapping of GCP projects to Lacework accounts within a Lacework organization.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "default_lacework_account": { - Type: schema.TypeString, - Required: true, - Description: "The default Lacework account name where any non-mapped AWS account will appear", - }, - "integration_mappings": { - Type: schema.TypeSet, - Required: true, - Description: "A map of GCP Projects to Lacework accounts. This can be specified multiple times to map multiple Lacework accounts.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "lacework_account": { - Type: schema.TypeString, - Required: true, - Description: "The Lacework account name where the CloudTrail activity from the selected GCP projects will appear.", - }, - "gcp_projects": { - Type: schema.TypeSet, - Elem: &schema.Schema{Type: schema.TypeString}, - MinItems: 1, - Required: true, - Description: "The list of GCP Project IDs to map.", - }, - }, + "created_or_updated_time": { + Type: schema.TypeString, + Computed: true, + }, + "created_or_updated_by": { + Type: schema.TypeString, + Computed: true, + }, + "type_name": { + Type: schema.TypeString, + Computed: true, + }, + "org_level": { + Type: schema.TypeBool, + Computed: true, + }, + "server_token": { + Type: schema.TypeString, + Computed: true, + }, + "uri": { + Type: schema.TypeString, + Computed: true, + }, + "bucket_name": { + Type: schema.TypeString, + Required: true, + Description: "Bucket containing analysis results shared with Lacework platform.", + }, + "scanning_project_id": { + Type: schema.TypeString, + Required: true, + Description: "Project ID where scanner is deployed.", + }, + "scan_frequency": { + Type: schema.TypeInt, + Optional: true, + Default: 24, + Description: "How often in hours the scan will run in hours.", + }, + "scan_containers": { + Type: schema.TypeBool, + Optional: true, + Default: true, + Description: "Whether to includes scanning for containers.", + }, + "scan_host_vulnerabilities": { + Type: schema.TypeBool, + Optional: true, + Default: true, + Description: "Whether to includes scanning for host vulnerabilities.", + }, + "query_text": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: "The LQL query text.", + }, + "filter_list": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + StateFunc: func(val interface{}) string { + return strings.TrimSpace(val.(string)) }, }, + Default: nil, + Description: "List of Projects to specifically include/exclude.", }, }, - }, + } } func resourceLaceworkIntegrationGcpAgentlessScanningCreate(d *schema.ResourceData, meta interface{}) error { @@ -251,39 +214,26 @@ func resourceLaceworkIntegrationGcpAgentlessScanningCreate(d *schema.ResourceDat } log.Printf("[INFO] Creating %s integration\n", api.GcpSidekickCloudAccount.String()) - gcpSidekickData := api.GcpSidekickData{ - ID: d.Get("resource_id").(string), - IDType: resourceLevel.String(), - Credentials: api.GcpSidekickCredentials{ - ClientID: d.Get("credentials.0.client_id").(string), - ClientEmail: d.Get("credentials.0.client_email").(string), - PrivateKeyID: d.Get("credentials.0.private_key_id").(string), - PrivateKey: d.Get("credentials.0.private_key").(string), - TokenUri: d.Get("credentials.0.token_uri").(string), - }, - SharedBucket: d.Get("bucket_name").(string), - ScanningProjectId: d.Get("scanning_project_id").(string), - ScanFrequency: d.Get("scan_frequency").(int), - ScanContainers: d.Get("scan_containers").(bool), - ScanHostVulnerabilities: d.Get("scan_host_vulnerabilities").(bool), - QueryText: d.Get("query_text").(string), - FilterList: strings.Join(castAttributeToStringSlice(d, "filter_list"), ", "), - } - - // verify if the user provided an account mapping - accountMapFile := getGCPAgentlessOrgAccountMappings(d) - if !accountMapFile.accountMappingEmpty() { - accountMapFileBytes, err := json.Marshal(accountMapFile) - if err != nil { - return err - } - - gcpSidekickData.EncodeAccountMappingFile(accountMapFileBytes) // might need to change this? - } - data := api.NewCloudAccount(d.Get("name").(string), api.GcpSidekickCloudAccount, - gcpSidekickData, + api.GcpSidekickData{ + ID: d.Get("resource_id").(string), + IDType: resourceLevel.String(), + Credentials: api.GcpSidekickCredentials{ + ClientID: d.Get("credentials.0.client_id").(string), + ClientEmail: d.Get("credentials.0.client_email").(string), + PrivateKeyID: d.Get("credentials.0.private_key_id").(string), + PrivateKey: d.Get("credentials.0.private_key").(string), + TokenUri: d.Get("credentials.0.token_uri").(string), + }, + SharedBucket: d.Get("bucket_name").(string), + ScanningProjectId: d.Get("scanning_project_id").(string), + ScanFrequency: d.Get("scan_frequency").(int), + ScanContainers: d.Get("scan_containers").(bool), + ScanHostVulnerabilities: d.Get("scan_host_vulnerabilities").(bool), + QueryText: d.Get("query_text").(string), + FilterList: strings.Join(castAttributeToStringSlice(d, "filter_list"), ", "), + }, ) if !d.Get("enabled").(bool) { @@ -377,27 +327,6 @@ func resourceLaceworkIntegrationGcpAgentlessScanningRead(d *schema.ResourceData, d.Set("filter_list", trimmed_filter_list) } - accountMapFileBytes, err := integration.Data.DecodeAccountMappingFile() - if err != nil { - return err - } - - accountMapFile := new(accountMappingsFile) - if len(accountMapFileBytes) != 0 { - // The integration has an account mapping file - // unmarshal its content into the account mapping struct - err := json.Unmarshal(accountMapFileBytes, accountMapFile) - if err != nil { - return fmt.Errorf("Error decoding organization account mapping: %s", err) - } - - } - - err = d.Set("org_account_mappings", flattenGCPAgentlessOrgAccountMappings(accountMapFile)) - if err != nil { - return fmt.Errorf("Error flattening organization account mapping: %s", err) - } - log.Printf("[INFO] Read %s integration with guid: %v\n", api.GcpSidekickCloudAccount.String(), integration.IntgGuid) return nil @@ -417,45 +346,28 @@ func resourceLaceworkIntegrationGcpAgentlessScanningUpdate(d *schema.ResourceDat resourceLevel = api.GcpOrganizationIntegration } - gcpSidekickData := api.GcpSidekickData{ - ID: d.Get("resource_id").(string), - IDType: resourceLevel.String(), - Credentials: api.GcpSidekickCredentials{ - ClientID: d.Get("credentials.0.client_id").(string), - ClientEmail: d.Get("credentials.0.client_email").(string), - PrivateKeyID: d.Get("credentials.0.private_key_id").(string), - PrivateKey: d.Get("credentials.0.private_key").(string), - TokenUri: d.Get("credentials.0.token_uri").(string), - }, - SharedBucket: d.Get("bucket_name").(string), - ScanningProjectId: d.Get("scanning_project_id").(string), - ScanFrequency: d.Get("scan_frequency").(int), - ScanContainers: d.Get("scan_containers").(bool), - ScanHostVulnerabilities: d.Get("scan_host_vulnerabilities").(bool), - QueryText: d.Get("query_text").(string), - FilterList: strings.Join(castAttributeToStringSlice(d, "filter_list"), ", "), - } - - // verify if the user provided an account mapping - accountMapFile := getGCPAgentlessOrgAccountMappings(d) - if !accountMapFile.accountMappingEmpty() { - accountMapFileBytes, err := json.Marshal(accountMapFile) - if err != nil { - return err - } - - gcpSidekickData.EncodeAccountMappingFile(accountMapFileBytes) // might need to change this? - } - data := api.NewCloudAccount(d.Get("name").(string), api.GcpSidekickCloudAccount, - gcpSidekickData, + api.GcpSidekickData{ + ID: d.Get("resource_id").(string), + IDType: resourceLevel.String(), + Credentials: api.GcpSidekickCredentials{ + ClientID: d.Get("credentials.0.client_id").(string), + ClientEmail: d.Get("credentials.0.client_email").(string), + PrivateKeyID: d.Get("credentials.0.private_key_id").(string), + PrivateKey: d.Get("credentials.0.private_key").(string), + TokenUri: d.Get("credentials.0.token_uri").(string), + }, + SharedBucket: d.Get("bucket_name").(string), + ScanningProjectId: d.Get("scanning_project_id").(string), + ScanFrequency: d.Get("scan_frequency").(int), + ScanContainers: d.Get("scan_containers").(bool), + ScanHostVulnerabilities: d.Get("scan_host_vulnerabilities").(bool), + QueryText: d.Get("query_text").(string), + FilterList: strings.Join(castAttributeToStringSlice(d, "filter_list"), ", "), + }, ) - if !accountMapFile.accountMappingEmpty() && gcpSidekickData.IDType == "Organization" { - data.IsOrg = 1 - } - if !d.Get("enabled").(bool) { data.Enabled = 0 } @@ -502,72 +414,3 @@ func resourceLaceworkIntegrationGcpAgentlessScanningDelete(d *schema.ResourceDat api.GcpSidekickCloudAccount.String(), d.Id()) return nil } - -type accountMapping struct { - DefaultLaceworkAccount string `json:"defaultLaceworkAccountAws"` - IntegrationMappings map[string]interface{} `json:"integration_mappings"` -} - -func (f *accountMapping) accountMappingEmpty() bool { - return f.DefaultLaceworkAccount == "" -} - -func getGCPAgentlessOrgAccountMappings(d *schema.ResourceData) *accountMappingFile { - accountMapFile := new(accountMappingFile) - accMapsInt := d.Get("org_account_mappings").([]interface{}) - if len(accMapsInt) != 0 && accMapsInt[0] != nil { - accountMappings := accMapsInt[0].(map[string]interface{}) - - accountMapFile = &accountMappingFile{ - DefaultLaceworkAccount: accountMappings["default_lacework_account"].(string), - IntegrationMappings: map[string]interface{}{}, - } - - mappingSet := accountMappings["mapping"].(*schema.Set) - for _, m := range mappingSet.List() { - mapping := m.(map[string]interface{}) - accountMapFile.IntegrationMappings[mapping["lacework_account"].(string)] = map[string]interface{}{ - "gcp_projects": castStringSlice(mapping["gcp_projects"].(*schema.Set).List()), - } - } - - } - - return accountMapFile -} - -func flattenGCPAgentlessOrgAccountMappings(mappingFile *accountMappingsFile) []map[string]interface{} { - orgAccMappings := make([]map[string]interface{}, 0, 1) - - if mappingFile.Empty() { - return orgAccMappings - } - - mappings := map[string]interface{}{ - "default_lacework_account": mappingFile.DefaultLaceworkAccount, - "mapping": flattenGCPMappings(mappingFile.Mappings), - } - - orgAccMappings = append(orgAccMappings, mappings) - return orgAccMappings -} - -func flattenGCPMappings(mappings map[string]interface{}) *schema.Set { - var ( - orgAccountMappingsSchema = gcpAgentlessScanningIntegrationSchema["org_account_mappings"].Elem.(*schema.Resource) - mappingSchema = orgAccountMappingsSchema.Schema["mapping"].Elem.(*schema.Resource) - gcpProjectsSchema = mappingSchema.Schema["gcp_projects"].Elem.(*schema.Schema) - res = schema.NewSet(schema.HashResource(mappingSchema), []interface{}{}) - ) - for laceworkAccount, m := range mappings { - mappingValue := m.(map[string]interface{}) - res.Add(map[string]interface{}{ - "lacework_account": laceworkAccount, - "gcp_projects": schema.NewSet(schema.HashSchema(gcpProjectsSchema), - mappingValue["gcp_projects"].([]interface{}), - ), - }) - } - - return res -} diff --git a/vendor/github.com/gruntwork-io/terratest/modules/terraform/apply.go b/vendor/github.com/gruntwork-io/terratest/modules/terraform/apply.go index 0918c0fa6..4a0a59156 100644 --- a/vendor/github.com/gruntwork-io/terratest/modules/terraform/apply.go +++ b/vendor/github.com/gruntwork-io/terratest/modules/terraform/apply.go @@ -96,7 +96,6 @@ func ApplyAndIdempotentE(t testing.TestingT, options *Options) (string, error) { // plan again and will fail the test if plan requires additional changes. Note that this method does NOT call destroy and assumes // the caller is responsible for cleaning up any resources created by running apply. func InitAndApplyAndIdempotent(t testing.TestingT, options *Options) string { - println(options.Vars) out, err := InitAndApplyAndIdempotentE(t, options) require.NoError(t, err) diff --git a/vendor/github.com/gruntwork-io/terratest/modules/terraform/init.go b/vendor/github.com/gruntwork-io/terratest/modules/terraform/init.go index b32278659..128fcd458 100644 --- a/vendor/github.com/gruntwork-io/terratest/modules/terraform/init.go +++ b/vendor/github.com/gruntwork-io/terratest/modules/terraform/init.go @@ -3,7 +3,6 @@ package terraform import ( "fmt" - "github.com/gruntwork-io/terratest/modules/logger" "github.com/gruntwork-io/terratest/modules/testing" ) @@ -19,9 +18,6 @@ func Init(t testing.TestingT, options *Options) string { // InitE calls terraform init and return stdout/stderr. func InitE(t testing.TestingT, options *Options) (string, error) { args := []string{"init", fmt.Sprintf("-upgrade=%t", options.Upgrade)} - for i, s := range options.Vars { - logger.Log(t, "Key: %s, Value: %s", i, s) - } // Append reconfigure option if specified if options.Reconfigure {