Skip to content

Regression: environments cannot have : charcaters #3105

@acouvreur

Description

@acouvreur

Introduced by: https://github.com/integrations/terraform-provider-github/blame/15fff783674a8c26cf536a3f84ef662520baccb7/github/resource_github_repository_environment.go#L234

Our environments have the : character, and since update v6.10.0 we can no longer use the provider to provision our environments.

We have the following error message:

Error: unexpected ID format ("some-repository:my:environment")

Where we have one environment named my:environment.


I can probably do a fix, but the issue is that everything relies on the parseID method which ensures that it properly split into a given count.

func parseID(id string, count int) ([]string, error) {
if len(id) == 0 {
return nil, fmt.Errorf("id is empty")
}
parts := strings.Split(id, idSeparator)
if len(parts) != count {
return nil, fmt.Errorf("unexpected ID format (%q); expected %d parts separated by %q", id, count, idSeparator)
}
return parts, nil
}


I would fix this by ensuring that parseID2 splits in at least 2, and collect all the remaining splits in the second argument. Same for 3. Or by using a different separator but I'm not sure what the implications would be.

I'll do a PR and you'll give me some feedback.

Metadata

Metadata

Assignees

Labels

Type: BugSomething isn't working as documented

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions