func GetResourceID()

in pkg/cloudformation/helpers.go [124:139]


func GetResourceID(cfnSvc cloudformationiface.CloudFormationAPI, stackName string, logicalID string) (string, error) {
	resources, err := cfnSvc.ListStackResources(&cloudformation.ListStackResourcesInput{
		StackName: aws.String(stackName),
	})
	if err != nil {
		return "", err
	}

	for _, resourceSummary := range resources.StackResourceSummaries {
		if *resourceSummary.LogicalResourceId == logicalID {
			return *resourceSummary.PhysicalResourceId, nil
		}
	}

	return "", fmt.Errorf("resource %s not found", logicalID)
}