Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added apps data source #45

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 130 additions & 0 deletions docs/data-sources/apps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
---
page_title: "cloudfoundry_apps Data Source - terraform-provider-cloudfoundry"
subcategory: ""
description: |-
Fetches information on Cloud Foundry applications present in a space.
---

# cloudfoundry_apps (Data Source)

Fetches information on Cloud Foundry applications present in a space.

## Example Usage

```terraform
data "cloudfoundry_apps" "apps" {
org = "02c0cc92-6ecc-44b1-b7b2-096ca19ee143"
}
output "apps" {
value = data.cloudfoundry_apps.apps
}
```

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

### Optional

- `name` (String) The name of the application to filter by
- `org` (String) The GUID of the org where the applications are present
- `space` (String) The GUID of the space where the applications are present

### Read-Only

- `apps` (Attributes List) The list of apps (see [below for nested schema](#nestedatt--apps))

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

Read-Only:

- `annotations` (Map of String) The annotations associated with Cloud Foundry resources.
- `buildpacks` (Set of String) Multiple buildpacks used to stage the application.
- `command` (String) A custom start command for the application. This overrides the start command provided by the buildpack.
- `created_at` (String) The date and time when the resource was created in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) format.
- `disk_quota` (String) The disk space to be allocated for each application instance.
- `docker_credentials` (Attributes) Defines login credentials for private docker repositories (see [below for nested schema](#nestedatt--apps--docker_credentials))
- `docker_image` (String) The URL to the docker image with tag
- `environment` (Map of String) Key/value pairs of custom environment variables in your app. Does not include any system or service variables.
- `health_check_http_endpoint` (String) The endpoint for the http health check type.
- `health_check_interval` (Number) The interval in seconds between health checks.
- `health_check_invocation_timeout` (Number) The timeout in seconds for the health check requests for http and port health checks.
- `health_check_type` (String) The health check type which can be one of 'port', 'process', 'http'.
- `id` (String) The GUID of the object.
- `instances` (Number) The number of app instances started.
- `labels` (Map of String) The labels associated with Cloud Foundry resources.
- `log_rate_limit_per_second` (String) The attribute specifies the log rate limit for all instances of an app.
- `memory` (String) The memory limit for each application instance.
- `name` (String) The name of the application to look up
- `org_name` (String) The name of the associated Cloud Foundry organization to look up
- `processes` (Attributes Set) List of configurations for individual process types. (see [below for nested schema](#nestedatt--apps--processes))
- `readiness_health_check_http_endpoint` (String) The endpoint for the http readiness health check type.
- `readiness_health_check_interval` (Number) The interval in seconds between readiness health checks.
- `readiness_health_check_invocation_timeout` (Number) The timeout in seconds for the readiness health check requests for http and port health checks.
- `readiness_health_check_type` (String) The readiness health check type which can be one of 'port', 'process', 'http'.
- `routes` (Attributes Set) The routes to map to the application to control its ingress traffic. (see [below for nested schema](#nestedatt--apps--routes))
- `service_bindings` (Attributes Set) Service instances bound to the application. (see [below for nested schema](#nestedatt--apps--service_bindings))
- `sidecars` (Attributes Set) The attribute specifies additional processes to run in the same container as your app (see [below for nested schema](#nestedatt--apps--sidecars))
- `space_name` (String) The name of the space to look up
- `stack` (String) The name of the stack the application will be deployed to.
- `timeout` (Number) Time in seconds at which the health-check will report failure.
- `updated_at` (String) The date and time when the resource was updated in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) format.

<a id="nestedatt--apps--docker_credentials"></a>
### Nested Schema for `apps.docker_credentials`

Read-Only:

- `username` (String, Sensitive) The username for the private docker repository.


<a id="nestedatt--apps--processes"></a>
### Nested Schema for `apps.processes`

Read-Only:

- `command` (String) A custom start command for the application. This overrides the start command provided by the buildpack.
- `disk_quota` (String) The disk space to be allocated for each application instance.
- `health_check_http_endpoint` (String) The endpoint for the http health check type.
- `health_check_interval` (Number) The interval in seconds between health checks.
- `health_check_invocation_timeout` (Number) The timeout in seconds for the health check requests for http and port health checks.
- `health_check_type` (String) The health check type which can be one of 'port', 'process', 'http'.
- `instances` (Number) The number of app instances started.
- `log_rate_limit_per_second` (String) The attribute specifies the log rate limit for all instances of an app.
- `memory` (String) The memory limit for each application instance.
- `readiness_health_check_http_endpoint` (String) The endpoint for the http readiness health check type.
- `readiness_health_check_interval` (Number) The interval in seconds between readiness health checks.
- `readiness_health_check_invocation_timeout` (Number) The timeout in seconds for the readiness health check requests for http and port health checks.
- `readiness_health_check_type` (String) The readiness health check type which can be one of 'port', 'process', 'http'.
- `timeout` (Number) Time in seconds at which the health-check will report failure.
- `type` (String) The process type. Can be web or worker.


<a id="nestedatt--apps--routes"></a>
### Nested Schema for `apps.routes`

Read-Only:

- `protocol` (String) The protocol used for the route. Valid values are http2, http1, and tcp.
- `route` (String) The fully qualified domain name which will be bound to app


<a id="nestedatt--apps--service_bindings"></a>
### Nested Schema for `apps.service_bindings`

Read-Only:

- `params` (String) A json object to represent the parameters for the service instance.
- `service_instance` (String) The service instance name.


<a id="nestedatt--apps--sidecars"></a>
### Nested Schema for `apps.sidecars`

Read-Only:

- `command` (String) The command used to start the sidecar.
- `memory` (String) The memory limit for the sidecar.
- `name` (String) Sidecar name. The identifier for the sidecars to be configured.
- `process_types` (Set of String) List of processes to associate sidecar with.
5 changes: 5 additions & 0 deletions docs/data-sources/mta.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ page_title: "cloudfoundry_mta Data Source - terraform-provider-cloudfoundry"
subcategory: ""
description: |-
Gets information on a Multi Target Application present in a space.
Further documentation:
Multitarget Applications in the Cloud Foundry Environment https://help.sap.com/docs/btp/sap-business-technology-platform/multitarget-applications-in-cloud-foundry-environment
---

# cloudfoundry_mta (Data Source)

Gets information on a Multi Target Application present in a space.

__Further documentation:__
[Multitarget Applications in the Cloud Foundry Environment](https://help.sap.com/docs/btp/sap-business-technology-platform/multitarget-applications-in-cloud-foundry-environment)

## Example Usage

Expand Down
6 changes: 6 additions & 0 deletions docs/data-sources/mtas.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ page_title: "cloudfoundry_mtas Data Source - terraform-provider-cloudfoundry"
subcategory: ""
description: |-
Gets information on Multi Target Applications present in a space.
Further documentation:
Multitarget Applications in the Cloud Foundry Environment https://help.sap.com/docs/btp/sap-business-technology-platform/multitarget-applications-in-cloud-foundry-environment
---

# cloudfoundry_mtas (Data Source)

Gets information on Multi Target Applications present in a space.


__Further documentation:__
[Multitarget Applications in the Cloud Foundry Environment](https://help.sap.com/docs/btp/sap-business-technology-platform/multitarget-applications-in-cloud-foundry-environment)

## Example Usage

Expand Down
7 changes: 7 additions & 0 deletions examples/data-sources/cloudfoundry_apps/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
data "cloudfoundry_apps" "apps" {
org = "02c0cc92-6ecc-44b1-b7b2-096ca19ee143"
}

output "apps" {
value = data.cloudfoundry_apps.apps
}
12 changes: 6 additions & 6 deletions internal/provider/datasource_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (d *appDataSource) Schema(ctx context.Context, req datasource.SchemaRequest
MarkdownDescription: "List of configurations for individual process types.",
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: d.ProcessSchemaAttributes(),
Attributes: datasourceProcessSchemaAttributes(),
},
},
"sidecars": schema.SetNestedAttribute{
Expand Down Expand Up @@ -148,27 +148,27 @@ func (d *appDataSource) Schema(ctx context.Context, req datasource.SchemaRequest
updatedAtKey: updatedAtSchema(),
},
}
for k, v := range d.ProcessAppCommonSchema() {
for k, v := range datasourceProcessAppCommonSchema() {
if _, ok := resp.Schema.Attributes[k]; !ok {
resp.Schema.Attributes[k] = v
}
}
}
func (d *appDataSource) ProcessSchemaAttributes() map[string]schema.Attribute {
func datasourceProcessSchemaAttributes() map[string]schema.Attribute {
pSchema := map[string]schema.Attribute{
"type": schema.StringAttribute{
MarkdownDescription: "The process type. Can be web or worker.",
Computed: true,
},
}
for k, v := range d.ProcessAppCommonSchema() {
for k, v := range datasourceProcessAppCommonSchema() {
if _, ok := pSchema[k]; !ok {
pSchema[k] = v
}
}
return pSchema
}
func (d *appDataSource) ProcessAppCommonSchema() map[string]schema.Attribute {
func datasourceProcessAppCommonSchema() map[string]schema.Attribute {
return map[string]schema.Attribute{
"command": schema.StringAttribute{
MarkdownDescription: "A custom start command for the application. This overrides the start command provided by the buildpack.",
Expand Down Expand Up @@ -306,7 +306,7 @@ func (d *appDataSource) Read(ctx context.Context, req datasource.ReadRequest, re
datasourceAppTypeResp.Org = datasourceAppType.Org
datasourceAppTypeResp.Space = datasourceAppType.Space

tflog.Trace(ctx, "read a data source")
tflog.Trace(ctx, "read an app data source")

resp.Diagnostics.Append(resp.State.Set(ctx, &datasourceAppTypeResp)...)
}
Loading
Loading