Expected Behavior
If I have an existing environment in which some of the environment variables exist in Github and some do not yet exist running a apply should import existing resources and create missing resources.
Actual Behavior
Currently if the for_each block of an import points to a environment variable which does not yet exist apply will exit w/ a 404 instead of gracefully continuing and prompting that the resource will be created.
Terraform Version
Terraform v1.14.5
on darwin_arm64
Affected Resource(s)
- github_actions_environment_variable
Terraform Configuration Files
locals {
variables = {
FOO = "bar" # already exists (should be imported)
HELLO = "world" # does not yet exist (should be created)
}
}
import {
for_each = local.variables
id = "repo/staging/${each.key}"
to = github_actions_environment_variable.variables[each.key]
}
resource "github_actions_environment_variable" "variables" {
for_each = local.variables
environment = "staging"
value = each.value
repository = "repo"
variable_name = each.key
}
Steps to Reproduce
Debug Output
Planning failed. Terraform encountered an error while generating this plan.
╷
│ Error: GET https://api.github.com/repos/org/repo/environments/staging/variables/HELLO: 404 Not Found []
Panic Output
Code of Conduct
Expected Behavior
If I have an existing environment in which some of the environment variables exist in Github and some do not yet exist running a
applyshould import existing resources and create missing resources.Actual Behavior
Currently if the
for_eachblock of animportpoints to a environment variable which does not yet existapplywill exit w/ a 404 instead of gracefully continuing and prompting that the resource will be created.Terraform Version
Terraform v1.14.5
on darwin_arm64
Affected Resource(s)
Terraform Configuration Files
Steps to Reproduce
Debug Output
Planning failed. Terraform encountered an error while generating this plan. ╷ │ Error: GET https://api.github.com/repos/org/repo/environments/staging/variables/HELLO: 404 Not Found []Panic Output
Code of Conduct