Skip to content

Commit

Permalink
Merge pull request #38 from nullplatform/fixes/docs-dimensions-and-ac…
Browse files Browse the repository at this point in the history
…cuonts

fixes: we now have documentation for the new resources we added, dime…
  • Loading branch information
sebasnallar authored Nov 9, 2024
2 parents 88ad9de + 4236d3c commit 0a9cb93
Show file tree
Hide file tree
Showing 14 changed files with 403 additions and 13 deletions.
1 change: 0 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ provider "nullplatform" {}
```

<!-- schema generated by tfplugindocs -->

## Schema

### Required
Expand Down
64 changes: 64 additions & 0 deletions docs/resources/account.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "nullplatform_account Resource - terraform-provider-nullplatform"
subcategory: ""
description: |-
The account resource allows you to configure a nullplatform account
---

# nullplatform_account (Resource)

The account resource allows you to configure a nullplatform account

## Example Usage

```terraform
terraform {
required_providers {
nullplatform = {
source = "nullplatform/nullplatform"
}
}
}
provider "nullplatform" {}
resource "nullplatform_account" "github_account" {
name = "My GitHub Account"
repository_prefix = "my-org"
repository_provider = "github"
slug = "github-account"
}
resource "nullplatform_account" "gitlab_account" {
name = "My GitLab Account"
repository_prefix = "my-company"
repository_provider = "gitlab"
slug = "gitlab-account"
}
output "github_account_id" {
description = "The ID of the GitHub account"
value = nullplatform_account.github_account.id
}
output "github_account_org_id" {
description = "The organization ID the account belongs to"
value = nullplatform_account.github_account.organization_id
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) The name of the account
- `repository_prefix` (String) The prefix used for repositories in this account
- `repository_provider` (String) The repository provider for this account
- `slug` (String) The unique slug identifier for the account

### Read-Only

- `id` (String) The ID of this resource.
- `organization_id` (Number) The ID of the organization this account belongs to (computed from authentication token)
35 changes: 35 additions & 0 deletions docs/resources/dimension.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "nullplatform_dimension Resource - terraform-provider-nullplatform"
subcategory: ""
description: |-
The dimension resource allows you to configure a Nullplatform Dimension
---

# nullplatform_dimension (Resource)

The dimension resource allows you to configure a Nullplatform Dimension



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) The name of the dimension.

### Optional

- `account` (String) The slug of the account NRN component.
- `application` (String) The slug of the application NRN component.
- `namespace` (String) The slug of the namespace NRN component.
- `nrn` (String) A system-wide unique ID representing the resource.
- `order` (Number) The order of the dimension.
- `scope` (String) The slug of the scope NRN component.

### Read-Only

- `id` (String) The ID of this resource.
- `slug` (String) The slug of the dimension.
- `status` (String) The status of the dimension.
35 changes: 35 additions & 0 deletions docs/resources/dimension_value.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "nullplatform_dimension_value Resource - terraform-provider-nullplatform"
subcategory: ""
description: |-
The dimension_value resource allows you to configure a Nullplatform Dimension Value
---

# nullplatform_dimension_value (Resource)

The dimension_value resource allows you to configure a Nullplatform Dimension Value



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `dimension_id` (Number) The ID of the parent dimension.
- `name` (String) The name of the dimension value.

### Optional

- `account` (String) The slug of the account NRN component.
- `application` (String) The slug of the application NRN component.
- `namespace` (String) The slug of the namespace NRN component.
- `nrn` (String) A system-wide unique ID representing the resource.
- `scope` (String) The slug of the scope NRN component.

### Read-Only

- `id` (String) The ID of this resource.
- `slug` (String) The slug of the dimension value.
- `status` (String) The status of the dimension value.
2 changes: 1 addition & 1 deletion docs/resources/provider_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The provider_config resource allows you to configure a nullplatform Provider
terraform {
required_providers {
nullplatform = {
source = "nullplatform/com/nullplatform"
source = "nullplatform/nullplatform"
}
}
}
Expand Down
61 changes: 61 additions & 0 deletions examples/data-sources/nullplatform_account/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
terraform {
required_providers {
nullplatform = {
source = "nullplatform/nullplatform"
}
}
}

data "nullplatform_account" "existing_account" {
id = "123456"
}

data "nullplatform_account" "by_slug" {
slug = "github-account"
}

resource "nullplatform_namespace" "example" {
name = "Production Environment"
account_id = data.nullplatform_account.existing_account.id

depends_on = [
data.nullplatform_account.existing_account
]
}

output "account_name" {
description = "The name of the account"
value = data.nullplatform_account.existing_account.name
}

