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

Add 'aws_cloudtrail_service_account' data source #1774

Conversation

ewbankkit
Copy link
Contributor

New data source aws_cloudtrail_service_account to return the account ID and account ARN of the AWS CloudTrail service in the specified region.
See:

Acceptance tests:

make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSCloudTrailServiceAccount_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -run=TestAccAWSCloudTrailServiceAccount_ -timeout 120m
=== RUN   TestAccAWSCloudTrailServiceAccount_basic
--- PASS: TestAccAWSCloudTrailServiceAccount_basic (29.16s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	30.209s

@radeksimko radeksimko added enhancement Requests to existing resources that expand the functionality or scope. new-data-source Introduces a new data source. labels Oct 2, 2017
Copy link
Contributor

@Ninir Ninir left a comment

Choose a reason for hiding this comment

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

Hey @ewbankkit

Just left a few cosmetic changes to discuss :)

Thanks for the work!


if accid, ok := cloudTrailServiceAccountPerRegionMap[region]; ok {
d.SetId(accid)
d.Set("arn", fmt.Sprintf("arn:%s:iam::%s:root", meta.(*AWSClient).partition, accid))
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed.
I added a new arn.go file and associated functions in #1775 which I could use here if that's merged and I rebase.
Also mentioned in #1783.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, as it has been merged, should be all ok!

Get AWS CloudTrail Service Account ID for storing trail data in S3.
---

# aws\_cloudtrail\_service\_account
Copy link
Contributor

Choose a reason for hiding this comment

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

These antislashes are not needed anymore when writing markdown

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I'll correct.

"Version": "2008-10-17",
"Statement": [
{
"Sid": "Put bucket policy needed for trails",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you fix indentations there? 2 spaces would be really nice :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do.

@ewbankkit ewbankkit force-pushed the add-data_source_cloudtrail_service_account branch from 3c901bf to f78f23e Compare October 11, 2017 12:49
@ewbankkit
Copy link
Contributor Author

Rebased from master and squashed commits.
Re-ran acceptance tests:

make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSCloudTrailServiceAccount_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -run=TestAccAWSCloudTrailServiceAccount_ -timeout 120m
=== RUN   TestAccAWSCloudTrailServiceAccount_basic
--- PASS: TestAccAWSCloudTrailServiceAccount_basic (19.89s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	20.919s

@radeksimko radeksimko force-pushed the add-data_source_cloudtrail_service_account branch 3 times, most recently from 19514f9 to b5687df Compare October 27, 2017 13:41
@radeksimko radeksimko force-pushed the add-data_source_cloudtrail_service_account branch from b5687df to 3177675 Compare October 27, 2017 13:53
Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

Thanks, I just resolved last conflicts 👍 🚀

@radeksimko radeksimko merged commit 6371b04 into hashicorp:master Oct 27, 2017
@ewbankkit ewbankkit deleted the add-data_source_cloudtrail_service_account branch October 27, 2017 18:49
@ghost
Copy link

ghost commented Apr 10, 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 10, 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. new-data-source Introduces a new data source.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants