Skip to content

Commit

Permalink
Update parameter version resource to support only beta version
Browse files Browse the repository at this point in the history
  • Loading branch information
abheda-crest committed Dec 31, 2024
1 parent 5bf5c75 commit 348c9b8
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ name: 'RegionalParameterVersion'
api_resource_type_kind: ParameterVersion
description: |
A Regional Parameter Version resource that stores the actual value of the regional parameter.
min_version: 'beta'
references:
guides:
api: 'https://cloud.google.com/secret-manager/parameter-manager/docs/reference/rest/v1/projects.locations.parameters.versions'
Expand All @@ -34,11 +35,13 @@ timeouts:
examples:
- name: 'regional_parameter_version_basic'
primary_resource_id: 'regional-parameter-version-basic'
min_version: 'beta'
vars:
parameter_id: 'regional_parameter'
parameter_version_id: 'regional_parameter_version'
- name: 'regional_parameter_version_with_json_format'
primary_resource_id: 'regional-parameter-version-with-json-format'
min_version: 'beta'
vars:
parameter_id: 'regional_parameter'
parameter_version_id: 'regional_parameter_version'
Expand All @@ -47,6 +50,7 @@ examples:
'data': '"./test-fixtures/parameter_data_json_format.json"'
- name: 'regional_parameter_version_with_yaml_format'
primary_resource_id: 'regional-parameter-version-with-yaml-format'
min_version: 'beta'
vars:
parameter_id: 'regional_parameter'
parameter_version_id: 'regional_parameter_version'
Expand All @@ -61,6 +65,7 @@ parameters:
type: ResourceRef
description: |
Parameter Manager Regional Parameter resource.
min_version: 'beta'
url_param_only: true
required: true
immutable: true
Expand All @@ -70,13 +75,15 @@ parameters:
type: String
description: |
Version ID of the Regional Parameter Version Resource. This must be unique within the Regional Parameter.
min_version: 'beta'
url_param_only: true
required: true
immutable: true
- name: 'location'
type: String
description: |
Location of Parameter Manager Regional parameter resource.
min_version: 'beta'
url_param_only: true
output: true
properties:
Expand All @@ -85,25 +92,30 @@ properties:
description: |
The resource name of the Regional Parameter Version. Format:
`projects/{{project}}/locations/{{location}}/parameters/{{parameter_id}}/versions/{{parameter_version_id}}`
min_version: 'beta'
output: true
- name: 'createTime'
type: String
description: |
The time at which the Regional Parameter Version was created.
min_version: 'beta'
output: true
- name: 'updateTime'
type: String
description: |
The time at which the Regional Parameter Version was updated.
min_version: 'beta'
output: true
- name: 'disabled'
type: Boolean
description: |
The current state of Regional Parameter Version. This field is only applicable for updating Regional Parameter Version.
min_version: 'beta'
- name: 'payload'
type: NestedObject
description: |
The parameter payload of the RegionalParameterVersion.
min_version: 'beta'
flatten_object: true
required: true
immutable: true
Expand All @@ -113,6 +125,7 @@ properties:
type: String
description: |
The Regional Parameter data.
min_version: 'beta'
api_name: data
required: true
immutable: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
resource "google_parameter_manager_regional_parameter" "regional-parameter-basic" {
provider = google-beta
parameter_id = "{{index $.Vars "parameter_id"}}"
location = "us-central1"
}

resource "google_parameter_manager_regional_parameter_version" "{{$.PrimaryResourceId}}" {
provider = google-beta
parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.id
parameter_version_id = "{{index $.Vars "parameter_version_id"}}"
parameter_data = "regional-parameter-version-data"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
resource "google_parameter_manager_regional_parameter" "regional-parameter-basic" {
provider = google-beta
parameter_id = "{{index $.Vars "parameter_id"}}"
format = "JSON"
location = "us-central1"
}

resource "google_parameter_manager_regional_parameter_version" "{{$.PrimaryResourceId}}" {
provider = google-beta
parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.id
parameter_version_id = "{{index $.Vars "parameter_version_id"}}"
parameter_data = file("{{index $.Vars "data"}}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
resource "google_parameter_manager_regional_parameter" "regional-parameter-basic" {
provider = google-beta
parameter_id = "{{index $.Vars "parameter_id"}}"
format = "YAML"
location = "us-central1"
}

resource "google_parameter_manager_regional_parameter_version" "{{$.PrimaryResourceId}}" {
provider = google-beta
parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.id
parameter_version_id = "{{index $.Vars "parameter_version_id"}}"
parameter_data = file("{{index $.Vars "data"}}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestAccParameterManagerRegionalRegionalParameterVersion_update(t *testing.T

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
CheckDestroy: testAccCheckParameterManagerRegionalRegionalParameterVersionDestroyProducer(t),
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -53,11 +53,13 @@ func TestAccParameterManagerRegionalRegionalParameterVersion_update(t *testing.T
func testAccParameterManagerRegionalRegionalParameterVersion_basic(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_parameter_manager_regional_parameter" "regional-parameter-update" {
provider = google-beta
parameter_id = "tf_test_regional_parameter%{random_suffix}"
location = "us-central1"
}
resource "google_parameter_manager_regional_parameter_version" "regional-parameter-version-update" {
provider = google-beta
parameter = google_parameter_manager_regional_parameter.regional-parameter-update.id
parameter_version_id = "tf_test_regional_parameter_version%{random_suffix}"
parameter_data = "regional-parameter-version-data"
Expand All @@ -68,11 +70,13 @@ resource "google_parameter_manager_regional_parameter_version" "regional-paramet
func testAccParameterManagerRegionalRegionalParameterVersion_update(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_parameter_manager_regional_parameter" "regional-parameter-update" {
provider = google-beta
parameter_id = "tf_test_regional_parameter%{random_suffix}"
location = "us-central1"
}
resource "google_parameter_manager_regional_parameter_version" "regional-parameter-version-update" {
provider = google-beta
parameter = google_parameter_manager_regional_parameter.regional-parameter-update.id
parameter_version_id = "tf_test_regional_parameter_version%{random_suffix}"
parameter_data = "regional-parameter-version-data"
Expand Down

0 comments on commit 348c9b8

Please sign in to comment.