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

aws_servicecatalog_portfolio_share concurrency and throttling issues #24729

Open
sbutler opened this issue May 10, 2022 · 4 comments · May be fixed by #24730
Open

aws_servicecatalog_portfolio_share concurrency and throttling issues #24729

sbutler opened this issue May 10, 2022 · 4 comments · May be fixed by #24730
Labels
bug Addresses a defect in current functionality. service/organizations Issues and PRs that pertain to the organizations service. service/servicecatalog Issues and PRs that pertain to the servicecatalog service.

Comments

@sbutler
Copy link
Contributor

sbutler commented May 10, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v1.1.9
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v4.13.0

Affected Resource(s)

  • aws_servicecatalog_portfolio_share

Terraform Configuration Files

terraform {
    required_version = "~> 1.1"
    required_providers {
        aws = {
            source = "hashicorp/aws"
            version = "~> 4.13"
        }
    }
}

variable "ou_names" {
    type    = list(string)
    default = ["example1", "example2", "example3"]
}

data "aws_organizations_organization" "this" {}

resource "aws_organizations_organizational_unit" "example" {
    for_each = toset(var.ou_names)

    name      = each.key
    parent_id = data.aws_organizations_organization.this.roots[0].id
}


resource "aws_servicecatalog_portfolio" "example" {
    name          = "Portfolio Share Bug Report"
    description   = "Example for reporting a bug in portfolio shares."
    provider_name = "Me"
}

resource "aws_servicecatalog_portfolio_share" "example_ou" {
    for_each = toset(var.ou_names)

    portfolio_id = aws_servicecatalog_portfolio.example.id
    principal_id = aws_organizations_organizational_unit.example[each.key].arn
    type         = "ORGANIZATIONAL_UNIT"
}

Debug Output

https://gist.github.com/sbutler/a0c33af877aed4e5c9ac05d6658edeea

Expected Behavior

The portfolio should be shared to all the OU's.

Actual Behavior

One or more might be created, but some will get a ThrottlingException and not be shared.

Steps to Reproduce

  1. terraform apply

Important Factoids

Although I could not find documentation, experimentation revealed:

  • AWS Service Catalog only supports creating a single portfolio share at a time.
  • The CreatePortfolioShare API call can succeed, but the later DescribePortfolioShareStatus call can return an error in the ShareDetail.ShareErrors[*].Error field. After adding some enhanced error logging I could see this was ThrottlingException in my example.
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/organizations Issues and PRs that pertain to the organizations service. service/servicecatalog Issues and PRs that pertain to the servicecatalog service. labels May 10, 2022
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels May 12, 2022
@vaibhawamck
Copy link

Please merge this, need it urgently. Thank you!

@sl-miguelmichee
Copy link

any news on this PR?

@cacack
Copy link

cacack commented Oct 20, 2023

How about now? I believe our team is now getting bitten by this and I'd rather not have to revert our changes to manage Service Catalog Portfolio shares..

@srgoni
Copy link

srgoni commented Aug 8, 2024

I'm not sure if this is has the same root cause, but I'm getting the following error when doing multiple concurrent deassociations (for example when changing the elements of the for_each):

InvalidStateException: Cannot process more than one portfolio share action at the same time for account ####. Try again later.

Please consider this as well in a possible fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/organizations Issues and PRs that pertain to the organizations service. service/servicecatalog Issues and PRs that pertain to the servicecatalog service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants