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

[BUG]: github_repository_environment is unusable if the environment name contains / #1389

Closed
Sebelino opened this issue Nov 24, 2022 · 1 comment · Fixed by #1392
Closed
Labels
Good first issue Good for newcomers Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented

Comments

@Sebelino
Copy link
Contributor

Terraform Version

$ terraform -v                                        
Terraform v1.3.5
on linux_amd64

Affected Resource(s)

  • github_repository_environment

Terraform Configuration Files

resource "github_repository_environment" "this" {
  environment = "customer/production"
  repository  = "infrastructure"
}

Expected Behavior

Running terraform apply should create an environment named customer/production.

Actual Behavior

terraform apply fails with the following error message:

github_repository_environment.this: Creating...
╷
│ Error: PUT https://api.github.com/repos/Sebelino/infrastructure/environments/customer/production: 404 Not Found []
│ 
│   with github_repository_environment.this,
│   on main.tf line 82, in resource "github_repository_environment" "this":
│   82: resource "github_repository_environment" "this" {
│ 
╵

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. Create a github_repository_environment resource with a name that contains a front-slash (/).
  2. Run terraform apply

Important Factoids

The problem is that the environment name needs to be URL encoded before we make the call:

u := fmt.Sprintf("repos/%s/%s/environments/%s", owner, repo, name)

A workaround is to change the environment name to customer%2Fproduction, but that should not be necessary.

@Sebelino Sebelino changed the title github_repository_environment is unusable if the environment name contains / [BUG]: github_repository_environment is unusable if the environment name contains / Nov 24, 2022
@kfcampbell kfcampbell added Type: Bug Something isn't working as documented Status: Up for grabs Issues that are ready to be worked on by anyone Priority: Normal Good first issue Good for newcomers labels Nov 29, 2022
@kfcampbell
Copy link
Member

@Sebelino thanks for reporting! Is this something you'd have interest in opening a PR to fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good first issue Good for newcomers Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants