-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
GH-23 Add “ForceNew” field to “key” attribute
- Loading branch information
Showing
7 changed files
with
219 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## 1.0.3 (Feb 24, 2022) | ||
|
||
BUG FIXES: | ||
|
||
* resource/project: Add `ForceNew` field to `key` attribute to ensure resource is destroyed and recreated when key is changed. [GH-24] |
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 |
---|---|---|
|
@@ -37,15 +37,28 @@ terraform { | |
required_providers { | ||
artifactory = { | ||
source = "registry.terraform.io/jfrog/artifactory" | ||
version = "2.6.24" | ||
version = "2.20.0" | ||
} | ||
project = { | ||
source = "registry.terraform.io/jfrog/project" | ||
version = "0.9.2" | ||
version = "1.0.3" | ||
} | ||
} | ||
} | ||
variable "artifactory_url" { | ||
type = string | ||
default = "http://localhost:8081" | ||
} | ||
provider "artifactory" { | ||
url = "${var.artifactory_url}" | ||
} | ||
provider "project" { | ||
url = "${var.artifactory_url}" | ||
} | ||
variable "qa_roles" { | ||
type = list(string) | ||
default = ["READ_REPOSITORY","READ_RELEASE_BUNDLE", "READ_BUILD", "READ_SOURCES_PIPELINE", "READ_INTEGRATIONS_PIPELINE", "READ_POOLS_PIPELINE", "TRIGGER_PIPELINE"] | ||
|
@@ -56,6 +69,8 @@ variable "devop_roles" { | |
default = ["READ_REPOSITORY", "ANNOTATE_REPOSITORY", "DEPLOY_CACHE_REPOSITORY", "DELETE_OVERWRITE_REPOSITORY", "TRIGGER_PIPELINE", "READ_INTEGRATIONS_PIPELINE", "READ_POOLS_PIPELINE", "MANAGE_INTEGRATIONS_PIPELINE", "MANAGE_SOURCES_PIPELINE", "MANAGE_POOLS_PIPELINE", "READ_BUILD", "ANNOTATE_BUILD", "DEPLOY_BUILD", "DELETE_BUILD",] | ||
} | ||
# Artifactory resources | ||
resource "artifactory_user" "user1" { | ||
name = "user1" | ||
email = "[email protected]" | ||
|
@@ -82,20 +97,21 @@ resource "artifactory_group" "release-group" { | |
admin_privileges = false | ||
} | ||
resource "artifactory_local_repository" "docker-local" { | ||
key = "docker-local" | ||
package_type = "docker" | ||
xray_index = false | ||
description = "hello docker-local" | ||
resource "artifactory_local_docker_v2_repository" "docker-local" { | ||
key = "docker-local" | ||
description = "hello docker-local" | ||
tag_retention = 3 | ||
max_unique_tags = 5 | ||
} | ||
resource "artifactory_remote_repository" "npm-remote" { | ||
key = "npm-remote" | ||
package_type = "npm" | ||
url = "https://registry.npmjs.org" | ||
xray_index = true | ||
resource "artifactory_remote_npm_repository" "npm-remote" { | ||
key = "npm-remote" | ||
url = "https://registry.npmjs.org" | ||
mismatching_mime_types_override_list = "application/json,application/xml" | ||
} | ||
# Project resources | ||
resource "project" "myproject" { | ||
key = "myproj" | ||
display_name = "My Project" | ||
|
@@ -152,8 +168,8 @@ resource "project" "myproject" { | |
artifactory_user.user2, | ||
artifactory_group.qa-group, | ||
artifactory_group.release-group, | ||
artifactory_local_repository.docker-local, | ||
artifactory_remote_repository.npm-remote, | ||
artifactory_local_docker_v2_repository.docker-local, | ||
artifactory_remote_npm_repository.npm-remote, | ||
] | ||
} | ||
``` | ||
|
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
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,140 @@ | ||
# Required for Terraform 0.13 and up (https://www.terraform.io/upgrade-guides/0-13.html) | ||
terraform { | ||
required_providers { | ||
artifactory = { | ||
source = "registry.terraform.io/jfrog/artifactory" | ||
version = "2.20.0" | ||
} | ||
project = { | ||
source = "registry.terraform.io/jfrog/project" | ||
version = "1.0.3" | ||
} | ||
} | ||
} | ||
|
||
variable "artifactory_url" { | ||
type = string | ||
default = "http://localhost:8081" | ||
} | ||
|
||
provider "artifactory" { | ||
url = "${var.artifactory_url}" | ||
} | ||
|
||
provider "project" { | ||
url = "${var.artifactory_url}" | ||
} | ||
|
||
variable "qa_roles" { | ||
type = list(string) | ||
default = ["READ_REPOSITORY","READ_RELEASE_BUNDLE", "READ_BUILD", "READ_SOURCES_PIPELINE", "READ_INTEGRATIONS_PIPELINE", "READ_POOLS_PIPELINE", "TRIGGER_PIPELINE"] | ||
} | ||
|
||
variable "devop_roles" { | ||
type = list(string) | ||
default = ["READ_REPOSITORY", "ANNOTATE_REPOSITORY", "DEPLOY_CACHE_REPOSITORY", "DELETE_OVERWRITE_REPOSITORY", "TRIGGER_PIPELINE", "READ_INTEGRATIONS_PIPELINE", "READ_POOLS_PIPELINE", "MANAGE_INTEGRATIONS_PIPELINE", "MANAGE_SOURCES_PIPELINE", "MANAGE_POOLS_PIPELINE", "READ_BUILD", "ANNOTATE_BUILD", "DEPLOY_BUILD", "DELETE_BUILD",] | ||
} | ||
|
||
# Artifactory resources | ||
|
||
resource "artifactory_user" "user1" { | ||
name = "user1" | ||
email = "[email protected]" | ||
groups = ["readers"] | ||
password = "Passw0rd!" | ||
} | ||
|
||
resource "artifactory_user" "user2" { | ||
name = "user2" | ||
email = "[email protected]" | ||
groups = ["readers"] | ||
password = "Passw0rd!" | ||
} | ||
|
||
resource "artifactory_group" "qa-group" { | ||
name = "qa" | ||
description = "QA group" | ||
admin_privileges = false | ||
} | ||
|
||
resource "artifactory_group" "release-group" { | ||
name = "release" | ||
description = "release group" | ||
admin_privileges = false | ||
} | ||
|
||
resource "artifactory_local_docker_v2_repository" "docker-local" { | ||
key = "docker-local" | ||
description = "hello docker-local" | ||
tag_retention = 3 | ||
max_unique_tags = 5 | ||
} | ||
|
||
resource "artifactory_remote_npm_repository" "npm-remote" { | ||
key = "npm-remote" | ||
url = "https://registry.npmjs.org" | ||
mismatching_mime_types_override_list = "application/json,application/xml" | ||
} | ||
|
||
# Project resources | ||
|
||
resource "project" "myproject" { | ||
key = "myproj" | ||
display_name = "My Project" | ||
description = "My Project" | ||
admin_privileges { | ||
manage_members = true | ||
manage_resources = true | ||
index_resources = true | ||
} | ||
max_storage_in_gibibytes = 10 | ||
block_deployments_on_limit = false | ||
email_notification = true | ||
|
||
member { | ||
name = "user1" | ||
roles = ["Developer", "Project Admin"] | ||
} | ||
|
||
member { | ||
name = "user2" | ||
roles = ["Developer"] | ||
} | ||
|
||
group { | ||
name = "qa" | ||
roles = ["qa"] | ||
} | ||
|
||
group { | ||
name = "release" | ||
roles = ["Release Manager"] | ||
} | ||
|
||
role { | ||
name = "qa" | ||
description = "QA role" | ||
type = "CUSTOM" | ||
environments = ["DEV"] | ||
actions = var.qa_roles | ||
} | ||
|
||
role { | ||
name = "devop" | ||
description = "DevOp role" | ||
type = "CUSTOM" | ||
environments = ["DEV", "PROD"] | ||
actions = var.devop_roles | ||
} | ||
|
||
repos = ["docker-local", "npm-remote"] | ||
|
||
depends_on = [ | ||
artifactory_user.user1, | ||
artifactory_user.user2, | ||
artifactory_group.qa-group, | ||
artifactory_group.release-group, | ||
artifactory_local_docker_v2_repository.docker-local, | ||
artifactory_remote_npm_repository.npm-remote, | ||
] | ||
} |
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
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
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