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 data source for forwarding rule #1078

Merged
merged 3 commits into from
Feb 14, 2018

Conversation

jphalip
Copy link
Contributor

@jphalip jphalip commented Feb 13, 2018

No description provided.


"load_balancing_scheme": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Copy link
Contributor

@nat-henderson nat-henderson Feb 13, 2018

Choose a reason for hiding this comment

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

Should these also be Computed? And are they really Optional? It looks like they'll be overwritten as soon as the read happens, regardless of their value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Which parameters are you exactly referring to? Note: Here I've reused the same schema as in resource_compute_forwarding_rule.go.

Copy link
Contributor

@nat-henderson nat-henderson Feb 13, 2018

Choose a reason for hiding this comment

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

Right, but as this is a data source, fundamentally all the parameters except the name, region, and project are Computed - no changes are made based on the user setting them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, so just to be clear, are you saying that this should be the schema? https://gist.github.com/jphalip/c0409e5b3e898898ce7706eb48b83950

Copy link
Contributor

Choose a reason for hiding this comment

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

That looks right to me, yes - I think the tests should pass with that schema, and that accurately represents what this does.

d.Set("project", project)
d.Set("region", region)

d.SetId(frule.Name)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a tad silly in this instance, but we have a convention of preferring the SetId to go right after the confirmation of successful read. That way the item is refreshable in the event of a shutdown or panic from some other thread, rather than requiring recreation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just pushed an update for that. Does that work?

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.

Looks good, running tests now.

@nat-henderson nat-henderson merged commit 1966a79 into hashicorp:master Feb 14, 2018
ishashchuk pushed a commit to wayfair-archive/terraform-provider-google that referenced this pull request Feb 20, 2018
chrisst pushed a commit to chrisst/terraform-provider-google that referenced this pull request Nov 9, 2018
@ghost
Copy link

ghost commented Mar 29, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants