Skip to content

Conversation

guissalustiano
Copy link
Contributor

On run grep to show variables used in folder I realize that not always in declaration is used
image

This PR remove unnecessary variable
(You can check that has 9 variables on grep, and 9 in variable.tf now)

@daniel-cit
Copy link
Contributor

@guissalustiano thanks for the pull request.

the cause of the failed build is:

plan.go:34: 
Error Trace: /workspace/test/integration/shared/plan.go:34
             /workspace/test/integration/shared/terraform.go:384
             /workspace/test/integration/shared/terraform.go:396
             /workspace/test/integration/shared/terraform.go:408
             /workspace/test/integration/shared/terraform.go:432
             /workspace/test/integration/shared/stages.go:31
             /workspace/test/integration/shared/terraform.go:432
Error: Received unexpected error:
       FatalError{Underlying: error while running command: exit status 1; 
       Error: Value for undeclared variable
       
       A variable named "access_context_manager_policy_id" was assigned on the
       command line, but the root module does not declare a variable of that name.
       To use this value, add a "variable" block to the configuration.
       
       Error: Value for undeclared variable
       
       A variable named "terraform_service_account" was assigned on the command
       line, but the root module does not declare a variable of that name. To use
       this value, add a "variable" block to the configuration.
       }
Test:       	TestShared
2022/10/14 01:52:32 RUN_STAGE env var set to apply
2022/10/14 01:52:32 Skipping stage teardown
--- FAIL: TestShared (12.29s)

the cause is probably that with this change you will need to have two sets of variables in the test, one for the Shared VPC network mode and one for the Hub-and-spoke network mode:

vars := map[string]interface{}{
"access_context_manager_policy_id": policyID,
"remote_state_bucket": backend_bucket,
"terraform_service_account": terraformSA,
}

like is done for the tfDir option

if isHubAndSpokeMode(t) {
tfdDir = "../../../3-networks-hub-and-spoke/envs/shared"
} else {
tfdDir = "../../../3-networks-dual-svpc/envs/shared"
}

@guissalustiano
Copy link
Contributor Author

Thanks for the review!
I don't use golang a lot, so I don't know if this is the best way to add parameters to the map but it should work
(Otherwise I'll have to do the test setup here)

Copy link
Member

@bharathkkb bharathkkb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @guissalustiano

@bharathkkb bharathkkb merged commit 49057b1 into terraform-google-modules:master Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants