Skip to content

Add DiffSuppress for Target HTTP(S) Proxies #1263

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

Merged
merged 2 commits into from
Mar 27, 2018
Merged

Add DiffSuppress for Target HTTP(S) Proxies #1263

merged 2 commits into from
Mar 27, 2018

Conversation

nickjacques
Copy link
Contributor

@nickjacques nickjacques commented Mar 27, 2018

Prevents no-op diff/change during plan/apply. Example of such a no-op diff:

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  ~ google_compute_target_https_proxy.foobar
      url_map: "https://www.googleapis.com/compute/beta/projects/***/global/urlMaps/httpsproxy-test-url-map" => "https://www.googleapis.com/compute/v1/projects/***/global/urlMaps/httpsproxy-test-url-map"


Plan: 0 to add, 1 to change, 0 to destroy.

Example with DiffSuppress:

No changes. Infrastructure is up-to-date.

This means that Terraform did not detect any differences between your
configuration and real physical resources that exist. As a result, no
actions need to be performed.

Required: true,
Type: schema.TypeString,
Required: true,
DiffSuppressFunc: compareSelfLinkOrResourceName,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think the API would accept the resource name, would it? We have a lot of logic around the codebase (see the fns in field_helpers.go and where they get called) to convert between names and self links so users can supply either one, which would enable the use of this diffsuppress. So if you wanted to add that logic that would totally work (and maybe make some people's experience better), but a much easier solution is to use compareSelfLinkRelativePaths instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I just took another glance at this, and it looks like there actually is a difference: .../compute/beta/ vs .../compute/v1/.... I was indeed using the self-link of the URL map and not the resource name alone. So it looks like compareSelfLinkRelativePaths looks like the better option here. I'll update to use that.

@danawillow
Copy link
Contributor

Thanks @nickjacques!

@danawillow danawillow merged commit c1d47a3 into hashicorp:master Mar 27, 2018
@nickjacques nickjacques deleted the target_proxy_url_map branch March 27, 2018 22:38
@ghost
Copy link

ghost commented Nov 19, 2018

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 Nov 19, 2018
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