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

[stepfunctions-tasks] Broken example code #10729

Closed
kafka399 opened this issue Oct 6, 2020 · 4 comments · Fixed by #11028
Closed

[stepfunctions-tasks] Broken example code #10729

kafka399 opened this issue Oct 6, 2020 · 4 comments · Fixed by #11028
Assignees
Labels
@aws-cdk/aws-stepfunctions-tasks bug This issue is a bug. documentation This is a problem with documentation. effort/medium Medium work item – several days of effort p1

Comments

@kafka399
Copy link

kafka399 commented Oct 6, 2020

❓ General Issue

https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_stepfunctions_tasks.README.html

The Question

According the official AWS documentation, the following code should work:

    vpc = ec2.Vpc.from_lookup(stack, "Vpc",
        is_default=True
    )
    run_task = tasks.EcsRunTask(stack, "RunFargate",
        integration_pattern=sfn.IntegrationPattern.RUN_JOB,
        cluster=cluster,
        task_definition=task_definition,
        container_overrides=[ContainerOverride(
            container_definition=container_definition,
            environment=[TaskEnvironmentVariable(name="SOME_KEY", value=sfn.JsonPath.string_at("$.SomeKey"))]
        )],
        launch_target=tasks.EcsFargateLaunchTarget()
    )

However, I'm getting the following error:

    jsii.errors.JSIIError: There are no 'Private' subnet groups in this VPC. Available types: Public

I can add the following, but it just pushing the problem into StepFunction task, where subnets are created empty:

    subnets=ec2.SubnetSelection(subnets=vpc.private_subnets)

Can you update the documentation with working code?

Environment

  • CDK CLI Version: 1.66.0 (build 459488d)
  • Module Version:
  • Node.js Version: v10.15.3
  • OS: OSX Mojave
  • Language (Version): Python (3.7.3)

Other information

@kafka399 kafka399 added guidance Question that needs advice or information. needs-triage This issue or PR still needs to be triaged. labels Oct 6, 2020
@kafka399
Copy link
Author

kafka399 commented Oct 6, 2020

The following code allows to create a StepFunction task

   run_task = sf_task.EcsRunTask(self, "RunFargate",
                                        integration_pattern=sfn.IntegrationPattern.RUN_JOB,
                                        cluster=cluster,
                                        task_definition=task_def,
                                        **assign_public_ip=True,**
    .....)

However, the question remains, why docs provide a broken solution.

@SomayaB SomayaB changed the title [aws_stepfunctions_tasks] [stepfunctions-tasks] Oct 6, 2020
@SomayaB SomayaB added bug This issue is a bug. documentation This is a problem with documentation. and removed guidance Question that needs advice or information. labels Oct 6, 2020
@SomayaB SomayaB changed the title [stepfunctions-tasks] [stepfunctions-tasks] Broken example code Oct 6, 2020
@shivlaks
Copy link
Contributor

shivlaks commented Oct 6, 2020

thanks for reporting @kafka399 - I'll update the example (or happy to accept a PR if you want to open one!)
as for why there's a broken example - it's likely an oversight as it was some reused code plugged in to the README from a unit test.

@shivlaks shivlaks added documentation This is a problem with documentation. p1 effort/medium Medium work item – several days of effort and removed documentation This is a problem with documentation. needs-triage This issue or PR still needs to be triaged. labels Oct 6, 2020
@doodlesbykumbi
Copy link
Contributor

@kafka399 @shivlaks If I understood the solution correctly (which seems very simple) then here's a PR #11028

@mergify mergify bot closed this as completed in #11028 Oct 22, 2020
mergify bot pushed a commit that referenced this issue Oct 22, 2020
The example code for running a job from a task definition on Fargate requires public IP address assignment.

Closes #10729

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-stepfunctions-tasks bug This issue is a bug. documentation This is a problem with documentation. effort/medium Medium work item – several days of effort p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants