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

Template tags from Ruby erb file in GO file #572

Closed
daniel-cit opened this issue Oct 30, 2020 · 6 comments
Closed

Template tags from Ruby erb file in GO file #572

daniel-cit opened this issue Oct 30, 2020 · 6 comments

Comments

@daniel-cit
Copy link

The template tags

<% unless version == 'ga' -%>
....
<% end -%>

from the original magic-modules ERB file:

https://github.com/GoogleCloudPlatform/magic-modules/blob/master/third_party/terraform/utils/compute_instance_helpers.go.erb

are still present in the generated GO file:




@daniel-cit
Copy link
Author

@bharathkkb this issue brakes compilation in terraform-validator after after vendor folder update

@bharathkkb
Copy link
Member

@ndmckinley Can you PTAL? Seems like this is from GoogleCloudPlatform/magic-modules#3634 and IIUC shouldn't the erb file be in compile_file_list?

@daniel-cit
Copy link
Author

daniel-cit commented Nov 2, 2020

after manually fixing the erb code issue in my local clone, we still have 30 compilation errors:

"terraform-google-conversion/google/accessapproval_folder_settings.go",
"error": "undeclared name: hashcode",
"Line": 47, "Column": 9
-----------------------------------
"terraform-google-conversion/google/compute_backend_service.go",
"error": "undeclared name: hashcode",
"Line": 161, "Column": 58
-----------------------------------
"terraform-google-conversion/google/compute_backend_service.go",
"error": "undeclared name: hashcode",
"Line": 162, "Column": 9
-----------------------------------
"terraform-google-conversion/google/compute_disk.go",
"error": "cannot use d (variable of type TerraformResourceData) as *schema.ResourceData value in argument to generateUserAgentString",
"Line": 331, "Column": 44
-----------------------------------
"terraform-google-conversion/google/compute_firewall.go",
"error": "undeclared name: hashcode",
"Line": 44, "Column": 9
-----------------------------------
"terraform-google-conversion/google/compute_instance.go",
"error": "cannot use expandShieldedVmConfigs(d) (value of type *v0.beta.ShieldedInstanceConfig) as *v0.beta.ShieldedVmConfig value in struct literal",
"Line": 150, "Column": 23
-----------------------------------
"terraform-google-conversion/google/compute_instance.go",
"error": "cannot use d (variable of type TerraformResourceData) as *schema.ResourceData value in argument to generateUserAgentString",
"Line": 237, "Column": 44
-----------------------------------
"terraform-google-conversion/google/compute_region_disk.go",
"error": "cannot use d (variable of type TerraformResourceData) as *schema.ResourceData value in argument to generateUserAgentString",
"Line": 130, "Column": 44
-----------------------------------
"terraform-google-conversion/google/compute_route.go",
"error": "cannot use d.(*schema.ResourceData) (comma, ok expression of type *schema.ResourceData) as *schema.ResourceData value in argument to generateUserAgentString",
"Line": 162, "Column": 44
-----------------------------------
"terraform-google-conversion/google/compute_subnetwork.go",
"error": "undeclared name: cidr",
"Line": 36, "Column": 22
-----------------------------------
"terraform-google-conversion/google/config.go",
"error": "undeclared name: dataflow",
"Line": 471, "Column": 55
-----------------------------------
"terraform-google-conversion/google/config.go",
"error": "undeclared name: dataflow",
"Line": 474, "Column": 25
-----------------------------------
"terraform-google-conversion/google/config.go",
"error": "undeclared name: runtimeconfig",
"Line": 513, "Column": 60,
-----------------------------------
"terraform-google-conversion/google/config.go",
"error": "undeclared name: runtimeconfig",
"Line": 516, "Column": 30
-----------------------------------
"terraform-google-conversion/google/config.go",
"error": "undeclared name: pathOrContents",
"Line": 846, "Column": 23
-----------------------------------
"terraform-google-conversion/google/config.go",
"error": "undeclared name: pathOrContents",
"Line": 870, "Column": 23
-----------------------------------
"terraform-google-conversion/google/constants.go",
"error": "undeclared name: NewMutexKV",
"Line": 14, "Column": 15
-----------------------------------
"terraform-google-conversion/google/error_retry_predicates.go",
"error": "undeclared name: SqlAdminOperationError",
"Line": 167, "Column": 23
-----------------------------------
"terraform-google-conversion/google/monitoring_slo.go",
"error": "undeclared name: expandMonitoringSloRollingPeriodDays",
"Line": 68, "Column": 28
-----------------------------------
"terraform-google-conversion/google/secretmanager_secret_version.go",
"error": "undeclared name: resourceSecretManagerSecretVersionRead",
"Line": 34, "Column": 9
-----------------------------------
"terraform-google-conversion/google/secretmanager_secret_version.go",
"error": "cannot use d.(*schema.ResourceData) (comma, ok expression of type *schema.ResourceData) as *schema.ResourceData value in argument to generateUserAgentString",
"Line": 96, "Column": 44
-----------------------------------
"terraform-google-conversion/google/self_link_helpers.go",
"error": "undeclared name: hashcode",
"Line": 59, "Column": 9
-----------------------------------
"terraform-google-conversion/google/self_link_helpers.go",
"error": "undeclared name: hashcode",
"Line": 74, "Column": 9
-----------------------------------
"terraform-google-conversion/google/source_repo_utils.go",
"error": "undeclared name: PubsubTopicRegex",
"Line": 7, "Column": 32,
-----------------------------------
"terraform-google-conversion/google/source_repo_utils.go",
"error": "undeclared name: getComputedTopicName",
"Line": 21, "Column": 9
-----------------------------------
"terraform-google-conversion/google/sourcerepo_repository.go",
"error": "undeclared name: hashcode",
"Line": 39, "Column": 9
-----------------------------------
"terraform-google-conversion/google/sql_database_instance.go",
"error": "cannot use _settings[\"disk_autoresize\"].(bool) (value of type bool) as *bool value in assignment",
"Line": 113, "Column": 32
-----------------------------------
"terraform-google-conversion/google/utils.go",
"error": "undeclared name: terraform",
"Line": 435, "Column": 34
-----------------------------------
"terraform-google-conversion/google/utils.go",
"error": "undeclared name: terraform",
"Line": 435, "Column": 79

half can be fixed by adding some missing files that were not copied from magic-modules:

  • third_party/terraform/utils/pubsub_utils.go
  • third_party/terraform/utils/sqladmin_operation.go
  • third_party/terraform/utils/path_or_contents.go
  • third_party/terraform/utils/mutexkv.go
  • third_party/terraform/utils/hashcode.go

@daniel-cit
Copy link
Author

It looks like the missing import errors for:

  • terraform
  • runtimeconfig
  • dataflow
  • cidr
  • bigtableadmin

where caused by this commit
c6cb25e#diff-1417d70b9f81d0a5473d4d389c8fa76ce4538c95184aab340f5d61d3fe55ad5e

from this PR in magic-modules: GoogleCloudPlatform/magic-modules#3436

@nat-henderson
Copy link
Contributor

Oh, wow, that looks like it was done back in May. Has this been broken since May?

Are you looking for someone to fix it, or are you planning to do it yourself? Broadly speaking my team does not support this code - we assisted with the creation of the tooling that allows it to work, but we have no ongoing operations budget for it.

I might be able to find some time as a one-off to fix this if need be. What do you think? @bharathkkb @daniel-cit

@melinath
Copy link
Member

This repository is not intended to have issues filed against it. Please open an issue (if still needed) at https://github.com/GoogleCloudPlatform/terraform-validator

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

No branches or pull requests

4 participants