Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

TF aborts after performing manual changes / Rancher API return values / ??? #60

Open
flypenguin opened this issue Nov 13, 2017 · 2 comments
Labels

Comments

@flypenguin
Copy link

Hi there,

Terraform Version

0.10.8

Affected Resource(s)

  • rancher_environment (?)
  • rancher_registration_token (?)

Terraform Configuration Files

# only the essential parts

resource "rancher_environment" "test" {
  name = "Test"

  #project_template_id = "${var.rancher_cattle_project_template_id}"
  orchestration = "cattle"
}

resource "rancher_registration_token" "compute" {
  name           = "Environment 'Cattle0' nodes"
  environment_id = "${rancher_environment.test.id}"
}

Debug Output

Expected Behavior

Terraform should just continue, and update the environment as described in the HCL files.

Actual Behavior

Terraform aborts with this error message:

Error: Error refreshing state: 1 error(s) occurred:

* rancher_registration_token.compute: 1 error(s) occurred:

* rancher_registration_token.compute: rancher_registration_token.compute: Bad response statusCode [403]. Status [403 Forbidden]. Body: [code=Forbidden, message=Forbidden, baseType=error] from [https://rancher0.c11h-wonderwoman.de/v2-beta/projects/1a7/schemas]

Steps to Reproduce

I am not sure, honestly. This is how I would do it:

  1. Create an environment in Rancher with Terraform.
  2. Delete the environment manually.
  3. terraform destroy

Important Factoids

The API browser gives the following behavior:

  • there is no project with ID "1a7", there is only one with "1a5".
  • I don't actually know why.
  • If I access the link above, I also get "403", which is wrong, cause I am authenticated. I think 404 would be way more appropriate.

References

N/A

@flypenguin flypenguin changed the title Rancher API seems to use wrong HTTP status codes TF aborts when doing manual changes / Rancher API return values / ??? Nov 13, 2017
@flypenguin flypenguin changed the title TF aborts when doing manual changes / Rancher API return values / ??? TF aborts after performing manual changes / Rancher API return values / ??? Nov 13, 2017
@mcanevet mcanevet added the bug label Nov 23, 2017
@mcanevet
Copy link
Contributor

@raphink I think we must check if the env is removed in the read function like we did for rancher_stack resource for example.

@mcanevet
Copy link
Contributor

@raphink it looks like it is already implemented https://github.com/terraform-providers/terraform-provider-rancher/blob/master/rancher/resource_rancher_environment.go#L155-L159 but @cryptobioz also noted this failing behavior. Any idea?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants