Skip to content
This repository has been archived by the owner on Oct 12, 2018. It is now read-only.

Add resource_count #20

Closed
wants to merge 2 commits into from
Closed

Add resource_count #20

wants to merge 2 commits into from

Conversation

gordalina
Copy link

Adds a new optional variable resource_count which asserts that the number of resources created are equal to the given value. When this variable is not defined, no check is made.

Fixes #4

@ericchiang
Copy link
Owner

This check is there to make sure the next line returns something sane

selflink := data.Items[0].Metadata.Selflink

To support multiple resources, we'd want to track all the returned selflinks and encode them in the ID.

@gordalina
Copy link
Author

@ericchiang pushed a commit to address your comment

@ericchiang
Copy link
Owner

Thanks! Unfortunately, terraform plugins also need to read the self link data when performing a delete, and to determine if the resource still exists remotely. You can see the code here:

	resource, namespace, ok := resourceFromSelflink(d.Id())

So more of the plugin needs to change to handle the new ID format. The ID format also needs to be backward compatible. The plugin has to understand old IDs as well for data that's already been persisted.

Give me a sec. I can make the changes.

@gordalina
Copy link
Author

Awesome, appreciate it!

@ericchiang
Copy link
Owner

Can you take a look at #21 and maybe test it?

@gordalina
Copy link
Author

Closing in favor of #21 and #23

@gordalina gordalina closed this Sep 19, 2018
@gordalina gordalina deleted the fix-4 branch September 19, 2018 18:33
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