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

d/aws_codeartifact_repository_endpoint: Support for NuGet #16422

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.