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

tests/d/servicecat_launch_paths: Fix for assumed role #20001

Merged
merged 2 commits into from
Jun 30, 2021

Conversation

YakDriver
Copy link
Member

@YakDriver YakDriver commented Jun 29, 2021

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment 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 pull request followers and do not help prioritize the request

Closes #19998

Output from acceptance testing (us-west-2):

Using an assumed role:

--- PASS: TestAccAWSServiceCatalogLaunchPathsDataSource_basic (74.30s)

Output from acceptance testing (GovCloud):

Not using an assumed role:

--- PASS: TestAccAWSServiceCatalogLaunchPathsDataSource_basic (75.94s)

@github-actions github-actions bot added service/servicecatalog Issues and PRs that pertain to the servicecatalog service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/XS Managed by automation to categorize the size of a PR. labels Jun 29, 2021
@ewbankkit
Copy link
Contributor

Before

=== RUN   TestAccAWSServiceCatalogLaunchPathsDataSource_basic
=== PAUSE TestAccAWSServiceCatalogLaunchPathsDataSource_basic
=== CONT  TestAccAWSServiceCatalogLaunchPathsDataSource_basic
    data_source_aws_servicecatalog_launch_paths_test.go:18: Step 1/1 error: Error running apply: exit status 1
        2021/06/29 16:42:49 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.14.0
        
        Error: error associating Service Catalog Principal with Portfolio: InvalidParametersException: Invalid parameter principalArn, assumed-role is not a recognized IAM identity type
        
          on terraform_plugin_test.tf line 80, in resource "aws_servicecatalog_principal_portfolio_association" "test":
          80: resource "aws_servicecatalog_principal_portfolio_association" "test" {
        
        
--- FAIL: TestAccAWSServiceCatalogLaunchPathsDataSource_basic (68.09s)

After

=== RUN   TestAccAWSServiceCatalogLaunchPathsDataSource_basic
=== PAUSE TestAccAWSServiceCatalogLaunchPathsDataSource_basic
=== CONT  TestAccAWSServiceCatalogLaunchPathsDataSource_basic
    data_source_aws_servicecatalog_launch_paths_test.go:18: Step 1/1 error: After applying this test step and performing a `terraform refresh`, the plan was not empty.
        stdout
        
        
        An execution plan has been generated and is shown below.
        Resource actions are indicated with the following symbols:
         <= read (data resources)
        
        Terraform will perform the following actions:
        
          # data.aws_servicecatalog_launch_paths.test will be read during apply
          # (config refers to values not yet known)
         <= data "aws_servicecatalog_launch_paths" "test"  {
              + id         = (known after apply)
              + product_id = "prod-i6xyd5nahepsy"
              + summaries  = (known after apply)
            }
        
        Plan: 0 to add, 0 to change, 0 to destroy.
--- FAIL: TestAccAWSServiceCatalogLaunchPathsDataSource_basic (75.49s)

@YakDriver
Copy link
Member Author

YakDriver commented Jun 29, 2021

This PR includes plugin SDK 2.7.0. This does not seem to play nicely with TF 0.14. See #19982.

I just re-ran these tests with TF 1.0.1:

--- PASS: TestAccAWSServiceCatalogLaunchPathsDataSource_basic (76.17s) # GovCloud
--- PASS: TestAccAWSServiceCatalogLaunchPathsDataSource_basic (87.80s) # us-west-2

@ewbankkit
Copy link
Contributor

Yes, I was actually running the acceptance test with Terraform 0.12.31.
Re-running with Terraform 1.0.0 passed:

% make testacc TEST=./aws TESTARGS='-run=TestAccAWSServiceCatalogLaunchPathsDataSource_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSServiceCatalogLaunchPathsDataSource_basic -timeout 180m
=== RUN   TestAccAWSServiceCatalogLaunchPathsDataSource_basic
=== PAUSE TestAccAWSServiceCatalogLaunchPathsDataSource_basic
=== CONT  TestAccAWSServiceCatalogLaunchPathsDataSource_basic
--- PASS: TestAccAWSServiceCatalogLaunchPathsDataSource_basic (90.13s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	94.894s

Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀.

@ewbankkit
Copy link
Contributor

I suggest changing

data "aws_servicecatalog_launch_paths" "test" {
  product_id = aws_servicecatalog_product_portfolio_association.test.product_id

  depends_on = [aws_servicecatalog_principal_portfolio_association.test]
}

to

data "aws_servicecatalog_launch_paths" "test" {
  product_id = aws_servicecatalog_product_portfolio_association.test.product_id
}

as the depends_on is unnecessary (there's already an explicit dependency between the data source and resource) and this causes the Terraform 0.12.31 acceptance test issue.

@YakDriver
Copy link
Member Author

I juggled the dependencies around to avoid depends_on.

@YakDriver YakDriver added this to the v3.48.0 milestone Jun 30, 2021
@YakDriver YakDriver merged commit 5e3132e into main Jun 30, 2021
@YakDriver YakDriver deleted the t-servicecat-launchpath-assume branch June 30, 2021 19:40
github-actions bot pushed a commit that referenced this pull request Jun 30, 2021
@github-actions
Copy link

github-actions bot commented Jul 8, 2021

This functionality has been released in v3.48.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

github-actions bot commented Aug 8, 2021

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/servicecatalog Issues and PRs that pertain to the servicecatalog service. size/XS Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

servicecatalog: Test for launch paths data source fails if using assumed role
2 participants