From 5bd774baac888affa1ca913c02a739b8b26b7788 Mon Sep 17 00:00:00 2001 From: Yoriyasu Yano <430092+yorinasub17@users.noreply.github.com> Date: Tue, 20 Dec 2022 11:05:13 -0600 Subject: [PATCH] Flesh out README with initial usage docs (#9) Signed-off-by: Yoriyasu Yano <430092+yorinasub17@users.noreply.github.com> --- CONTRIBUTING.md | 32 +++++++++++++++++++ README.md | 81 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..d70fbbe --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,32 @@ +# How to contribute to tf.libsonnet + +**Filing issues** + +- **Report bugs and feature requests on the libgenerator repository as GitHub issues**. This is an autogenerated + library, which means that any bugs and feature requests need to be reported on the [libgenerator + project](https://github.com/tf-libsonnet/libgenerator) which is responsible for generating this repository. If you + found an issue, you can open a new issue from [this + link](https://github.com/tf-libsonnet/libgenerator/issues/new/choose). +- **Do not open a GitHub issue if you are reporting a security vulnerability with the tf.libsonnet project**. Instead, + refer to our [security policy](/SECURITY.md). + + +**Contributing a change** + +- **This is an autogenerated library**. This means that all contributions will not be merged until the changes can be + autogenerated from the generator. You may still open a Pull Request with a suggested change, especially if it helps + augment an issue description by providing an example of what should be generated. +- **All commits must be signed off to adhere to the Developer Certificate of Origin (DCO)**. If you are contributing a + change to `libgenerator`, note that the `tf.libsonnet` org requires all contributors to sign off on [the + DCO](https://developercertificate.org/). You can do this with the `-s` flag when making commits with `git commit`. + - If you forgot to sign off on any commits in a Pull Request, you can amend the offending commit with `git commit -s + --amend`. +- **All commits must be signed**. The `tf.libsonnet` org requires all contributors to [sign their + commits](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits). If you do + not wish to maintain a set of private keys on your account, you can also use the + [sigstore/gitsign](https://github.com/sigstore/gitsign) project for keyless signing with your GitHub account. + +**Support** + +- Ask any question about how to use the `tf.libsonnet` libraries in the [Organization + GitHub Discussion](https://github.com/orgs/tf-libsonnet/discussions). diff --git a/README.md b/README.md index f85320d..b836def 100644 --- a/README.md +++ b/README.md @@ -23,3 +23,84 @@ This repository contains [Jsonnet](https://jsonnet.org/) functions for generatin > > If you would like to contribute a change, you may open a Pull Request with a suggested change, but please note that it > will **not be merged in until the necessary updates have been made to the generator**. + +## Usage + +Install the package using [jsonnet-bundler](https://github.com/jsonnet-bundler/jsonnet-bundler): + +``` +jb install github.com/tf-libsonnet/hashicorp-azuread@main + +# Or if you want to install a specific release +# jb install github.com/tf-libsonnet/hashicorp-azuread@v0.0.1 +# Or if you want to install bindings for a specific provider major version series +# jb install github.com/tf-libsonnet/hashicorp-azuread/2.x@main +``` + +You can then import the package in your Jsonnet code: + +```jsonnet +// main.tf.json.jsonnet +local azuread = import 'github.com/tf-libsonnet/hashicorp-azuread/main.libsonnet'; + +local tid = '00000000-0000-0000-0000-000000000000'; + +local o = + azuread.data.client_config.new('current') + + azuread.group.new( + 'example', + display_name='example', + owners=[o._ref.data.azuread_client_config.current.get('object_id')], + security_enabled=true, + ); + +azuread.provider.new(tenant_id=tid, src='hashicorp/azuread') ++ o +``` + +This will generate the following Terraform JSON : + +```json +{ + "data": { + "azuread_client_config": { + "current": { } + } + }, + "provider": { + "azuread": [ + { + "tenant_id": "00000000-0000-0000-0000-000000000000" + } + ] + }, + "resource": { + "azuread_group": { + "example": { + "display_name": "example", + "owners": [ + "${data.azuread_client_config.current.object_id}" + ], + "security_enabled": true + } + } + }, + "terraform": { + "required_providers": { + "azuread": { + "source": "hashicorp/azuread" + } + } + } +} +``` + +Refer to the [reference docs](/docs/2.x/README.md) for a list of supported data sources and resources: + +- [provider config](/docs/2.x/provider.md) +- [resources](/docs/2.x/README.md) +- [data sources](/docs/2.x/data/index.md) + +## Contributing + +Refer to the [CONTRIBUTING.md](/CONTRIBUTING.md) document for information on how to contribute to `tf.libsonnet`.