Support creating zones in a specific account #72
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for creating zones in a specific Cloudflare account (as specified by the existing account_id param on the provider config).
With this change, when account_id is set on the provider it's included in the POST request to
/zones
when creating a new zone:(https://developers.cloudflare.com/api/operations/zones-post)
This resolves a current issue whereby new zones are created in the wrong account when the api token isn't created on the account where the zone is intended to be created.
As an example, say that Contoso Inc has a Cloudflare organization/account and adds Alice as an authorized administrator. Alice sets up an api token under her [email protected] Cloudflare user account. If Alice uses octodns to create a new zone, the zone will be created in Alice's account not Contoso Inc's account as desired because Cloudflare interprets a request to create a zone without an
account_id
as a request to create it on the current user's account.With this change, if
account_id
is set to the Contoso Inc's account, the zone is properly created on the Contoso Inc account.