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

issue #3158 add new argument additional_info in aws_emr_cluster #4590

Merged
merged 4 commits into from
May 23, 2018

Conversation

saravanan30erd
Copy link
Contributor

Fixes #3158

@ghost ghost added the size/S Managed by automation to categorize the size of a PR. label May 18, 2018
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

It might be worth asking AWS support if there is a way to read back the AdditionalInfo somewhere -- its not too obvious from the SDK and its documentation. Otherwise we should certainly note in our documentation that we cannot detect drift.

"additional_info": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

This attribute should not be Computed: true - we want to know when there is drift from the API

Copy link
Contributor Author

Choose a reason for hiding this comment

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

correct

@@ -42,6 +43,17 @@ func resourceAwsEMRCluster() *schema.Resource {
Optional: true,
ForceNew: true,
},
"additional_info": {
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to:

  • Add a new acceptance test and test configuration for this new attribute
  • Read it back into the Terraform state via d.Set("additional_info", XXXX)

As for the schema itself, we most likely need to add DiffSuppressFunc: suppressEquivalentJsonDiffs,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done all those changes 👍

if v, ok := d.GetOk("additional_info"); ok {
info, err := structure.NormalizeJsonString(v)
if err != nil {
return errwrap.Wrapf("Additional Info contains an invalid JSON: {{err}}", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

We should avoid the usage of errwrap.Wrapf() in resource functions in favor of the standard fmt.Errorf() -- we will be going through and cleaning up all the existing ones at some point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to fmt.Errorf

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/emr Issues and PRs that pertain to the emr service. labels May 18, 2018
@ghost ghost added size/L Managed by automation to categorize the size of a PR. and removed size/S Managed by automation to categorize the size of a PR. labels May 22, 2018
@saravanan30erd
Copy link
Contributor Author

@bflad I checked the AWS API documentation, looks like there is no option to read back the additional info right now. I tried in AWS CLI too. So I think we can note it in our documentation. please advise how?

@bflad
Copy link
Contributor

bflad commented May 22, 2018

A simple sentence with the new argument documentation is fine, something like Currently there is no API to retrieve the value of this argument after EMR cluster creation, therefore Terraform cannot detect drift from the actual EMR cluster if its value is changed outside Terraform.

@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label May 22, 2018
@saravanan30erd
Copy link
Contributor Author

@bflad thanks, updated documentation.

@bflad bflad added this to the v1.20.0 milestone May 23, 2018

scale_down_behavior = "TERMINATE_AT_TASK_COMPLETION"

bootstrap_action {
Copy link
Contributor

Choose a reason for hiding this comment

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

Future note: we should try to only add the required arguments in test configurations to prevent false positives with other arguments/resources (in this case this resource configuration should only have additional_info and the required resource attributes)

Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

LGTM -- thanks! 🚀

14 tests passed (all tests)
=== RUN   TestAccAWSEMRCluster_basic
--- PASS: TestAccAWSEMRCluster_basic (470.52s)
=== RUN   TestAccAWSEMRCluster_instance_group
--- PASS: TestAccAWSEMRCluster_instance_group (522.05s)
=== RUN   TestAccAWSEMRCluster_security_config
--- PASS: TestAccAWSEMRCluster_security_config (570.45s)
=== RUN   TestAccAWSEMRCluster_additionalInfo
--- PASS: TestAccAWSEMRCluster_additionalInfo (577.58s)
=== RUN   TestAccAWSEMRCluster_Kerberos_ClusterDedicatedKdc
--- PASS: TestAccAWSEMRCluster_Kerberos_ClusterDedicatedKdc (581.90s)
=== RUN   TestAccAWSEMRCluster_bootstrap_ordering
--- PASS: TestAccAWSEMRCluster_bootstrap_ordering (590.39s)
=== RUN   TestAccAWSEMRCluster_Step_Multiple
--- PASS: TestAccAWSEMRCluster_Step_Multiple (616.49s)
=== RUN   TestAccAWSEMRCluster_custom_ami_id
--- PASS: TestAccAWSEMRCluster_custom_ami_id (647.99s)
=== RUN   TestAccAWSEMRCluster_Step_Basic
--- PASS: TestAccAWSEMRCluster_Step_Basic (678.18s)
=== RUN   TestAccAWSEMRCluster_terminationProtected
--- PASS: TestAccAWSEMRCluster_terminationProtected (698.93s)
=== RUN   TestAccAWSEMRCluster_s3Logging
--- PASS: TestAccAWSEMRCluster_s3Logging (860.46s)
=== RUN   TestAccAWSEMRCluster_root_volume_size
--- PASS: TestAccAWSEMRCluster_root_volume_size (924.50s)
=== RUN   TestAccAWSEMRCluster_visibleToAllUsers
--- PASS: TestAccAWSEMRCluster_visibleToAllUsers (962.58s)
=== RUN   TestAccAWSEMRCluster_tags
--- PASS: TestAccAWSEMRCluster_tags (1030.03s)

@bflad bflad merged commit 70417de into hashicorp:master May 23, 2018
bflad added a commit that referenced this pull request May 23, 2018
@bflad
Copy link
Contributor

bflad commented May 23, 2018

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

@ghost
Copy link

ghost commented Apr 5, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/emr Issues and PRs that pertain to the emr service. size/L Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Terraform supports for "Additional Info" field for EMR?
2 participants