Skip to content

Commit

Permalink
Fix: make cloud_credentials data test isolated
Browse files Browse the repository at this point in the history
  • Loading branch information
GiliFaroEnv0 committed Oct 4, 2023
1 parent 0d830a1 commit 67a9647
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion env0/data_cloud_credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func dataCloudCredentials() *schema.Resource {
Schema: map[string]*schema.Schema{
"names": {
Type: schema.TypeList,
Description: "list of all cloud credentials (by name), optionaly filtered by credential_type",
Description: "list of all cloud credentials (by name), optionally filtered by credential_type",
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
Expand Down
23 changes: 14 additions & 9 deletions tests/integration/024_cloud_credentials/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,19 @@ data "env0_cloud_credentials" "all_aws_credentials" {
credential_type = "AWS_ASSUMED_ROLE_FOR_DEPLOYMENT"
}

data "env0_aws_credentials" "aws_credentials1" {
name = data.env0_cloud_credentials.all_aws_credentials.names[index(data.env0_cloud_credentials.all_aws_credentials.names, env0_aws_credentials.aws_cred1.name)]
}

data "env0_aws_credentials" "aws_credentials2" {
name = data.env0_cloud_credentials.all_aws_credentials.names[index(data.env0_cloud_credentials.all_aws_credentials.names, env0_aws_credentials.aws_cred2.name)]
}
//data "env0_aws_credentials" "aws_credentials1" {
// name = data.env0_cloud_credentials.all_aws_credentials.names[index(data.env0_cloud_credentials.all_aws_credentials.names, env0_aws_credentials.aws_cred1.name)]
//}
//
//data "env0_aws_credentials" "aws_credentials2" {
// name = data.env0_cloud_credentials.all_aws_credentials.names[index(data.env0_cloud_credentials.all_aws_credentials.names, env0_aws_credentials.aws_cred2.name)]
//}
//
//output "credentials_name" {
// value = var.second_run ? replace(data.env0_aws_credentials.aws_credentials1.name, random_string.random.result, "") : ""
//}

output "credentials_name" {
value = var.second_run ? replace(data.env0_aws_credentials.aws_credentials1.name, random_string.random.result, "") : ""
output "credentials_names" {
for_each = toset(data.env0_cloud_credentials.all_aws_credentials.names)
value = each.value
}

0 comments on commit 67a9647

Please sign in to comment.