Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed error of inconsistent conditional result types when evaluating … #1564

Conversation

apichick
Copy link
Collaborator

@apichick apichick commented Aug 2, 2023

…local peer_gateway variable

I was getting the following error:

│ Error: Inconsistent conditional result types
│
│   on .terraform/modules/nonprod_hub.ipsec_over_interconnect/modules/net-ipsec-over-interconnect/main.tf line 20, in locals:
│   19:     var.peer_gateway_config.create
│   20:     ? try(google_compute_external_vpn_gateway.default[0], null)
│   21:     : var.peer_gateway_config
│     ├────────────────
│     │ google_compute_external_vpn_gateway.default[0] is object with 9 attributes
│     │ var.peer_gateway_config is object with 5 attributes
│     │ var.peer_gateway_config.create is true
│
│ The true and false result expressions must have consistent types. The 'true' value includes object attribute "interface", which is
│ absent in the 'false' value.

@apichick apichick merged commit fb003af into GoogleCloudPlatform:master Aug 3, 2023
@wiktorn
Copy link
Collaborator

wiktorn commented Aug 3, 2023

Usual approach that we have in such cases would be to have data resource, that would return the whole structure of google_compute_external_vpn_gateway instead of using config. But such data resource does not exists 😱

The other approach to fix this is to add to output description, that it returns gateway resource only if autocreated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants