Skip to content

Commit

Permalink
Generate libsonnet source from libgenerator PR tf-libsonnet/libgenera…
Browse files Browse the repository at this point in the history
…tor#236

Signed-off-by: tflibsonnet-ci <[email protected]>
  • Loading branch information
renovate[bot] authored and tflibsonnet-ci committed Nov 15, 2023
1 parent 9b79caa commit d194a25
Show file tree
Hide file tree
Showing 18 changed files with 821 additions and 5 deletions.
42 changes: 42 additions & 0 deletions 0.x/_gen/data/iam_policy.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
local tf = (import 'github.com/tf-libsonnet/core/main.libsonnet');
local d = (import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet');
{
'#':: d.pkg(name='iam_policy', url='', help='`iam_policy` represents the `hcp_iam_policy` Terraform data source.\n\nGenerates an IAM policy that may be referenced by and applied to other HCP IAM resources, such as the `hcp_project_iam_policy` resource.\n\nThis package contains functions and utilities for setting up the data source using Jsonnet code.\n'),
'#new':: d.fn(help="\n`hcp.data.iam_policy.new` injects a new `data_hcp_iam_policy` Terraform `data source`\nblock into the root module document.\n\nAdditionally, this inserts a private function into the `_ref` attribute that generates references to attributes of the\nresource. For example, if you added a new instance to the root using:\n\n # arguments omitted for brevity\n hcp.data.iam_policy.new('some_id')\n\nYou can get the reference to the `id` field of the created `hcp.data.iam_policy` using the reference:\n\n $._ref.data_hcp_iam_policy.some_id.get('id')\n\nThis is the same as directly entering `\"${ data_hcp_iam_policy.some_id.id }\"` as the value.\n\nNOTE: if you are chaining multiple resources together in a merge operation, you may not be able to use `super`, `self`,\nor `$` to refer to the root object. Instead, make an explicit outer object using `local`.\n\n**Args**:\n - `dataSrcLabel` (`string`): The name label of the block.\n - `bindings` (`list[obj]`): A binding associates a set of principals to a role.\n\n**Returns**:\n- A mixin object that injects the new data source into the root Terraform configuration.\n", args=[]),
new(
dataSrcLabel,
bindings,
_meta={}
):: tf.withData(
type='hcp_iam_policy',
label=dataSrcLabel,
attrs=self.newAttrs(bindings=bindings),
_meta=_meta
),
'#newAttrs':: d.fn(help='\n`hcp.data.iam_policy.newAttrs` constructs a new object with attributes and blocks configured for the `iam_policy`\nTerraform data source.\n\nUnlike [hcp.data.iam_policy.new](#fn-new), this function will not inject the `data source`\nblock into the root Terraform document. Instead, this must be passed in as the `attrs` argument for the\n[tf.withData](https://github.com/tf-libsonnet/core/tree/main/docs#fn-withdata) function to build a complete block.\n\nThis is most useful when you need to preprocess the attributes with functions, conditional, or looping logic prior to\ninjecting into a complete block.\n\n**Args**:\n - `bindings` (`list[obj]`): A binding associates a set of principals to a role.\n\n**Returns**:\n - An attribute object that can be used with [tf.withData](https://github.com/tf-libsonnet/core/tree/main/docs#fn-withdata) to construct a new `iam_policy` data source into the root Terraform configuration.\n', args=[]),
newAttrs(
bindings
):: std.prune(a={
bindings: bindings,
}),
'#withBindings':: d.fn(help='`hcp.list[obj].withBindings` constructs a mixin object that can be merged into the `list[obj]`\nTerraform data source block to set or update the bindings field.\n\n\n\n**Args**:\n - `dataSrcLabel` (`string`): The name label of the block to update.\n - `value` (`list[obj]`): The value to set for the `bindings` field.\n', args=[]),
withBindings(dataSrcLabel, value): {
data+: {
hcp_iam_policy+: {
[dataSrcLabel]+: {
bindings: value,
},
},
},
},
'#withBindingsMixin':: d.fn(help='`hcp.list[obj].withBindingsMixin` constructs a mixin object that can be merged into the `list[obj]`\nTerraform data source block to set or update the bindings field.\n\nThis function will append the passed in array or object to the existing array. If you wish\nto instead replace the array with the passed in `value`, use the [hcp.list[obj].withBindings](TODO)\nfunction.\n\n\n**Args**:\n - `dataSrcLabel` (`string`): The name label of the block to update.\n - `value` (`list[obj]`): The value to set for the `bindings` field.\n', args=[]),
withBindingsMixin(dataSrcLabel, value):: {
data+: {
hcp_iam_policy+: {
[dataSrcLabel]+: {
bindings+: if std.isArray(v=value) then value else [value],
},
},
},
},
}
1 change: 1 addition & 0 deletions 0.x/_gen/data/main.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ local d = (import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet');
hvn: (import 'hvn.libsonnet'),
hvn_peering_connection: (import 'hvn_peering_connection.libsonnet'),
hvn_route: (import 'hvn_route.libsonnet'),
iam_policy: (import 'iam_policy.libsonnet'),
organization: (import 'organization.libsonnet'),
packer_bucket_names: (import 'packer_bucket_names.libsonnet'),
packer_image: (import 'packer_image.libsonnet'),
Expand Down
4 changes: 4 additions & 0 deletions 0.x/_gen/main.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ local d = (import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet');
hvn_peering_connection: (import 'resources/hvn_peering_connection.libsonnet'),
hvn_route: (import 'resources/hvn_route.libsonnet'),
iam_workload_identity_provider: (import 'resources/iam_workload_identity_provider.libsonnet'),
organization_iam_binding: (import 'resources/organization_iam_binding.libsonnet'),
organization_iam_policy: (import 'resources/organization_iam_policy.libsonnet'),
packer_channel: (import 'resources/packer_channel.libsonnet'),
packer_channel_assignment: (import 'resources/packer_channel_assignment.libsonnet'),
packer_run_task: (import 'resources/packer_run_task.libsonnet'),
project: (import 'resources/project.libsonnet'),
project_iam_binding: (import 'resources/project_iam_binding.libsonnet'),
project_iam_policy: (import 'resources/project_iam_policy.libsonnet'),
service_principal: (import 'resources/service_principal.libsonnet'),
service_principal_key: (import 'resources/service_principal_key.libsonnet'),
vault_cluster: (import 'resources/vault_cluster.libsonnet'),
Expand Down
14 changes: 11 additions & 3 deletions 0.x/_gen/provider_hcp.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ local tf = (import 'github.com/tf-libsonnet/core/main.libsonnet');
local d = (import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet');
{
'#':: d.pkg(name='provider', url='', help='`provider` represents the `hcp` Terraform provider config.\n\n\n\nThis package contains functions and utilities for setting up the provider using Jsonnet code.\n'),
'#new':: d.fn(help='\n`hcp.provider.new` injects a new `hcp` Terraform `provider`\nblock into the root module document.\n\nOptionally, this inserts the provider into the\n[required_providers](https://developer.hashicorp.com/terraform/language/providers/requirements) `terraform` sub block if\nthe `src` and/or `version` parameters are set.\n\n**Args**:\n - `client_id` (`string`): The OAuth2 Client ID for API operations. When `null`, the `client_id` field will be omitted from the resulting object.\n - `client_secret` (`string`): The OAuth2 Client Secret for API operations. When `null`, the `client_secret` field will be omitted from the resulting object.\n - `project_id` (`string`): The default project in which resources should be created. When `null`, the `project_id` field will be omitted from the resulting object.\n - `alias` (`string`): The provider `alias` to set for this instance of the provider block. When `null`, the `alias`\n field will be omitted from the resulting provider block.\n - `src` (`string`): The provider `source` to set on the resulting `required_providers` block. If `src` or `version` is\n set and is not `null`, a `required_providers` block and entry for the provider will be injected into the document.\n - `version` (`string`): The provider `version` to set on the resulting `required_providers` block. If `src` or\n `version` is set and is not `null`, a `required_providers` block and entry for the provider will be injected into the\n document.\n\n\n**Returns**:\n- A mixin object that injects the new provider (and optionally, `required_providers` block) into the root Terraform configuration.\n', args=[]),
'#new':: d.fn(help='\n`hcp.provider.new` injects a new `hcp` Terraform `provider`\nblock into the root module document.\n\nOptionally, this inserts the provider into the\n[required_providers](https://developer.hashicorp.com/terraform/language/providers/requirements) `terraform` sub block if\nthe `src` and/or `version` parameters are set.\n\n**Args**:\n - `client_id` (`string`): The OAuth2 Client ID for API operations. When `null`, the `client_id` field will be omitted from the resulting object.\n - `client_secret` (`string`): The OAuth2 Client Secret for API operations. When `null`, the `client_secret` field will be omitted from the resulting object.\n - `credential_file` (`string`): The path to an HCP credential file to use to authenticate the provider to HCP. You can alternatively set the HCP_CRED_FILE environment variable to point at a credential file as well. Using a credential file allows you to authenticate the provider as a service principal via client credentials or dynamically based on Workload Identity Federation. When `null`, the `credential_file` field will be omitted from the resulting object.\n - `project_id` (`string`): The default project in which resources should be created. When `null`, the `project_id` field will be omitted from the resulting object.\n - `alias` (`string`): The provider `alias` to set for this instance of the provider block. When `null`, the `alias`\n field will be omitted from the resulting provider block.\n - `src` (`string`): The provider `source` to set on the resulting `required_providers` block. If `src` or `version` is\n set and is not `null`, a `required_providers` block and entry for the provider will be injected into the document.\n - `version` (`string`): The provider `version` to set on the resulting `required_providers` block. If `src` or\n `version` is set and is not `null`, a `required_providers` block and entry for the provider will be injected into the\n document.\n\n\n**Returns**:\n- A mixin object that injects the new provider (and optionally, `required_providers` block) into the root Terraform configuration.\n', args=[]),
new(
client_id=null,
client_secret=null,
credential_file=null,
project_id=null,
alias=null,
src=null,
Expand All @@ -15,16 +16,23 @@ local d = (import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet');
alias=alias,
src=src,
version=version,
attrs=self.newAttrs(client_id=client_id, client_secret=client_secret, project_id=project_id)
attrs=self.newAttrs(
client_id=client_id,
client_secret=client_secret,
credential_file=credential_file,
project_id=project_id
)
),
'#newAttrs':: d.fn(help='\n`hcp.provider.` constructs a new object with attributes and blocks configured for the `hcp`\nTerraform `provider`.\n\nUnlike [hcp.provider.new](#fn-hcpnew), this function will not inject the `provider`\nblock into the root Terraform document. Instead, this must be passed in as the `attrs` argument for the\n[tf.withProvider](https://github.com/tf-libsonnet/core/tree/main/docs#fn-withprovider) function to build a complete block.\n\nThis is most useful when you need to preprocess the attributes with functions, conditional, or looping logic prior to\ninjecting into a complete block.\n\n**Args**:\n - `client_id` (`string`): The OAuth2 Client ID for API operations. When `null`, the `client_id` field will be omitted from the resulting object.\n - `client_secret` (`string`): The OAuth2 Client Secret for API operations. When `null`, the `client_secret` field will be omitted from the resulting object.\n - `project_id` (`string`): The default project in which resources should be created. When `null`, the `project_id` field will be omitted from the resulting object.\n\n**Returns**:\n - An attribute object that can be used with [tf.withProvider](https://github.com/tf-libsonnet/core/tree/main/docs#fn-withprovider) to construct a new `hcp` provider\n configuration into the root Terraform configuration.\n', args=[]),
'#newAttrs':: d.fn(help='\n`hcp.provider.` constructs a new object with attributes and blocks configured for the `hcp`\nTerraform `provider`.\n\nUnlike [hcp.provider.new](#fn-hcpnew), this function will not inject the `provider`\nblock into the root Terraform document. Instead, this must be passed in as the `attrs` argument for the\n[tf.withProvider](https://github.com/tf-libsonnet/core/tree/main/docs#fn-withprovider) function to build a complete block.\n\nThis is most useful when you need to preprocess the attributes with functions, conditional, or looping logic prior to\ninjecting into a complete block.\n\n**Args**:\n - `client_id` (`string`): The OAuth2 Client ID for API operations. When `null`, the `client_id` field will be omitted from the resulting object.\n - `client_secret` (`string`): The OAuth2 Client Secret for API operations. When `null`, the `client_secret` field will be omitted from the resulting object.\n - `credential_file` (`string`): The path to an HCP credential file to use to authenticate the provider to HCP. You can alternatively set the HCP_CRED_FILE environment variable to point at a credential file as well. Using a credential file allows you to authenticate the provider as a service principal via client credentials or dynamically based on Workload Identity Federation. When `null`, the `credential_file` field will be omitted from the resulting object.\n - `project_id` (`string`): The default project in which resources should be created. When `null`, the `project_id` field will be omitted from the resulting object.\n\n**Returns**:\n - An attribute object that can be used with [tf.withProvider](https://github.com/tf-libsonnet/core/tree/main/docs#fn-withprovider) to construct a new `hcp` provider\n configuration into the root Terraform configuration.\n', args=[]),
newAttrs(
client_id=null,
client_secret=null,
credential_file=null,
project_id=null
):: std.prune(a={
client_id: client_id,
client_secret: client_secret,
credential_file: credential_file,
project_id: project_id,
}),
}
45 changes: 45 additions & 0 deletions 0.x/_gen/resources/organization_iam_binding.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
local tf = (import 'github.com/tf-libsonnet/core/main.libsonnet');
local d = (import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet');
{
'#':: d.pkg(name='organization_iam_binding', url='', help='`organization_iam_binding` represents the `hcp_organization_iam_binding` Terraform resource.\n\nUpdates the organization&#39;s IAM policy to bind a role to a new member. Existing bindings are preserved.\n\nThis package contains functions and utilities for setting up the resource using Jsonnet code.\n'),
'#new':: d.fn(help="\n`hcp.organization_iam_binding.new` injects a new `hcp_organization_iam_binding` Terraform `resource`\nblock into the root module document.\n\nAdditionally, this inserts a private function into the `_ref` attribute that generates references to attributes of the\nresource. For example, if you added a new instance to the root using:\n\n # arguments omitted for brevity\n hcp.organization_iam_binding.new('some_id')\n\nYou can get the reference to the `id` field of the created `hcp.organization_iam_binding` using the reference:\n\n $._ref.hcp_organization_iam_binding.some_id.get('id')\n\nThis is the same as directly entering `\"${ hcp_organization_iam_binding.some_id.id }\"` as the value.\n\nNOTE: if you are chaining multiple resources together in a merge operation, you may not be able to use `super`, `self`,\nor `$` to refer to the root object. Instead, make an explicit outer object using `local`.\n\n**Args**:\n - `resourceLabel` (`string`): The name label of the block.\n - `principal_id` (`string`): The principal to bind to the given role.\n - `role` (`string`): The role name to bind to the given principal.\n\n**Returns**:\n- A mixin object that injects the new resource into the root Terraform configuration.\n", args=[]),
new(
resourceLabel,
principal_id,
role,
_meta={}
):: tf.withResource(
type='hcp_organization_iam_binding',
label=resourceLabel,
attrs=self.newAttrs(principal_id=principal_id, role=role),
_meta=_meta
),
'#newAttrs':: d.fn(help='\n`hcp.organization_iam_binding.newAttrs` constructs a new object with attributes and blocks configured for the `organization_iam_binding`\nTerraform resource.\n\nUnlike [hcp.organization_iam_binding.new](#fn-new), this function will not inject the `resource`\nblock into the root Terraform document. Instead, this must be passed in as the `attrs` argument for the\n[tf.withResource](https://github.com/tf-libsonnet/core/tree/main/docs#fn-withresource) function to build a complete block.\n\nThis is most useful when you need to preprocess the attributes with functions, conditional, or looping logic prior to\ninjecting into a complete block.\n\n**Args**:\n - `principal_id` (`string`): The principal to bind to the given role.\n - `role` (`string`): The role name to bind to the given principal.\n\n**Returns**:\n - An attribute object that can be used with [tf.withResource](https://github.com/tf-libsonnet/core/tree/main/docs#fn-withresource) to construct a new `organization_iam_binding` resource into the root Terraform configuration.\n', args=[]),
newAttrs(
principal_id,
role
):: std.prune(a={
principal_id: principal_id,
role: role,
}),
'#withPrincipalId':: d.fn(help='`hcp.string.withPrincipalId` constructs a mixin object that can be merged into the `string`\nTerraform resource block to set or update the principal_id field.\n\n\n\n**Args**:\n - `resourceLabel` (`string`): The name label of the block to update.\n - `value` (`string`): The value to set for the `principal_id` field.\n', args=[]),
withPrincipalId(resourceLabel, value): {
resource+: {
hcp_organization_iam_binding+: {
[resourceLabel]+: {
principal_id: value,
},
},
},
},
'#withRole':: d.fn(help='`hcp.string.withRole` constructs a mixin object that can be merged into the `string`\nTerraform resource block to set or update the role field.\n\n\n\n**Args**:\n - `resourceLabel` (`string`): The name label of the block to update.\n - `value` (`string`): The value to set for the `role` field.\n', args=[]),
withRole(resourceLabel, value): {
resource+: {
hcp_organization_iam_binding+: {
[resourceLabel]+: {
role: value,
},
},
},
},
}
Loading

0 comments on commit d194a25

Please sign in to comment.