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

Redis support #192

Merged
merged 17 commits into from
May 23, 2018
Merged

Redis support #192

merged 17 commits into from
May 23, 2018

Conversation

danawillow
Copy link
Contributor

@danawillow danawillow commented May 12, 2018

Adds a new Redis resource and enables it in Terraform.


[all]

[terraform]

Redis resource

[puppet]

[puppet-dns]

[puppet-sql]

[puppet-compute]

[chef]


queries := u.Query()
queries.Add("alt", "json")
newUrl := u.Scheme + "://" + u.Host + u.Path + "?" + queries.Encode()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@modular-magician
Copy link
Collaborator

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.
depends: hashicorp/terraform-provider-google#1485

input: true
<%= indent(compile_file({}, 'templates/regional_async.yaml.erb'), 4) %>
parameters:
- !ruby/object:Api::Type::String # TODO: resourceref?
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not?

Copy link
Contributor Author

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.

self_link: projects/{{project}}/locations/{{region}}/instances/{{name}}
description: |
A Google Cloud Redis instance.
input: true
Copy link
Contributor

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'

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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.

required: false
default: !ruby/object:Provider::Terraform::Default
from_api: true
reservedIpRange: !ruby/object:Provider::Terraform::PropertyOverride
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, done.

values:
- :BASIC
- :STANDARD_HA
required: true
Copy link
Contributor

Choose a reason for hiding this comment

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

new line at end?

Copy link
Contributor Author

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: |
Copy link
Contributor

Choose a reason for hiding this comment

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

A few things here:

  1. The base_url is to provide a collection. You probably want self_link_query instead
  2. Keep base_url: projects/{{project}}/locations/{{region}}/instances
  3. Remove self_link

Copy link
Contributor Author

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?

@danawillow
Copy link
Contributor Author

Looking into rspec failures.

@nat-henderson
Copy link
Contributor

I'm filling in for a robot who works on MagicModules PRs!

The robot tried to run tests, but:

+ go test -v ./google -parallel 16 -run '^Test' -timeout 1m
# github.com/terraform-providers/terraform-provider-google/google
google/transport.go:79:37: undefined: raw
google/transport.go:108:12: undefined: urllib
FAIL	github.com/terraform-providers/terraform-provider-google/google [build failed]

Unfortunately, the robot's not smart enough yet to complain when things don't work. That's on the roadmap!

@modular-magician
Copy link
Collaborator

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.

@modular-magician
Copy link
Collaborator

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.

@modular-magician
Copy link
Collaborator

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.

@modular-magician
Copy link
Collaborator

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? -%>
Copy link
Contributor

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.

@modular-magician
Copy link
Collaborator

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.

@danawillow danawillow changed the title WIP: initial redis support Redis support May 21, 2018
@danawillow
Copy link
Contributor Author

All right, the generated code in Terraform is looking good from my perspective, so this is ready for real reviews.

Copy link
Contributor

@nat-henderson nat-henderson left a 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.

@modular-magician
Copy link
Collaborator

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.
@modular-magician modular-magician merged commit c507db5 into master May 23, 2018
@danawillow danawillow deleted the redis branch May 23, 2018 19:47
@modular-magician
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants