Skip to content

Commit

Permalink
data-source/aws_codeartifact_repository_endpoint: Test and document s…
Browse files Browse the repository at this point in the history
…upport for NuGet (#16422)

Output from acceptance testing:

```
--- PASS: TestAccAWSCodeArtifactRepositoryEndpointDataSource_basic (59.57s)
--- PASS: TestAccAWSCodeArtifactRepositoryEndpointDataSource_owner (16.86s)
```
  • Loading branch information
ewbankkit authored Nov 25, 2020
1 parent 09d8e1a commit 5bc18ce
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 9 deletions.
37 changes: 30 additions & 7 deletions aws/data_source_aws_codeartifact_repository_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,28 @@ func TestAccAWSCodeArtifactRepositoryEndpointDataSource_basic(t *testing.T) {
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccCheckAWSCodeArtifactRepositoryEndpointBasicConfig(rName),
Config: testAccCheckAWSCodeArtifactRepositoryEndpointBasicConfig(rName, "npm"),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(dataSourceName, "repository_endpoint"),
testAccCheckResourceAttrAccountID(dataSourceName, "domain_owner"),
),
},
{
Config: testAccCheckAWSCodeArtifactRepositoryEndpointBasicConfig(rName, "pypi"),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(dataSourceName, "repository_endpoint"),
testAccCheckResourceAttrAccountID(dataSourceName, "domain_owner"),
),
},
{
Config: testAccCheckAWSCodeArtifactRepositoryEndpointBasicConfig(rName, "maven"),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(dataSourceName, "repository_endpoint"),
testAccCheckResourceAttrAccountID(dataSourceName, "domain_owner"),
),
},
{
Config: testAccCheckAWSCodeArtifactRepositoryEndpointBasicConfig(rName, "nuget"),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(dataSourceName, "repository_endpoint"),
testAccCheckResourceAttrAccountID(dataSourceName, "domain_owner"),
Expand Down Expand Up @@ -66,25 +87,27 @@ resource "aws_codeartifact_repository" "test" {
`, rName)
}

func testAccCheckAWSCodeArtifactRepositoryEndpointBasicConfig(rName string) string {
return testAccCheckAWSCodeArtifactRepositoryEndpointBaseConfig(rName) +
func testAccCheckAWSCodeArtifactRepositoryEndpointBasicConfig(rName, format string) string {
return composeConfig(
testAccCheckAWSCodeArtifactRepositoryEndpointBaseConfig(rName),
fmt.Sprintf(`
data "aws_codeartifact_repository_endpoint" "test" {
domain = aws_codeartifact_domain.test.domain
repository = aws_codeartifact_repository.test.repository
format = "npm"
format = %[1]q
}
`)
`, format))
}

func testAccCheckAWSCodeArtifactRepositoryEndpointOwnerConfig(rName string) string {
return testAccCheckAWSCodeArtifactRepositoryEndpointBaseConfig(rName) +
return composeConfig(
testAccCheckAWSCodeArtifactRepositoryEndpointBaseConfig(rName),
fmt.Sprintf(`
data "aws_codeartifact_repository_endpoint" "test" {
domain = aws_codeartifact_domain.test.domain
repository = aws_codeartifact_repository.test.repository
domain_owner = aws_codeartifact_domain.test.owner
format = "npm"
}
`)
`))
}
4 changes: 2 additions & 2 deletions website/docs/d/codeartifact_repository_endpoint.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ The following arguments are supported:

* `domain` - (Required) The name of the domain that contains the repository.
* `repository` - (Required) The name of the repository.
* `format` - (Required) Which endpoint of a repository to return. A repository has one endpoint for each package format: `npm`, `pypi`, and `maven`.
* `format` - (Required) Which endpoint of a repository to return. A repository has one endpoint for each package format: `npm`, `pypi`, `maven`, and `nuget`.
* `domain_owner` - (Optional) The account number of the AWS account that owns the domain.

## Attributes Reference

In addition to the argument above, the following attributes are exported:

* `repository_endpoint` - The URL of the returned endpoint.
* `repository_endpoint` - The URL of the returned endpoint.

0 comments on commit 5bc18ce

Please sign in to comment.