-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: suppressdiff for gcp_cfg private_key_id (#380)
* fix: suppressdiff for gcp_cfg private_key_id
- Loading branch information
1 parent
20a386c
commit 7188601
Showing
4 changed files
with
104 additions
and
7 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,14 +1,48 @@ | ||
terraform { | ||
required_providers { | ||
lacework = { | ||
source = "lacework/lacework" | ||
} | ||
} | ||
} | ||
|
||
provider "lacework" {} | ||
|
||
resource "lacework_integration_gcp_cfg" "example" { | ||
name = "Example-GCP-Integration" | ||
name = var.integration_name | ||
credentials { | ||
client_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | ||
private_key_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | ||
client_email = "[email protected]" | ||
private_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | ||
client_id = var.client_id | ||
client_email = var.client_email | ||
private_key_id = var.private_key_id | ||
private_key = var.private_key | ||
} | ||
resource_level = "PROJECT" | ||
resource_id = "example-project_id" | ||
resource_id = "techally-test" | ||
retries = 10 | ||
} | ||
|
||
|
||
variable "integration_name" { | ||
type = string | ||
default = "Google Cfg Example" | ||
} | ||
variable "client_id" { | ||
type = string | ||
sensitive = true | ||
} | ||
variable "client_email" { | ||
type = string | ||
sensitive = true | ||
} | ||
variable "private_key_id" { | ||
type = string | ||
sensitive = true | ||
} | ||
variable "private_key" { | ||
type = string | ||
sensitive = true | ||
} | ||
variable "non_os_package_support" { | ||
type = bool | ||
default = true | ||
} |
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 @@ | ||
package integration | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/gruntwork-io/terratest/modules/terraform" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
// TestIntegrationGcpCfgCreate applies integration terraform: | ||
// => '../examples/resource_lacework_integration_gcp_cfg' | ||
// | ||
// It uses the go-sdk to verify the created integration, | ||
// applies an update with new integration name and destroys it | ||
func TestIntegrationGcpCfgCreate(t *testing.T) { | ||
gcreds, err := googleLoadDefaultCredentials() | ||
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_cfg", | ||
Vars: map[string]interface{}{ | ||
"client_id": gcreds.ClientID, | ||
"client_email": gcreds.ClientEmail, | ||
"private_key_id": gcreds.PrivateKeyID, | ||
}, | ||
EnvVars: map[string]string{ | ||
"TF_VAR_private_key": gcreds.PrivateKey, | ||
"LW_API_TOKEN": LwApiToken, | ||
}, | ||
}) | ||
defer terraform.Destroy(t, terraformOptions) | ||
|
||
// Create new Google Cfg | ||
create := terraform.InitAndApplyAndIdempotent(t, terraformOptions) | ||
createData := GetGcpCfgIntegration(create) | ||
assert.Equal(t, "Google Cfg Example", createData.Data.Name) | ||
|
||
// Update Google Artifact Registry | ||
terraformOptions.Vars["integration_name"] = "Google Cfg Updated" | ||
|
||
update := terraform.ApplyAndIdempotent(t, terraformOptions) | ||
updateData := GetContainerRegistryIntegration(update) | ||
assert.Equal(t, "Google Cfg Updated", updateData.Name) | ||
} | ||
} |
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