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

add several components #73

Merged
merged 3 commits into from
Dec 18, 2019
Merged

add several components #73

merged 3 commits into from
Dec 18, 2019

Conversation

tormath1
Copy link
Contributor

In this PR, I added three more components for Google provider:

  • google_sql_database_instance (SQL service)
  • google_storage_bucket (Cloud storage)
  • google_compute_disk (Persistent disks)

For the first time, we are using APIs different than compute. I slightly updated the template to handle different APIs (new field API).

As mentioned in this commit: c29aad5, you'll need to enable SQL APIs if you want to play with SQL instances.

I also added a field NoFilter field since buckets can not be filtered.

@tormath1 tormath1 added Type: Enhancement Provide a new feature or improve an existing one Provider: GCP Issues related to the GCP Provider labels Dec 17, 2019
@tormath1 tormath1 self-assigned this Dec 17, 2019
Copy link
Member

@xescugc xescugc left a comment

Choose a reason for hiding this comment

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

LGTM, just one comment.

// for a complete list of API: https://godoc.org/google.golang.org/api
// ex: compute, storage
// default goes to `compute`
API string
Copy link
Member

Choose a reason for hiding this comment

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

I would potentially name it Service, they refer to "them" as Google Cloud Services.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In Google SDK, API refers to Google Cloud Service and Service refers to a component of this API.

Example: Google Compute Engine is a Google Cloud Service, compute is the name of the API in the SDK and InstancesService is a service to manage instances.

Replace API with Service could lead to potential errors, since we already have a ServiceName fields:

// ServiceName is name of the Google SDK service name
// If your service is `TargetHttpProxy`, your service name will
// be `TargetHttpProxies`
ServiceName string

doc: https://www.terraform.io/docs/providers/google/r/storage_bucket.html

To add this component, some updates have been made:

* add API to template

since the beginning, we work only with `compute` APIs. We need to
be able to easily switch from one API to the other when we declare a new
component.
In order to keep compatibility, default API goes to `compute`

* add `NoFilter` option to the template

most of the resource are based on filters. We need a way to
specify if a resource is not using filter

* add `storage` to the reader

* add `ResourceList` option

ResourceList overrides the default name of the resources list: `resourceList`
exemple:
for the components Instance, the list struct is `InstanceList`
but for the components Bucket, the list struct is `Buckets`
since this component is in beta4 access, you will need to
manually enable API from the console.
See: https://cloud.google.com/sql/docs/postgres/admin-api/
@tormath1 tormath1 merged commit 1f22f1e into master Dec 18, 2019
@tormath1 tormath1 deleted the several-components branch December 18, 2019 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Provider: GCP Issues related to the GCP Provider Type: Enhancement Provide a new feature or improve an existing one
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants