Skip to content

Commit

Permalink
Allow other repo types for AR (hashicorp#4604) (hashicorp#3068)
Browse files Browse the repository at this point in the history
Co-authored-by: upodroid <[email protected]>
Signed-off-by: Modular Magician <[email protected]>

Co-authored-by: upodroid <[email protected]>
  • Loading branch information
modular-magician and upodroid authored Mar 19, 2021
1 parent 46f366b commit 6b5a6bf
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .changelog/4604.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
artifactregistry: relaxed field validations for format field of `google_artifact_registry_repository`
```
2 changes: 1 addition & 1 deletion google-beta/artifact_registry_operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (w *ArtifactRegistryOperationWaiter) QueryOp() (interface{}, error) {
return nil, fmt.Errorf("Cannot query operation, it's unset or nil.")
}
// Returns the proper get.
url := fmt.Sprintf("https://artifactregistry.googleapis.com/v1beta1/%s", w.CommonOperationWaiter.Op.Name)
url := fmt.Sprintf("https://artifactregistry.googleapis.com/v1beta2/%s", w.CommonOperationWaiter.Op.Name)

return sendRequest(w.Config, "GET", w.Project, url, w.UserAgent, nil)
}
Expand Down
2 changes: 1 addition & 1 deletion google-beta/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ var ActiveDirectoryDefaultBasePath = "https://managedidentities.googleapis.com/v
var ApiGatewayDefaultBasePath = "https://apigateway.googleapis.com/v1beta/"
var ApigeeDefaultBasePath = "https://apigee.googleapis.com/v1/"
var AppEngineDefaultBasePath = "https://appengine.googleapis.com/v1/"
var ArtifactRegistryDefaultBasePath = "https://artifactregistry.googleapis.com/v1beta1/"
var ArtifactRegistryDefaultBasePath = "https://artifactregistry.googleapis.com/v1beta2/"
var BigQueryDefaultBasePath = "https://bigquery.googleapis.com/bigquery/v2/"
var BigqueryConnectionDefaultBasePath = "https://bigqueryconnection.googleapis.com/v1beta1/"
var BigqueryDataTransferDefaultBasePath = "https://bigquerydatatransfer.googleapis.com/v1/"
Expand Down
10 changes: 4 additions & 6 deletions google-beta/resource_artifact_registry_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"time"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
)

func resourceArtifactRegistryRepository() *schema.Resource {
Expand All @@ -44,11 +43,10 @@ func resourceArtifactRegistryRepository() *schema.Resource {

Schema: map[string]*schema.Schema{
"format": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"DOCKER"}, false),
Description: `The format of packages that are stored in the repository. Possible values: ["DOCKER"]`,
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: `The format of packages that are stored in the repository.`,
},
"repository_id": {
Type: schema.TypeString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func testSweepArtifactRegistryRepository(region string) error {
},
}

listTemplate := strings.Split("https://artifactregistry.googleapis.com/v1beta1/projects/{{project}}/locations/{{location}}/repositories", "?")[0]
listTemplate := strings.Split("https://artifactregistry.googleapis.com/v1beta2/projects/{{project}}/locations/{{location}}/repositories", "?")[0]
listUrl, err := replaceVars(d, config, listTemplate)
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] error preparing sweeper list url: %s", err)
Expand Down Expand Up @@ -103,7 +103,7 @@ func testSweepArtifactRegistryRepository(region string) error {
continue
}

deleteTemplate := "https://artifactregistry.googleapis.com/v1beta1/projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}"
deleteTemplate := "https://artifactregistry.googleapis.com/v1beta2/projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}"
deleteUrl, err := replaceVars(d, config, deleteTemplate)
if err != nil {
log.Printf("[INFO][SWEEPER_LOG] error preparing delete url: %s", err)
Expand Down
3 changes: 1 addition & 2 deletions website/docs/r/artifact_registry_repository.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ See [Provider Versions](https://terraform.io/docs/providers/google/guides/provid

To get more information about Repository, see:

* [API documentation](https://cloud.google.com/artifact-registry/docs/reference/rest/)
* [API documentation](https://cloud.google.com/artifact-registry/docs/reference/rest/v1beta2/projects.locations.repositories)
* How-to Guides
* [Official Documentation](https://cloud.google.com/artifact-registry/docs/overview)

Expand Down Expand Up @@ -118,7 +118,6 @@ The following arguments are supported:
* `format` -
(Required)
The format of packages that are stored in the repository.
Possible values are `DOCKER`.


- - -
Expand Down

0 comments on commit 6b5a6bf

Please sign in to comment.