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

resource/aws_emrcontainers_virtual_cluster: new resource #17355

Conversation

shuheiktgw
Copy link
Collaborator

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

Relates #16717

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccXXX'

...

@ghost ghost added size/XL Managed by automation to categorize the size of a PR. service/emrcontainers Issues and PRs that pertain to the emrcontainers service. labels Jan 29, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Jan 29, 2021
@shuheiktgw shuheiktgw force-pushed the add_aws_emrcontainers_virtual_cluster branch from 7fad24f to 003d090 Compare January 31, 2021 07:14
@ghost ghost added the provider Pertains to the provider itself, rather than any interaction with AWS. label Jan 31, 2021
Type: schema.TypeString,
Computed: true,
},
"id": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not needed as TF always has a top level id attribute

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Didn't know that! Thank you!

Type: schema.TypeString,
Computed: true,
},
"name": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Lets add validation to name based on docs: https://docs.aws.amazon.com/emr-on-eks/latest/APIReference/API_CreateVirtualCluster.html#API_CreateVirtualCluster_RequestSyntax

Len is between 1 and 64
and must conform to the following regex: [\.\-_/#A-Za-z0-9]+

return fmt.Errorf("error creating EMR containers virtual cluster: %w", err)
}

if _, err := waiter.VirtualClusterCreated(conn, aws.StringValue(out.Id)); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing SetId to the cluster id

@ghost ghost added the tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. label Jan 31, 2021
@shuheiktgw
Copy link
Collaborator Author

Hmm, while writing acc tests, I noticed those two steps are not possible through the current terraform-aws-provider:

  1. We cannot create Kubernetes resources from terraform-aws-provider
  2. terraform-aws-provider still hasn't support EKS addons, which is necessary for IAM Roles for service accounts (Support Managing EKS Cluster Add-Ons #16542)

The second problem will be solved eventually but I'm not sure about how I can solve the first one... @DrFaust92 Do you have any ideas? 🙏

@DrFaust92
Copy link
Collaborator

Hey @shuheiktgw, do acc tests fail without those prerequisites? I don’t how they block creating the resource and using additional resources (and providers) to add access outside the scope of the tests

@shuheiktgw
Copy link
Collaborator Author

@DrFaust92 Yes without them, the acc test fails with the following error:

make testacc TESTARGS='-run=TestAccAwsEMRContainersVirtualCluster_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAwsEMRContainersVirtualCluster_basic -timeout 120m
=== RUN   TestAccAwsEMRContainersVirtualCluster_basic
=== PAUSE TestAccAwsEMRContainersVirtualCluster_basic
=== CONT  TestAccAwsEMRContainersVirtualCluster_basic
    resource_aws_emrcontainers_virtual_cluster_test.go:65: Step 1/2 error: Error running apply:
        Error: error creating EMR containers virtual cluster: ValidationException: Unauthorized to perform read namespace on default

I've looked into eksctl's PR to enable EMR containers, and they seem to create Kubernetes resources...

@shuheiktgw
Copy link
Collaborator Author

shuheiktgw commented Feb 3, 2021

@bflad @ewbankkit Do you people know how I can write an acc test that seemingly requires provisioning Kubernetes resources?

@bflad
Copy link
Contributor

bflad commented Feb 3, 2021

@shuheiktgw if it does not work by just including provider "kubernetes" {} in the configuration, it may be necessary to also use helper/resource.TestCase type ExternalProviders field, however we do not currently have any examples of multiple provider testing in this codebase anymore. Attempting to configure the Kubernetes provider using values from other resources may also require two TestStep.

The maintainers are very behind on the large backlog of existing pull requests, so unfortunately we cannot provide more guidance ourselves or guarantee when this will be reviewed.

@shuheiktgw
Copy link
Collaborator Author

Thank you @bflad! With that information, I think I can start writing the acc tests 👍

@anggao
Copy link

anggao commented Jun 10, 2021

@shuheiktgw do you have any updates on this PR :) looking forward to use it

@breathingdust breathingdust added new-resource Introduces a new resource. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 8, 2021
@zhelding
Copy link
Contributor

Pull request #21306 has significantly refactored the AWS Provider codebase. As a result, most PRs opened prior to the refactor now have merge conflicts that must be resolved before proceeding.

Specifically, PR #21306 relocated the code for all AWS resources and data sources from a single aws directory to a large number of separate directories in internal/service, each corresponding to a particular AWS service. This separation of code has also allowed for us to simplify the names of underlying functions -- while still avoiding namespace collisions.

We recognize that many pull requests have been open for some time without yet being addressed by our maintainers. Therefore, we want to make it clear that resolving these conflicts in no way affects the prioritization of a particular pull request. Once a pull request has been prioritized for review, the necessary changes will be made by a maintainer -- either directly or in collaboration with the pull request author.

For a more complete description of this refactor, including examples of how old filepaths and function names correspond to their new counterparts: please refer to issue #20000.

For a quick guide on how to amend your pull request to resolve the merge conflicts resulting from this refactor and bring it in line with our new code patterns: please refer to our Service Package Refactor Pull Request Guide.

@ewbankkit
Copy link
Contributor

Superseded by #20003.

@ewbankkit ewbankkit closed this Apr 28, 2022
@github-actions
Copy link

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 May 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-resource Introduces a new resource. provider Pertains to the provider itself, rather than any interaction with AWS. service/emrcontainers Issues and PRs that pertain to the emrcontainers service. size/XL 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.

7 participants