-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13938 from dstevensson/f-aws_eks_node_group-prefix
resource/aws_eks_node_group: add support for node_group_name prefixes
- Loading branch information
Showing
5 changed files
with
229 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:enhancement | ||
resource/aws_eks_node_group: Add `node_group_name_prefix` argument | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package eks | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
) | ||
|
||
const nodeGroupResourceIDSeparator = ":" | ||
|
||
func NodeGroupCreateResourceID(clusterName, nodeGroupName string) string { | ||
parts := []string{clusterName, nodeGroupName} | ||
id := strings.Join(parts, nodeGroupResourceIDSeparator) | ||
|
||
return id | ||
} | ||
|
||
func NodeGroupParseResourceID(id string) (string, string, error) { | ||
parts := strings.Split(id, nodeGroupResourceIDSeparator) | ||
|
||
if len(parts) == 2 && parts[0] != "" && parts[1] != "" { | ||
return parts[0], parts[1], nil | ||
} | ||
|
||
return "", "", fmt.Errorf("unexpected format for ID (%[1]s), expected cluster-name%[2]snode-group-name", id, nodeGroupResourceIDSeparator) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.