-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
artifactregistry: support custom remote repositories for language pac…
…kages (#10242)
- Loading branch information
1 parent
1275892
commit ac4caea
Showing
8 changed files
with
331 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...templates/terraform/custom_flatten/artifactregistry_rr_disable_upstream_validation.go.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { | ||
return d.Get("remote_repository_config.0.disable_upstream_validation") | ||
} |
42 changes: 42 additions & 0 deletions
42
...tes/terraform/examples/artifact_registry_repository_remote_docker_custom_with_auth.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
data "google_project" "project" {} | ||
|
||
resource "google_secret_manager_secret" "<%= ctx[:vars]['secret_resource_id'] %>" { | ||
secret_id = "<%= ctx[:vars]['secret_id'] %>" | ||
replication { | ||
auto {} | ||
} | ||
} | ||
|
||
resource "google_secret_manager_secret_version" "<%= ctx[:vars]['secret_resource_id'] %>_version" { | ||
secret = google_secret_manager_secret.<%= ctx[:vars]['secret_resource_id'] %>.id | ||
secret_data = "<%= ctx[:vars]['secret_data'] %>" | ||
} | ||
|
||
resource "google_secret_manager_secret_iam_member" "secret-access" { | ||
secret_id = google_secret_manager_secret.<%= ctx[:vars]['secret_resource_id'] %>.id | ||
role = "roles/secretmanager.secretAccessor" | ||
member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-artifactregistry.iam.gserviceaccount.com" | ||
} | ||
|
||
resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>" { | ||
location = "us-central1" | ||
repository_id = "<%= ctx[:vars]['repository_id'] %>" | ||
description = "<%= ctx[:vars]['description'] %>" | ||
format = "DOCKER" | ||
mode = "REMOTE_REPOSITORY" | ||
remote_repository_config { | ||
description = "custom docker remote with credentials" | ||
disable_upstream_validation = true | ||
docker_repository { | ||
custom_repository { | ||
uri = "https://registry-1.docker.io" | ||
} | ||
} | ||
upstream_credentials { | ||
username_password_credentials { | ||
username = "<%= ctx[:vars]['username'] %>" | ||
password_secret_version = google_secret_manager_secret_version.<%= ctx[:vars]['secret_resource_id'] %>_version.name | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...ates/terraform/examples/artifact_registry_repository_remote_maven_custom_with_auth.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
data "google_project" "project" {} | ||
|
||
resource "google_secret_manager_secret" "<%= ctx[:vars]['secret_resource_id'] %>" { | ||
secret_id = "<%= ctx[:vars]['secret_id'] %>" | ||
replication { | ||
auto {} | ||
} | ||
} | ||
|
||
resource "google_secret_manager_secret_version" "<%= ctx[:vars]['secret_resource_id'] %>_version" { | ||
secret = google_secret_manager_secret.<%= ctx[:vars]['secret_resource_id'] %>.id | ||
secret_data = "<%= ctx[:vars]['secret_data'] %>" | ||
} | ||
|
||
resource "google_secret_manager_secret_iam_member" "secret-access" { | ||
secret_id = google_secret_manager_secret.<%= ctx[:vars]['secret_resource_id'] %>.id | ||
role = "roles/secretmanager.secretAccessor" | ||
member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-artifactregistry.iam.gserviceaccount.com" | ||
} | ||
|
||
resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>" { | ||
location = "us-central1" | ||
repository_id = "<%= ctx[:vars]['repository_id'] %>" | ||
description = "<%= ctx[:vars]['description'] %>" | ||
format = "MAVEN" | ||
mode = "REMOTE_REPOSITORY" | ||
remote_repository_config { | ||
description = "custom maven remote with credentials" | ||
disable_upstream_validation = true | ||
maven_repository { | ||
custom_repository { | ||
uri = "https://my.maven.registry" | ||
} | ||
} | ||
upstream_credentials { | ||
username_password_credentials { | ||
username = "<%= ctx[:vars]['username'] %>" | ||
password_secret_version = google_secret_manager_secret_version.<%= ctx[:vars]['secret_resource_id'] %>_version.name | ||
} | ||
} | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...plates/terraform/examples/artifact_registry_repository_remote_npm_custom_with_auth.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
data "google_project" "project" {} | ||
|
||
resource "google_secret_manager_secret" "<%= ctx[:vars]['secret_resource_id'] %>" { | ||
secret_id = "<%= ctx[:vars]['secret_id'] %>" | ||
replication { | ||
auto {} | ||
} | ||
} | ||
|
||
resource "google_secret_manager_secret_version" "<%= ctx[:vars]['secret_resource_id'] %>_version" { | ||
secret = google_secret_manager_secret.<%= ctx[:vars]['secret_resource_id'] %>.id | ||
secret_data = "<%= ctx[:vars]['secret_data'] %>" | ||
} | ||
|
||
resource "google_secret_manager_secret_iam_member" "secret-access" { | ||
secret_id = google_secret_manager_secret.<%= ctx[:vars]['secret_resource_id'] %>.id | ||
role = "roles/secretmanager.secretAccessor" | ||
member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-artifactregistry.iam.gserviceaccount.com" | ||
} | ||
|
||
resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>" { | ||
location = "us-central1" | ||
repository_id = "<%= ctx[:vars]['repository_id'] %>" | ||
description = "<%= ctx[:vars]['description'] %>" | ||
format = "NPM" | ||
mode = "REMOTE_REPOSITORY" | ||
remote_repository_config { | ||
description = "custom npm with credentials" | ||
disable_upstream_validation = true | ||
npm_repository { | ||
custom_repository { | ||
uri = "https://my.npm.registry" | ||
} | ||
} | ||
upstream_credentials { | ||
username_password_credentials { | ||
username = "<%= ctx[:vars]['username'] %>" | ||
password_secret_version = google_secret_manager_secret_version.<%= ctx[:vars]['secret_resource_id'] %>_version.name | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.