crossplane / terrajet

Generate Crossplane Providers from any Terraform Provider
https://crossplane.io
Apache License 2.0
290 stars 38 forks source link

Generate example YAMLs #48

Closed muvaf closed 2 years ago

muvaf commented 3 years ago

What problem are you facing?

Right now at this scale (+700 for AWS +650 for Azure etc.), we cannot write an example YAML for each resource. But we need them for documentation, Crossplane Conformance and just to make sure resource-specific stuff works, like external-name -> id field.

How could Terrajet help solve your problem?

We can have a tool that will take HCL example and print its YAML version using the same strcase instance that our schema generator uses. The source of input would depend on provider but for example, AWS stores examples in their repo directly though it's not a complete list.

muvaf commented 2 years ago

@jbw976 mentioned that having an example YAML generated with the skeleton schema could help bootstrapping the examples. For example, we can have an example YAML generated like the following:

#
# This file is generated by Terrajet to help the author of examples.
# Please uncomment the lines once you test and make sure the example works.
#
#apiVersion: ec2.aws.tf.crossplane.io/v1alpha1
#kind: Instance
#metadata:
#  name: sample-instance
#spec:
#  forProvider:
#    region: some_value
#    ami: some_value
#    instanceType: some_value
turkenh commented 2 years ago

Cross-linking this comment here.

Here is the source of examples for aws_instance: https://github.com/hashicorp/terraform-provider-aws/blob/main/website/docs/r/instance.html.markdown#example-usage

muvaf commented 2 years ago

@ulucinar Bunch of PRs have been opened. As we talked last week, could you write down about the approach you're taking in this issue and some other possible options for discussion before going further?

ulucinar commented 2 years ago

Closing this issue as we have generated example manifests for the big three providers with the following PRs: