Skip to content

Commit

Permalink
fix(app): attribute unit types (#72)
Browse files Browse the repository at this point in the history
* fix: #63

* fix: #68

* fix: #66
  • Loading branch information
Gourab1998 authored and debTheRay committed May 1, 2024
1 parent df89e68 commit 256f24e
Show file tree
Hide file tree
Showing 16 changed files with 4,738 additions and 2,120 deletions.
4 changes: 4 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ provider "cloudfoundry" {}
- `skip_ssl_validation` (Boolean)
- `user` (String, Sensitive) A unique identifier associated with an individual or entity for authentication & authorization purposes.

**Note**

All parameter values for the provider can be injected by setting environment variables `CF_API_URL`, `CF_USER`, `CF_PASSWORD`, `CF_ORIGIN`, `CF_CLIENT_ID`, `CF_CLIENT_SECRET`.

## Get Started

If you're not familiar with Terraform yet, see the [Fundamentals](https://developer.hashicorp.com/terraform/tutorials/cli) section with a lot of helpful tutorials.
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/role.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Provides a Cloud Foundry resource for assigning roles. For a user to be assigned
```terraform
resource "cloudfoundry_role" "my_role" {
username = "[email protected]"
type = "organization_user"
org = "784b4cd0-4771-4e4d-9052-a07e178bae56"
type = "organization_user"
org = "784b4cd0-4771-4e4d-9052-a07e178bae56"
}
```

Expand Down
12 changes: 6 additions & 6 deletions examples/resources/cloudfoundry_app/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ resource "zipper_file" "fixture" {

resource "cloudfoundry_app" "gobis-server" {
name = "tf-test-do-not-delete-nodejs"
space = "tf-space-1"
org = "PerformanceTeamBLR"
space_name = "tf-space-1"
org_name = "PerformanceTeamBLR"
path = zipper_file.fixture.output_path
source_code_hash = zipper_file.fixture.output_sha
instances = 1
Expand All @@ -45,8 +45,8 @@ resource "cloudfoundry_app" "gobis-server" {

resource "cloudfoundry_app" "http-bin-server" {
name = "tf-test-do-not-delete-http-bin"
space = "tf-space-1"
org = "PerformanceTeamBLR"
space_name = "tf-space-1"
org_name = "PerformanceTeamBLR"
docker_image = "kennethreitz/httpbin"
strategy = "blue-green"
labels = {
Expand All @@ -73,8 +73,8 @@ resource "cloudfoundry_app" "http-bin-server" {

resource "cloudfoundry_app" "http-bin-sidecar" {
name = "tf-test-do-not-delete-http-bin-sidecar"
space = "tf-space-1"
org = "PerformanceTeamBLR"
space_name = "tf-space-1"
org_name = "PerformanceTeamBLR"
docker_image = "kennethreitz/httpbin"
sidecars = [
{
Expand Down
6 changes: 2 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/SAP/terraform-provider-cloudfoundry

go 1.21

toolchain go1.21.4
go 1.22

require (
github.com/cloudfoundry-community/go-cfclient/v3 v3.0.0-alpha.6.0.20240326180005-d4d9ebf1fa8b
Expand All @@ -15,7 +13,7 @@ require (
github.com/hashicorp/terraform-plugin-testing v1.7.0
github.com/samber/lo v1.39.0
github.com/stretchr/testify v1.9.0
gopkg.in/dnaeon/go-vcr.v3 v3.1.2
gopkg.in/dnaeon/go-vcr.v3 v3.2.0
gopkg.in/yaml.v2 v2.4.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/dnaeon/go-vcr.v3 v3.1.2 h1:F1smfXBqQqwpVifDfUBQG6zzaGjzT+EnVZakrOdr5wA=
gopkg.in/dnaeon/go-vcr.v3 v3.1.2/go.mod h1:2IMOnnlx9I6u9x+YBsM3tAMx6AlOxnJ0pWxQAzZ79Ag=
gopkg.in/dnaeon/go-vcr.v3 v3.2.0 h1:Rltp0Vf+Aq0u4rQXgmXgtgoRDStTnFN83cWgSGSoRzM=
gopkg.in/dnaeon/go-vcr.v3 v3.2.0/go.mod h1:2IMOnnlx9I6u9x+YBsM3tAMx6AlOxnJ0pWxQAzZ79Ag=
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/datasource_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ func (d *appDataSource) Schema(ctx context.Context, req datasource.SchemaRequest
MarkdownDescription: "The name of the application to look up",
Required: true,
},
"space": schema.StringAttribute{
"space_name": schema.StringAttribute{
MarkdownDescription: "The name of the space to look up",
Required: true,
},
"org": schema.StringAttribute{
"org_name": schema.StringAttribute{
MarkdownDescription: "The name of the associated Cloud Foundry organization to look up",
Required: true,
},
Expand Down
20 changes: 10 additions & 10 deletions internal/provider/datasource_app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ func TestAppDataSource_Configure(t *testing.T) {
Config: hclProvider(nil) + `
data "cloudfoundry_app" "app" {
name = "tf-test-do-not-delete-http-bin"
space = "tf-space-1"
org = "PerformanceTeamBLR"
space_name = "tf-space-1"
org_name = "PerformanceTeamBLR"
}`,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "name", "tf-test-do-not-delete-http-bin"),
resource.TestCheckResourceAttr(resourceName, "space", "tf-space-1"),
resource.TestCheckResourceAttr(resourceName, "org", "PerformanceTeamBLR"),
resource.TestCheckResourceAttr(resourceName, "space_name", "tf-space-1"),
resource.TestCheckResourceAttr(resourceName, "org_name", "PerformanceTeamBLR"),
resource.TestCheckResourceAttr(resourceName, "processes.0.instances", "1"),
resource.TestCheckResourceAttr(resourceName, "processes.0.memory", "256M"),
resource.TestCheckResourceAttr(resourceName, "processes.0.disk_quota", "1024M"),
Expand Down Expand Up @@ -58,13 +58,13 @@ data "cloudfoundry_app" "app" {
Config: hclProvider(nil) + `
data "cloudfoundry_app" "app" {
name = "tf-test-do-not-delete-nodejs"
space = "tf-space-1"
org = "PerformanceTeamBLR"
space_name = "tf-space-1"
org_name = "PerformanceTeamBLR"
}`,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "name", "tf-test-do-not-delete-nodejs"),
resource.TestCheckResourceAttr(resourceName, "space", "tf-space-1"),
resource.TestCheckResourceAttr(resourceName, "org", "PerformanceTeamBLR"),
resource.TestCheckResourceAttr(resourceName, "space_name", "tf-space-1"),
resource.TestCheckResourceAttr(resourceName, "org_name", "PerformanceTeamBLR"),
resource.TestCheckResourceAttr(resourceName, "processes.0.instances", "1"),
resource.TestCheckResourceAttr(resourceName, "processes.0.type", "web"),
resource.TestCheckResourceAttr(resourceName, "service_bindings.#", "1"),
Expand All @@ -89,8 +89,8 @@ data "cloudfoundry_app" "app" {
Config: hclProvider(nil) + `
data "cloudfoundry_app" "app" {
name = "testunavailableapp"
space = "tf-space-1"
org = "PerformanceTeamBLR"
space_name = "tf-space-1"
org_name = "PerformanceTeamBLR"
}`,
ExpectError: regexp.MustCompile(`Error: Error finding given app`),
},
Expand Down
Loading

0 comments on commit 256f24e

Please sign in to comment.