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

cloudflare_zone import issue - zone not set #169

Closed
abohne opened this issue Nov 27, 2018 · 5 comments
Closed

cloudflare_zone import issue - zone not set #169

abohne opened this issue Nov 27, 2018 · 5 comments

Comments

@abohne
Copy link

abohne commented Nov 27, 2018

importing a zone doesn't set zone forcing a new resource next plan/apply.

terraform import cloudflare_zone.myzone ba6556bfef261f3373d1d544af786ccb
Import successful!

on next plan
zone: "" => "domain.name" (forces new resource)

Similar to #161 and #165

provider.cloudflare 1.9

@chasen
Copy link

chasen commented Dec 5, 2018

I too am having this issue, is there any known workaround?

@chasen
Copy link

chasen commented Dec 5, 2018

Found the answer to my own question:

After you import the zone, you can go into your tfstate file and manually update the zone:

"cloudflare_zone.domainName": {
    "type": "cloudflare_zone",
    "depends_on": [],
    "primary": {
        "id": "<ID>",
        "attributes": {
            "id": "<ID>",
            "meta.%": "2",
            "meta.phishing_detected": "false",
            "meta.wildcard_proxiable": "false",
            "name_servers.#": "2",
            "name_servers.0": "mira.ns.cloudflare.com",
            "name_servers.1": "pete.ns.cloudflare.com",
            "paused": "false",
            "status": "active",
            "type": "full",
            "vanity_name_servers.#": "0",
            "zone": "domainName.com" // <-- Add this line
        },
        "meta": {},
        "tainted": false
    },
    "deposed": [],
    "provider": "provider.cloudflare"
},

@jacobbednarz
Copy link
Member

cloudflare_zone doesn't have a provider specific import and instead just relies on ImportStatePassthrough which essentially just passes in the ID and then the code makes some assumptions about what it is.

I'll submit a PR to add an Import method to allow setting this instead of relying on the assumptions.

@chasen I don't recommend munging state files by hand as it can often leads to more issues.

@jacobbednarz
Copy link
Member

Actually, there isn't any need for me to do anything here. This has already been addressed via #157 and works on master. 1.9 is indeed broken.

@patryk
Copy link
Contributor

patryk commented Jan 7, 2019

Fixed in 1.10.

@patryk patryk closed this as completed Jan 7, 2019
boekkooi-lengoo pushed a commit to boekkooi-lengoo/terraform-provider-cloudflare that referenced this issue Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants