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

data.aws_ecr_repository: Add new ECR Repository data source #944

Merged
merged 4 commits into from
Jun 26, 2017
Merged

data.aws_ecr_repository: Add new ECR Repository data source #944

merged 4 commits into from
Jun 26, 2017

Conversation

RyanFrench
Copy link
Contributor

Adds a new data source, for retrieving information about an ECR repository using the name.

@Ninir Ninir added the new-data-source Introduces a new data source. label Jun 23, 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.

Hi @RyanFrench,

Thanks for the work here, this is a nice addition! :)

I left a few comments regarding wording mainly. Could you give an eye on this please?

Thanks!

Read: dataSourceAwsEcrRepositoryRead,

Schema: map[string]*schema.Schema{
"name": &schema.Schema{
Copy link
Contributor

Choose a reason for hiding this comment

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

These redundant composite literals can be safely removed (doable since Go 1.7), so this could be:

"name": {

Could you reflect the same modification everywhere where needed? Thanks!

conn := meta.(*AWSClient).ecrconn

repositoryName := d.Get("name").(string)
log.Printf("[DEBUG] Reading repository %s", repositoryName)
Copy link
Contributor

Choose a reason for hiding this comment

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

To better debug things, could you update this sentence to: Reading ECR repository named %s?


repository := out.Repositories[0]

log.Printf("[DEBUG] Received repository %s", out)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you also update this log for something like: Received ECR repository %s?

Also, if you are exposing the out structure, I would suggest something like Received ECR repository %#v, what do you think?


The following arguments are supported:

* `name` - (Required) The name of the ECR Repository
Copy link
Contributor

Choose a reason for hiding this comment

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

As for attributes, could you also add a dot at the end?


* `arn` - Full ARN of the repository.
* `registry_id` - The registry ID where the repository was created.
* `repository_url` - The URL of the repository (in the form `aws_account_id.dkr.ecr.region.amazonaws.com/repositoryName`
Copy link
Contributor

Choose a reason for hiding this comment

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

Small typo there: missing bracket at the end

@RyanFrench
Copy link
Contributor Author

Hi @Ninir

Thank you for the review. I believe I have now addressed your comments.

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 @RyanFrench,

Just added a log instruction when the ECR repository is not found.

Just ran the test, this seems all good to me otherwise!

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

Thanks for your work! :)

@Ninir Ninir merged commit 7079266 into hashicorp:master Jun 26, 2017
@ghost
Copy link

ghost commented Apr 12, 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 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-data-source Introduces a new data source.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants