Skip to content

Commit

Permalink
Merge pull request #31 from cloudfoundry/service_plans
Browse files Browse the repository at this point in the history
Added service plans datasource
  • Loading branch information
vipinvkmenon authored Oct 21, 2024
2 parents e3a4276 + 1584fea commit b9bd9aa
Show file tree
Hide file tree
Showing 19 changed files with 1,248 additions and 832 deletions.
38 changes: 0 additions & 38 deletions docs/data-sources/service.md

This file was deleted.

111 changes: 111 additions & 0 deletions docs/data-sources/service_plans.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
page_title: "cloudfoundry_service_plans Data Source - terraform-provider-cloudfoundry"
subcategory: ""
description: |-
Fetches Service Plans based on the filters provided
---

# cloudfoundry_service_plans (Data Source)

Fetches Service Plans based on the filters provided

## Example Usage

```terraform
data "cloudfoundry_service_plans" "xsuaa-offering" {
service_offering_name = "xsuaa"
}
output "serviceplans" {
value = data.cloudfoundry_service_plans.xsuaa-offering.service_plans
}
```

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

### Optional

- `name` (String) The name of the service plan to look up
- `service_broker_name` (String) The name of the service broker which offers the service. Use this to filter two equally named services from different brokers.
- `service_offering_name` (String) The name of the service offering for whose plans to look up

### Read-Only

- `service_plans` (Attributes List) The list of the service plans (see [below for nested schema](#nestedatt--service_plans))

<a id="nestedatt--service_plans"></a>
### Nested Schema for `service_plans`

Read-Only:

- `annotations` (Map of String) The annotations associated with Cloud Foundry resources.
- `available` (Boolean) Whether or not the service plan is available
- `broker_catalog` (Attributes) This object contains information obtained from the service broker catalog (see [below for nested schema](#nestedatt--service_plans--broker_catalog))
- `costs` (Attributes List) The cost of the service plan as obtained from the service broker catalog (see [below for nested schema](#nestedatt--service_plans--costs))
- `created_at` (String) The date and time when the resource was created in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) format.
- `description` (String) Description of the service plan
- `free` (Boolean) Whether or not the service plan is free of charge
- `id` (String) The GUID of the object.
- `labels` (Map of String) The labels associated with Cloud Foundry resources.
- `maintenance_info` (Attributes) Information about the version of this service plan (see [below for nested schema](#nestedatt--service_plans--maintenance_info))
- `name` (String) Name of the service plan
- `schemas` (Attributes) Schema definitions for service instances and service bindings for the service plan (see [below for nested schema](#nestedatt--service_plans--schemas))
- `service_offering` (String) The service offering that this service plan relates to
- `updated_at` (String) The date and time when the resource was updated in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) format.
- `visibility_type` (String) Denotes the visibility of the plan

<a id="nestedatt--service_plans--broker_catalog"></a>
### Nested Schema for `service_plans.broker_catalog`

Read-Only:

- `bindable` (Boolean) Specifies whether service instances of the service can be bound to applications
- `id` (String) The identifier that the service broker provided for this service plan
- `maximum_polling_duration` (Number) The maximum number of seconds that Cloud Foundry will wait for an asynchronous service broker operation
- `metadata` (String) Additional information provided by the service broker as specified by OSBAPI
- `plan_updateable` (Boolean) Whether the service plan supports upgrade/downgrade for service plans


<a id="nestedatt--service_plans--costs"></a>
### Nested Schema for `service_plans.costs`

Read-Only:

- `amount` (Number) Pricing amount
- `currency` (String) Currency code for the pricing amount, e.g. USD, GBP
- `unit` (String) Display name for type of cost, e.g. Monthly, Hourly, Request, GB


<a id="nestedatt--service_plans--maintenance_info"></a>
### Nested Schema for `service_plans.maintenance_info`

Read-Only:

- `description` (String) A textual explanation associated with this version
- `version` (String) The current semantic version of the service plan


<a id="nestedatt--service_plans--schemas"></a>
### Nested Schema for `service_plans.schemas`

Read-Only:

- `service_binding` (Attributes) (see [below for nested schema](#nestedatt--service_plans--schemas--service_binding))
- `service_instance` (Attributes) (see [below for nested schema](#nestedatt--service_plans--schemas--service_instance))

<a id="nestedatt--service_plans--schemas--service_binding"></a>
### Nested Schema for `service_plans.schemas.service_binding`

Read-Only:

- `create_parameters` (String) Schema definition for the input parameters for service Binding creation


<a id="nestedatt--service_plans--schemas--service_instance"></a>
### Nested Schema for `service_plans.schemas.service_instance`

Read-Only:

- `create_parameters` (String) Schema definition for the input parameters for service instance creation
- `update_parameters` (String) Schema definition for the input parameters for service instance update
22 changes: 12 additions & 10 deletions docs/resources/service_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,27 @@ data "cloudfoundry_org" "team_org" {
}
data "cloudfoundry_space" "team_space" {
name = "PerformanceTeamBLR"
name = "tf-space-1"
org = data.cloudfoundry_org.team_org.id
}
data "cloudfoundry_service" "xsuaa_svc" {
name = "xsuaa"
data "cloudfoundry_service_plans" "xsuaa_svc" {
name = "application"
service_offering_name = "xsuaa"
}
data "cloudfoundry_service" "autoscaler_svc" {
name = "autoscaler"
data "cloudfoundry_service_plans" "autoscaler_svc" {
name = "standard"
service_offering_name = "autoscaler"
}
resource "cloudfoundry_service_instance" "xsuaa_svc" {
name = "xsuaa_svc"
name = "xsuaa_sv1"
type = "managed"
tags = ["terraform-test", "test1"]
space = data.cloudfoundry_space.team_space.id
service_plan = data.cloudfoundry_service.xsuaa_svc.service_plans["application"]
service_plan = data.cloudfoundry_service_plans.xsuaa_svc.service_plans[0].id
parameters = <<EOT
{
"xsappname": "tf-test23",
"xsappname": "tf-test2",
"tenant-mode": "dedicated",
"description": "tf test123",
"foreign-scope-references": ["user_attributes"],
Expand All @@ -67,14 +69,14 @@ resource "cloudfoundry_service_instance" "dev-autoscaler" {
type = "managed"
tags = ["terraform-test", "autoscaler"]
space = data.cloudfoundry_space.team_space.id
service_plan = data.cloudfoundry_service.autoscaler_svc.service_plans["standard"]
service_plan = data.cloudfoundry_service_plans.autoscaler_svc.service_plans[0].id
timeouts = {
create = "10m"
}
}
# User provided service instance
resource "cloudfoundry_service_instance" "dev-usp" {
name = "tf-usp-test"
name = "tf-usp-test1"
type = "user-provided"
tags = ["terraform-test", "usp"]
space = data.cloudfoundry_space.team_space.id
Expand Down
7 changes: 0 additions & 7 deletions examples/data-sources/cloudfoundry_service/data-source.tf

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
data "cloudfoundry_service_plans" "xsuaa-offering" {
service_offering_name = "xsuaa"
}

output "serviceplans" {
value = data.cloudfoundry_service_plans.xsuaa-offering.service_plans
}
22 changes: 12 additions & 10 deletions examples/resources/cloudfoundry_service_instance/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,27 @@ data "cloudfoundry_org" "team_org" {
}

data "cloudfoundry_space" "team_space" {
name = "PerformanceTeamBLR"
name = "tf-space-1"
org = data.cloudfoundry_org.team_org.id
}

data "cloudfoundry_service" "xsuaa_svc" {
name = "xsuaa"
data "cloudfoundry_service_plans" "xsuaa_svc" {
name = "application"
service_offering_name = "xsuaa"
}
data "cloudfoundry_service" "autoscaler_svc" {
name = "autoscaler"
data "cloudfoundry_service_plans" "autoscaler_svc" {
name = "standard"
service_offering_name = "autoscaler"
}
resource "cloudfoundry_service_instance" "xsuaa_svc" {
name = "xsuaa_svc"
name = "xsuaa_sv1"
type = "managed"
tags = ["terraform-test", "test1"]
space = data.cloudfoundry_space.team_space.id
service_plan = data.cloudfoundry_service.xsuaa_svc.service_plans["application"]
service_plan = data.cloudfoundry_service_plans.xsuaa_svc.service_plans[0].id
parameters = <<EOT
{
"xsappname": "tf-test23",
"xsappname": "tf-test2",
"tenant-mode": "dedicated",
"description": "tf test123",
"foreign-scope-references": ["user_attributes"],
Expand All @@ -48,14 +50,14 @@ resource "cloudfoundry_service_instance" "dev-autoscaler" {
type = "managed"
tags = ["terraform-test", "autoscaler"]
space = data.cloudfoundry_space.team_space.id
service_plan = data.cloudfoundry_service.autoscaler_svc.service_plans["standard"]
service_plan = data.cloudfoundry_service_plans.autoscaler_svc.service_plans[0].id
timeouts = {
create = "10m"
}
}
# User provided service instance
resource "cloudfoundry_service_instance" "dev-usp" {
name = "tf-usp-test"
name = "tf-usp-test1"
type = "user-provided"
tags = ["terraform-test", "usp"]
space = data.cloudfoundry_space.team_space.id
Expand Down
Loading

0 comments on commit b9bd9aa

Please sign in to comment.