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

Go: demonstrate how to use CfnParameter string values #849

Open
2 tasks
jpmcb opened this issue May 10, 2023 · 0 comments
Open
2 tasks

Go: demonstrate how to use CfnParameter string values #849

jpmcb opened this issue May 10, 2023 · 0 comments
Labels
feature-request A feature should be added or improved. language/go Related to Go examples p2

Comments

@jpmcb
Copy link

jpmcb commented May 10, 2023

Describe the feature

Let's say that I have this function

func CreateCluster(stack constructs.Construct, instanceType awscdk.CfnParameter) eks.Cluster {
        cluster := awseks.NewCluster(stack, jsii.String("my-cluster"), &awseks.ClusterProps{ ... })

	cluster.AddNodegroupCapacity(jsii.String("my-nodegroup"), &eks.NodegroupOptions{
		InstanceTypes: &[]ec2.InstanceType{
			ec2.NewInstanceType(instanceType.ValueAsString()),
                }
        })
}

where I want to pass in a cdk parameter.

Doing the above breaks in weird ways:

panic: Error: Malformed instance type identifier

goroutine 1 [running]:

Doing a

fmt.Printf("Instance type: %v\n", instanceType.ValueAsString())

shows that the value at buildtime is actually just a node as a string:

Instance type: ${Token[TOKEN.652]}

What am I missing here? I expected ValueAsString() to just work ™️

Use Case

Having an example of using ValueAsString() would be really useful for passing parameters to Go cdk stacks.

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Language

Go

@jpmcb jpmcb added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels May 10, 2023
@ericzbeard ericzbeard removed the needs-triage This issue or PR still needs to be triaged. label Jul 14, 2023
@kaiz-io kaiz-io added language/go Related to Go examples p2 labels Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. language/go Related to Go examples p2
Projects
None yet
Development

No branches or pull requests

3 participants