output "account_repo_prefix" {
description = "The repository prefix of the account"
value = data.nullplatform_account.existing_account.repository_prefix
}

output "account_repo_provider" {
description = "The repository provider of the account"
value = data.nullplatform_account.existing_account.repository_provider
}

resource "nullplatform_account" "multi_provider" {
for_each = {
github = {
name = "GitHub Projects"
prefix = "github-org"
provider = "github"
slug = "github-projects"
}
gitlab = {
name = "GitLab Projects"
prefix = "gitlab-org"
provider = "gitlab"
slug = "gitlab-projects"
}
}

name = each.value.name
repository_prefix = each.value.prefix
repository_provider = each.value.provider
slug = each.value.slug
}
45 changes: 45 additions & 0 deletions examples/data-sources/nullplatform_dimension/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
terraform {
required_providers {
nullplatform = {
source = "nullplatform/nullplatform"
}
}
}

provider "nullplatform" {}

data "nullplatform_dimension" "example" {
id = "123456"
}

data "nullplatform_dimension" "by_nrn" {
nrn = "organization=1234567890:account=987654321:namespace=1122334455"
}

data "nullplatform_dimension" "by_components" {
organization = "1234567890"
account = "my-account"
namespace = "platform-config"
}

resource "nullplatform_dimension_value" "prod" {
dimension_id = data.nullplatform_dimension.example.id
name = "Production"
nrn = "${data.nullplatform_dimension.example.nrn}:value=prod"
}

output "dimension_name" {
value = data.nullplatform_dimension.example.name
}

output "dimension_slug" {
value = data.nullplatform_dimension.example.slug
}

output "dimension_status" {
value = data.nullplatform_dimension.example.status
}

output "dimension_order" {
value = data.nullplatform_dimension.example.order
}
37 changes: 37 additions & 0 deletions examples/data-sources/nullplatform_dimension_value/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
terraform {
required_providers {
nullplatform = {
source = "nullplatform/nullplatform"
}
}
}

data "nullplatform_dimension_value" "existing_value" {
dimension_id = 12345
id = "67890"
}

data "nullplatform_dimension_value" "by_nrn" {
dimension_id = 12345
nrn = "organization=1234567890:account=987654321:namespace=1122334455:value=prod"
}

data "nullplatform_dimension_value" "by_components" {
dimension_id = 12345
organization = "1234567890"
account = "my-account"
namespace = "platform-config"
name = "Production"
}

output "dimension_value_name" {
value = data.nullplatform_dimension_value.existing_value.name
}

output "dimension_value_slug" {
value = data.nullplatform_dimension_value.existing_value.slug
}

output "dimension_value_status" {
value = data.nullplatform_dimension_value.existing_value.status
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
nullplatform = {
source = "nullplatform/com/nullplatform"
source = "nullplatform/nullplatform"
}
}
}
Expand Down
33 changes: 33 additions & 0 deletions examples/resources/nullplatform_account/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
terraform {
required_providers {
nullplatform = {
source = "nullplatform/nullplatform"
}
}
}

provider "nullplatform" {}

resource "nullplatform_account" "github_account" {
name = "My GitHub Account"
repository_prefix = "my-org"
repository_provider = "github"
slug = "github-account"
}

resource "nullplatform_account" "gitlab_account" {
name = "My GitLab Account"
repository_prefix = "my-company"
repository_provider = "gitlab"
slug = "gitlab-account"
}

output "github_account_id" {
description = "The ID of the GitHub account"
value = nullplatform_account.github_account.id
}

output "github_account_org_id" {
description = "The organization ID the account belongs to"
value = nullplatform_account.github_account.organization_id
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
nullplatform = {
source = "nullplatform/com/nullplatform"
source = "nullplatform/nullplatform"
}
}
}
Expand Down
32 changes: 32 additions & 0 deletions examples/resources/resource_dimension/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
terraform {
required_providers {
nullplatform = {
source = "nullplatform/nullplatform"
}
}
}

provider "nullplatform" {}

resource "nullplatform_dimension" "ordered_dimension" {
name = "Region"
order = 2
nrn = "organization=1234567890:account=987654321:namespace=1122334455"
}

resource "nullplatform_dimension" "component_dimension" {
name = "Department"
account = "my-main-account"
namespace = "platform-config"
order = 3
}

output "dimension_slug" {
description = "The generated slug for the dimension"
value = nullplatform_dimension.basic_dimension.slug
}

output "dimension_status" {
description = "The current status of the dimension"
value = nullplatform_dimension.basic_dimension.status
}
Loading

0 comments on commit 0a9cb93

Please sign in to comment.