[go: nahoru, domu]

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

examples-generated contain terraform variables in the yaml that are not meaningfully consumable #349

Open
humoflife opened this issue Feb 17, 2024 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@humoflife
Copy link

What happened?

Upjet generates examples in the examples-generated folder to make it easy for users to create managed resources. However, the examples can include Terraform variables that are not meaningfully consumable by Crossplane and result in the generated examples not to work.

Some examples of included variables are as follows:

examples-generated/apm/retentionfilterorder.yaml:    - ${datadog_apm_retention_filter.foo.id}
examples-generated/authn/mapping.yaml:    role: ${data.datadog_role.ro_role.id}
examples-generated/dashboard/list.yaml:    - dashId: ${datadog_dashboard.time.id}
examples-generated/dashboard/list.yaml:    - dashId: ${datadog_dashboard.screen.id}
examples-generated/datadog/role.yaml:    - id: ${data.datadog_permissions.bar.permissions.monitors_downtime}
examples-generated/datadog/role.yaml:    - id: ${data.datadog_permissions.bar.permissions.monitors_write}
examples-generated/datadog/serviceaccount.yaml:    - ${data.datadog_role.ro_role.id}
examples-generated/datadog/user.yaml:    - ${data.datadog_role.ro_role.id}
examples-generated/datadog/slocorrection.yaml:    sloId: ${datadog_service_level_objective.example_slo.id}
examples-generated/integration/gcpsts.yaml:    clientEmail: ${google_service_account.datadog_integration.email}
examples-generated/integration/confluentresource.yaml:    accountId: ${datadog_integration_confluent_account.foo.id}
examples-generated/integration/fastlyservice.yaml:    accountId: ${datadog_integration_fastly_account.foo.id}
examples-generated/logs/indexorder.yaml:    - ${datadog_logs_index.sample_index.id}
examples-generated/logs/pipelineorder.yaml:    - ${datadog_logs_custom_pipeline.sample_pipeline.id}
examples-generated/logs/pipelineorder.yaml:    - ${datadog_logs_integration_pipeline.python.id}
examples-generated/logs/archiveorder.yaml:    - ${datadog_logs_archive.sample_archive_1.id}
examples-generated/logs/archiveorder.yaml:    - ${datadog_logs_archive.sample_archive_2.id}
examples-generated/sensitivedatascanner/rule.yaml:    groupId: ${datadog_sensitive_data_scanner_group.mygroup.id}
examples-generated/team/membership.yaml:    teamId: ${datadog_team.foo.id}
examples-generated/team/membership.yaml:    userId: ${datadog_user.foo.id}
examples-generated/team/permissionsetting.yaml:    teamId: ${datadog_team.foo.id}
examples-generated/team/link.yaml:    teamId: ${datadog_team.foo.id}
examples-generated/webhook/webhook.yaml:    customHeaders: '${jsonencode({ "custom" : "header" })}'
examples-generated/webhook/webhook.yaml:    payload: '${jsonencode({ "custom" : "payload" })}'

How can we reproduce it?

This can be reproduced as follows:

- git clone git@github.com:upbound/provider-datadog.git
- git checkout bootstrap
- make submodules
- make clean; make gen-clean; make generate
- make e2e

Once a cluster is up and configured `kubectl apply -f examples-generated/team/membership.yaml'. The membership resource status message will include the following due to the variables:

observe failed: cannot run refresh: refresh failed: Reference to undeclared resource: A managed resource "datadog_team" "foo" has not been declared in the root module. Reference to undeclared resource: A managed resource "datadog_user" "foo" has not been declared in the root module.
@humoflife humoflife added the bug Something isn't working label Feb 17, 2024
@jeanduplessis jeanduplessis added this to the 1.2 milestone Feb 17, 2024
@bobh66
Copy link
Contributor
bobh66 commented Mar 15, 2024

This is very confusing to new users and generates a fair number of questions in Slack. Generated examples should be usable "as is" and not require translation of terraform-specific formats and data references.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants