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

Providers tries to create environment even though it was already created #79

Open
Real-Gecko opened this issue Dec 9, 2024 · 1 comment

Comments

@Real-Gecko
Copy link

Real-Gecko commented Dec 9, 2024

Following the official docs I've created an environment for the project, after running apply environment is created.

data "infisical_projects" "myproj" {
  slug = "whatever"
}
resource "infisical_project_environment" "testing" {
  name       = "testing"
  project_id = data.infisical_projects.myproj.id
  slug       = "testing"
}

terraform plan

Terraform used the selected providers to generate the following execution plan. Resource
actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # module.agp.infisical_project_environment.testing will be created
  + resource "infisical_project_environment" "testing" {
      + id         = (known after apply)
      + name       = "testing"
      + position   = (known after apply)
      + project_id = "somenumbers"
      + slug       = "testing"
    }

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

terraform apply

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Environment created
image

terraform state list shows that resource has been added to the state.
However running plan again shows that environment will be added once more.
No surprise second apply fails because environment already exists.

│ Couldn't save project environment, unexpected error: CallCreateProjectEnvironment:
│ Unsuccessful response. [response={"statusCode":400,"message":"Environment with slug already
│ exist","error":"Create envv"}]

Provider version v0.12.4

@Real-Gecko
Copy link
Author

Also, removing resource definition is not registered, so terraform plan does not propose environment deletion.

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

1 participant