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

Remove google_endpoints_service.protoc_output #2396

Merged
merged 1 commit into from
Nov 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 4 additions & 11 deletions google/resource_endpoints_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ func resourceEndpointsService() *schema.Resource {
Optional: true,
},
"protoc_output": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Deprecated: "Please use protoc_output_base64 instead.",
Type: schema.TypeString,
Optional: true,
Computed: true,
Removed: "Please use protoc_output_base64 instead.",
},
"protoc_output_base64": &schema.Schema{
Type: schema.TypeString,
Expand Down Expand Up @@ -205,14 +206,6 @@ func resourceEndpointsServiceUpdate(d *schema.ResourceData, meta interface{}) er
grpcConfig, gok := d.GetOk("grpc_config")
protocOutput, pok := d.GetOk("protoc_output_base64")

// Support conversion from raw file -> base64 until the field is totally removed.
if !pok {
protocOutput, pok = d.GetOk("protoc_output")
if pok {
protocOutput = base64.StdEncoding.EncodeToString([]byte(protocOutput.(string)))
}
}

if gok && pok {
source = getGRPCConfigSource(grpcConfig.(string), protocOutput.(string))
} else {
Expand Down
31 changes: 22 additions & 9 deletions website/docs/r/endpoints_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ This resource creates and rolls out a Cloud Endpoints service using OpenAPI or g

```hcl
resource "google_endpoints_service" "openapi_service" {
service_name = "api-name.endpoints.project-id.cloud.goog"
project = "project-id"
service_name = "api-name.endpoints.project-id.cloud.goog"
project = "project-id"
openapi_config = "${file("openapi_spec.yml")}"
}

resource "google_endpoints_service" "grpc_service" {
service_name = "api-name.endpoints.project-id.cloud.goog"
project = "project-id"
grpc_config = "${file("service_spec.yml")}"
protoc_output = "${file("compiled_descriptor_file.pb")}"
service_name = "api-name.endpoints.project-id.cloud.goog"
project = "project-id"
grpc_config = "${file("service_spec.yml")}"
protoc_output_base64 = "${base64encode(file("compiled_descriptor_file.pb"))}"
}
```

Expand All @@ -32,22 +32,35 @@ The example in `examples/endpoints_on_compute_engine` shows the API from the qui
## Argument Reference

The following arguments are supported:

* `service_name`: (Required) The name of the service. Usually of the form `$apiname.endpoints.$projectid.cloud.goog`.
* `openapi_config`: (Optional) The full text of the OpenAPI YAML configuration as described [here](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md). Either this, or *both* of `grpc_config` and `protoc_output` must be specified.
* `grpc_config`: (Optional) The full text of the Service Config YAML file (Example located [here](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/endpoints/bookstore-grpc/api_config.yaml)). If provided, must also provide `protoc_output`. `open_api` config must *not* be provided.

- - -

* `openapi_config`: (Optional) The full text of the OpenAPI YAML configuration as described [here](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md).
Either this, or *both* of `grpc_config` and `protoc_output_base64` must be specified.

* `grpc_config`: (Optional) The full text of the Service Config YAML file (Example located [here](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/endpoints/bookstore-grpc/api_config.yaml)).
If provided, must also provide `protoc_output_base64`. `open_api` config must *not* be provided.

* `protoc_output_base64`: (Optional) The full contents of the Service Descriptor File generated by protoc. This should be a compiled .pb file, base64-encoded.
* `protoc_output`: (Deprecated) The full contents of the Service Descriptor File generated by protoc. This should be a compiled .pb file. Use `protoc_output_base64` instead to prevent a permanent diff from the statefile's munging of non-UTF8 bytes.

* `project`: (Optional) The project ID that the service belongs to. If not provided, provider project is used.

## Attributes Reference
In addition to the arguments, the following attributes are available:

* `config_id`: The autogenerated ID for the configuration that is rolled out as part of the creation of this resource. Must be provided to compute engine instances as a tag.

* `dns_address`: The address at which the service can be found - usually the same as the service name.

* `apis`: A list of API objects; structure is documented below.

* `endpoints`: A list of Endpoint objects; structure is documented below.

- - -
### API Object Structure

* `name`: The FQDN of the API as described in the provided config.
* `syntax`: `SYNTAX_PROTO2` or `SYNTAX_PROTO3`.
* `version`: A version string for this api. If specified, will have the form major-version.minor-version, e.g. `1.10`.
Expand Down