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

New Resource: r/aws_config_authorization #4263

Merged
merged 1 commit into from
Jun 3, 2018

Conversation

gazoakley
Copy link
Contributor

@gazoakley gazoakley commented Apr 19, 2018

Partially implements #4067

New Resources:

  • aws_config_authorization
$ AWS_PROFILE=personal make testacc TESTARGS='-run=TestAccConfigAuthorization'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -run=TestAccConfigAuthorization -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccConfigAuthorization_import
--- PASS: TestAccConfigAuthorization_import (24.76s)
=== RUN   TestAccConfigAuthorization_basic
--- PASS: TestAccConfigAuthorization_basic (21.88s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	46.688s

@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Apr 19, 2018
@bflad bflad added new-resource Introduces a new resource. service/configservice Issues and PRs that pertain to the configservice service. labels Apr 20, 2018
@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Apr 21, 2018
@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Apr 21, 2018
@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Apr 23, 2018
@gazoakley gazoakley changed the title [WIP] New Resource: r/aws_config_authorization New Resource: r/aws_config_authorization Apr 23, 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.

Thanks for submitting this @gazoakley! 👍 Overall the PR is really good and passes acceptance testing -- there are just a few minor things that I will spend time adjusting post-merge for naming clarity, bug prevention, and to adjust this PR for some forward looking initiatives we have in the provider.

return fmt.Errorf("Error deleting authorization: %s", err)
}

d.SetId("")
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor nitpick: d.SetId("") is extraneous in delete functions

@@ -303,6 +303,7 @@ func Provider() terraform.ResourceProvider {
"aws_cloudwatch_log_resource_policy": resourceAwsCloudWatchLogResourcePolicy(),
"aws_cloudwatch_log_stream": resourceAwsCloudWatchLogStream(),
"aws_cloudwatch_log_subscription_filter": resourceAwsCloudwatchLogSubscriptionFilter(),
"aws_config_authorization": resourceAwsConfigAuthorization(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry this is going to be very pedantic but the Config API refers to these as "aggregate" authorization and the resource/function naming should reflect that for clarity and in case they introduce other forms/types of authorization.

"aws_config_aggregate_authorization": resourceAwsConfigAggregateAuthoriation(),

d.Set("account_id", accountId)
d.Set("region", region)

res, err := conn.DescribeAggregationAuthorizations(&configservice.DescribeAggregationAuthorizationsInput{})
Copy link
Contributor

Choose a reason for hiding this comment

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

This call does not currently handle NextToken so it can incorrectly report errors/missing resources in large or separate API responses.

}
conn := client.(*AWSClient).configconn

resp, err := conn.DescribeAggregationAuthorizations(&configservice.DescribeAggregationAuthorizationsInput{})
Copy link
Contributor

Choose a reason for hiding this comment

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

This call does not currently handle NextToken so it can potentially miss authorizations in large or separate API responses.

resp, err := conn.DescribeAggregationAuthorizations(&configservice.DescribeAggregationAuthorizationsInput{})

if err == nil {
if len(resp.AggregationAuthorizations) != 0 &&
Copy link
Contributor

Choose a reason for hiding this comment

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

There may be additional other authorizations present, especially with testing concurrency or in non-testing accounts. This needs to be updated to specifically handle NextToken and loop through all authorizations, only returning an error if the account ID and region is found.


## Attributes Reference

The following attributes are exported:
Copy link
Contributor

Choose a reason for hiding this comment

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

We're in the process of updating all these for clarity (#4685): In addition to all arguments above, the following attributes are exported:

"github.com/hashicorp/terraform/helper/resource"
)

func TestAccConfigAuthorization_import(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor nitpick: we're going to move away from separate import test files and tests (#4705). We can simply add the final TestStep the existing _basic test 👍

@bflad bflad added this to the v1.22.0 milestone Jun 3, 2018
@bflad bflad merged commit 41ce326 into hashicorp:master Jun 3, 2018
bflad added a commit that referenced this pull request Jun 3, 2018
=== RUN   TestAccAWSConfigAggregateAuthorization_basic
--- PASS: TestAccAWSConfigAggregateAuthorization_basic (41.80s)
bflad added a commit that referenced this pull request Jun 3, 2018
@gazoakley
Copy link
Contributor Author

@bflad Could we have at least stuck with aws_config_aggregator_authorization? Currently after #4262 there'd be:

  • aws_config_aggregate_authorization
  • aws_config_aggregator

That doesn't gel well together - it suggests they might be related but not for certain (the console always refers to aggregator(s))

@bflad
Copy link
Contributor

bflad commented Jun 5, 2018

@gazoakley sorry for any initial confusion -- we wound up renaming both of the resources to match the API more closely. If the link between the two is not obvious we should probably cross-link them accordingly in the resource documentation for each of them.

This has been released in version 1.22.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
@gazoakley gazoakley deleted the f-config-authorization branch April 7, 2020 16:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-resource Introduces a new resource. service/configservice Issues and PRs that pertain to the configservice 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.

None yet

2 participants