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

Make service plans public on cf_service_access #20

Merged
merged 4 commits into from
Feb 26, 2018
Merged

Conversation

psycofdj
Copy link
Member

@psycofdj psycofdj commented Jan 31, 2018

When creating a service-broker, service plans are private by default (ie: "public" : false attribute of /v2/service_plans, which make the service invisible in the marketplace).

The PR propose to add the optional public attribute to the cf_service_access resource. This attribute controls whenever the associated plan should be set public or private. It conflicts with org attribute that
controls per-org access.

Resource

resource "cf_service_access" "org1-mysql-512mb" {
     plan = "${cf_service_broker.mysql.service_plans["p-mysql/512mb"]}"
     public = true
}

resource "cf_service_access" "org1-mysql-512mb" {
    plan = "${cf_service_broker.mysql.service_plans["p-mysql/1gb"]}"
    org = "${cf_org.org1.id}"
}

Argument reference:

  • plan - (Required) The ID of the service plan to grant access to
  • org - (Optional) The ID of the Org which should have access to the plan. Conflicts with public.
  • public - (Optional) Boolean that controls the public state of the plan. Conflicts with org.

Import

Import syntax is unchanged but its behavior is modified.

$ terraform import cf_service_access.org1-mysql-512mb a-guid

If given id matches existing service_plan_visibilities, resource will be imported as a service_access targeting an organization. Otherwise, it will be imported as service_access controlling plan's public state.

@psycofdj psycofdj changed the title [WIP] Make service plans public on cf_service_access Make service plans public on cf_service_access Feb 1, 2018
The current Service Access can be imported using an `id`.

If given `id` matches existing [`service_plan_visibilities`](https://apidocs.cloudfoundry.org/280/service_plan_visibilities/list_all_service_plan_visibilities.html),
resource will be imported as a `service_access` targeting an organization. Otherwise, it will be imported as `service_access` controlling plan's public state. E.g.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@psycofdj

I'd suggest the following clarification to doc:

If the given `id` matches [a service plan id](http://apidocs.cloudfoundry.org/280/service_plans/updating_a_service_plan.html), then the resource will be imported as `service_access` controlling plan's public state.

Otherwise, the import would fail

@gberche-orange
Copy link
Collaborator

@mevansam I wonder background rationale for naming this resource cf_service_access w.r.t. cf_service_plan_access (since it manages access to individual service plan and not access to service definition) ? Maybe something to discuss prior to cutting 1.0 release.

Copy link
Member

@mevansam mevansam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I concur with @gberche-orange on renaming this resource to cf_service_plan_access. Should we make the change within this same pull request or create a new pull request? Other than that change look good pending update to documentation as per @gberche-orange 's review comment.

@gberche-orange gberche-orange added this to Done in kanban Feb 21, 2018
@psycofdj psycofdj merged commit 4a2a0ef into dev Feb 26, 2018
@psycofdj psycofdj deleted the public_plans branch April 3, 2018 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
kanban
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants