integrations / terraform-provider-github

Terraform GitHub provider
https://www.terraform.io/docs/providers/github/
MIT License
905 stars 746 forks source link

[BUG]: Error: Provider produced inconsistent result after apply #2387

Open maximveksler opened 1 month ago

maximveksler commented 1 month ago

Expected Behavior

Terraform should be able to add variables on environments named with :

Actual Behavior

❯ terraform apply -auto-approve
data.github_repository.self: Reading...
data.github_repository.self: Read complete after 0s [id=github-terraform-provider-bug]

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:

  # github_actions_environment_variable.bug-vars["AWS_PROFILE"] will be created
  + resource "github_actions_environment_variable" "bug-vars" {
      + created_at    = (known after apply)
      + environment   = "dev:dry-run"
      + id            = (known after apply)
      + repository    = "github-terraform-provider-bug"
      + updated_at    = (known after apply)
      + value         = "value2"
      + variable_name = "AWS_PROFILE"
    }

  # github_actions_environment_variable.bug-vars["AWS_REGION"] will be created
  + resource "github_actions_environment_variable" "bug-vars" {
      + created_at    = (known after apply)
      + environment   = "dev:dry-run"
      + id            = (known after apply)
      + repository    = "github-terraform-provider-bug"
      + updated_at    = (known after apply)
      + value         = "value1"
      + variable_name = "AWS_REGION"
    }

  # github_actions_environment_variable.bug-vars["AWS_ROLE_TO_ASSUME"] will be created
  + resource "github_actions_environment_variable" "bug-vars" {
      + created_at    = (known after apply)
      + environment   = "dev:dry-run"
      + id            = (known after apply)
      + repository    = "github-terraform-provider-bug"
      + updated_at    = (known after apply)
      + value         = "value3"
      + variable_name = "AWS_ROLE_TO_ASSUME"
    }

  # github_actions_environment_variable.bug-vars["AZURE_CLIENT_ID"] will be created
  + resource "github_actions_environment_variable" "bug-vars" {
      + created_at    = (known after apply)
      + environment   = "dev:dry-run"
      + id            = (known after apply)
      + repository    = "github-terraform-provider-bug"
      + updated_at    = (known after apply)
      + value         = "value4"
      + variable_name = "AZURE_CLIENT_ID"
    }

  # github_repository_environment.bug will be created
  + resource "github_repository_environment" "bug" {
      + can_admins_bypass   = true
      + environment         = "dev:dry-run"
      + id                  = (known after apply)
      + prevent_self_review = false
      + repository          = "github-terraform-provider-bug"
    }

Plan: 5 to add, 0 to change, 0 to destroy.
github_repository_environment.bug: Creating...
github_repository_environment.bug: Creation complete after 2s [id=github-terraform-provider-bug:dev:dry-run]
github_actions_environment_variable.bug-vars["AWS_REGION"]: Creating...
github_actions_environment_variable.bug-vars["AWS_ROLE_TO_ASSUME"]: Creating...
github_actions_environment_variable.bug-vars["AWS_PROFILE"]: Creating...
github_actions_environment_variable.bug-vars["AZURE_CLIENT_ID"]: Creating...
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to github_actions_environment_variable.bug-vars["AWS_ROLE_TO_ASSUME"], provider "provider[\"registry.terraform.io/integrations/github\"]" produced an unexpected new value: Root
│ object was present, but now absent.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to github_actions_environment_variable.bug-vars["AWS_REGION"], provider "provider[\"registry.terraform.io/integrations/github\"]" produced an unexpected new value: Root object was
│ present, but now absent.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to github_actions_environment_variable.bug-vars["AZURE_CLIENT_ID"], provider "provider[\"registry.terraform.io/integrations/github\"]" produced an unexpected new value: Root object
│ was present, but now absent.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to github_actions_environment_variable.bug-vars["AWS_PROFILE"], provider "provider[\"registry.terraform.io/integrations/github\"]" produced an unexpected new value: Root object was
│ present, but now absent.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
Time: 0h:00m:10s                                                                                                                                                                                               

Terraform Version

❯ terraform --version
Terraform v1.8.2
on darwin_arm64
+ provider registry.terraform.io/integrations/github v6.3.0

Affected Resource(s)

Terraform Configuration Files

No response

Steps to Reproduce

https://github.com/maximveksler/github-terraform-provider-bug.git

Clone

git clone https://github.com/maximveksler/github-terraform-provider-bug.git

Edit

  1. owner in providers.tf
  2. full_name in infra.tf

Apply

terraform apply

Debug Output

No response

Panic Output

No response

Code of Conduct

maximveksler commented 1 month ago

Note that environment variables ARE created on the resource.

screencapture-github-maximveksler-github-terraform-provider-bug-settings-environments-3991709488-edit-2024-09-15-11_45_59