-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Redis support #192
Redis support #192
Conversation
templates/terraform/transport.go
Outdated
|
||
queries := u.Query() | ||
queries.Add("alt", "json") | ||
newUrl := u.Scheme + "://" + u.Host + u.Path + "?" + queries.Encode() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note to self: https://github.com/GoogleCloudPlatform/magic-modules/pull/191/files does it better
I am a robot that works on MagicModules PRs! I built this PR into one or more PRs on other repositories, and when those are closed, this PR will also be merged and closed. |
products/redis/api.yaml
Outdated
input: true | ||
<%= indent(compile_file({}, 'templates/regional_async.yaml.erb'), 4) %> | ||
parameters: | ||
- !ruby/object:Api::Type::String # TODO: resourceref? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Terraform, it doesn't really make a difference whether or not we have a Location resource defined in api.yaml, since we probably won't support it (perhaps as a data source, though if so that won't be for a while). But maybe the other providers would be better off with it! I wasn't sure, hence TODO.
products/redis/api.yaml
Outdated
self_link: projects/{{project}}/locations/{{region}}/instances/{{name}} | ||
description: | | ||
A Google Cloud Redis instance. | ||
input: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a reference block with the links to API documentation and guide:
references: !ruby/object:Api::Resource::ReferenceLinks
guides:
'Reserving a Static External IP Address':
'https://cloud.google.com/compute/docs/ip-addresses/reserve-static-external-ip-address'
api: 'https://cloud.google.com/compute/docs/reference/latest/globalAddresses'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
and can change after a failover event. | ||
output: true | ||
- !ruby/object:Api::Type::String | ||
name: displayName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No update method for this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It uses patch with updateMasks which I'll want to spend some time testing, so I figure no update support for now and then I'll do it in a follow-up PR.
products/redis/terraform.yaml
Outdated
required: false | ||
default: !ruby/object:Provider::Terraform::Default | ||
from_api: true | ||
reservedIpRange: !ruby/object:Provider::Terraform::PropertyOverride |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to see :BASIC as the default value for tier
? And set required to false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, done.
products/redis/api.yaml
Outdated
values: | ||
- :BASIC | ||
- :STANDARD_HA | ||
required: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new line at end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
- !ruby/object:Api::Resource | ||
name: 'Instance' | ||
exclude: true | ||
base_url: | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few things here:
- The
base_url
is to provide a collection. You probably wantself_link_query
instead - Keep
base_url: projects/{{project}}/locations/{{region}}/instances
- Remove
self_link
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what a collection is in this context?
The reason I did it this way is that in the Terraform templates, we use base_url
(via collection_url
) to create the resource, and then self_link
(via self_link_url
) to read, update, and delete it. For redis, the query params are in the create call, so we would call POST to projects/{{project}}/locations/{{region}}/instances?instanceId={{name}} to create it. Then once we want to read it though, it's a GET to projects/{{project}}/locations/{{region}}/instances/{{name}}. The way it is now outputs the correct URLs for the Terraform templates- would you change it to use custom code, or is this fine?
Looking into rspec failures. |
I'm filling in for a robot who works on MagicModules PRs! The robot tried to run tests, but:
Unfortunately, the robot's not smart enough yet to complain when things don't work. That's on the roadmap! |
I am (still) a robot that works on MagicModules PRs! I just wanted to let you know that your changes (as of commit f366eb5) have been included in your existing downstream PRs. |
I am (still) a robot that works on MagicModules PRs! I just wanted to let you know that your changes (as of commit e4e52a8) have been included in your existing downstream PRs. |
I am (still) a robot that works on MagicModules PRs! I just wanted to let you know that your changes (as of commit 24cbb67) have been included in your existing downstream PRs. |
I am (still) a robot that works on MagicModules PRs! I just wanted to let you know that your changes (as of commit c499376) have been included in your existing downstream PRs. |
@@ -91,6 +91,7 @@ In addition to the arguments listed above, the following computed attributes are | |||
<%= lines(build_nested_property_documentation(prop)) -%> | |||
<% end -%> | |||
|
|||
<% unless object.async.nil? -%> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shoot, I forgot to do that on mine. Good catch.
I am (still) a robot that works on MagicModules PRs! I just wanted to let you know that your changes (as of commit b4102f8) have been included in your existing downstream PRs. |
All right, the generated code in Terraform is looking good from my perspective, so this is ready for real reviews. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM, but you're going to need @nelsonjr to explain this self_link_query
vs self_link
vs collection situation. I agree this is right for what the templates do now, but the templates could be wrong, depending on what those things are meant to represent.
I am (still) a robot that works on MagicModules PRs! I just wanted to let you know that your changes (as of commit b3de14c) have been included in your existing downstream PRs. |
Tracked submodules are build/puppet/compute build/puppet/sql build/terraform.
I am (still) a robot that works on MagicModules PRs! I just wanted to let you know that your changes (as of commit 7fce509) have been included in your existing downstream PRs. |
Adds a new Redis resource and enables it in Terraform.
[all]
[terraform]
Redis resource
[puppet]
[puppet-dns]
[puppet-sql]
[puppet-compute]
[chef]