<commit_before>package cloudformationv2

import (
	"context"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/service/cloudformation"
	"github.com/giantswarm/apiextensions/pkg/apis/provider/v1alpha1"
	"github.com/giantswarm/microerror"

	"github.com/giantswarm/aws-operator/service/keyv2"
)

func (r *Resource) ApplyCreateChange(ctx context.Context, obj, createChange interface{}) error {
	cluster, err := keyv2.ToCustomObject(obj)
	if err != nil {
		return microerror.Mask(err)
	}

	stackInput, err := toCreateStackInput(createChange)
	if err != nil {
		return microerror.Mask(err)
	}

	r.logger.LogCtx(ctx, "debug", "creating AWS cloudformation stack")

	if stackInput.StackName != nil {
		_, err = r.Clients.CloudFormation.CreateStack(&stackInput)
		if err != nil {
			return microerror.Mask(err)
		}
		err = r.HostClients.CloudFormation.WaitUntilStackCreateComplete(&cloudformation.DescribeStacksInput{<commit_msg>fix stacks creation (#635)<commit_after>package cloudformationv2

import (
	"context"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/service/cloudformation"
	"github.com/giantswarm/apiextensions/pkg/apis/provider/v1alpha1"
	"github.com/giantswarm/microerror"

	"github.com/giantswarm/aws-operator/service/keyv2"
)

func (r *Resource) ApplyCreateChange(ctx context.Context, obj, createChange interface{}) error {
	cluster, err := keyv2.ToCustomObject(obj)
	if err != nil {
		return microerror.Mask(err)
	}

	stackInput, err := toCreateStackInput(createChange)
	if err != nil {
		return microerror.Mask(err)
	}

	r.logger.LogCtx(ctx, "debug", "creating AWS cloudformation stack")

	if stackInput.StackName != nil {
		_, err = r.Clients.CloudFormation.CreateStack(&stackInput)
		if err != nil {
			return microerror.Mask(err)
		}
		err = r.Clients.CloudFormation.WaitUntilStackCreateComplete(&cloudformation.DescribeStacksInput{
{'fraction_non_alphanumeric': 0.1288081239978621, 'fraction_numerical': 0.00694815606627472, 'mean_word_length': 5.157894736842105, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '402880', 'n_tokens_mistral': 683, 'n_tokens_neox': 647, 'n_words': 106}