Skip to content

Commit

Permalink
Regenerate Projects TF to fix generated doc and samples (#4961)
Browse files Browse the repository at this point in the history
* fix integration test

* fix integration test

* fix integration test

* fix name

* pr comments

* pr comments

* fix doc

* fix doc

* new version

* new version

* new version

* new version

* update code to the latest SDK level

* fix integration tests

* fix integration tests

* fix integration tests

* fix integration tests

* address PR comment

* typo

* typo

* terraform

* terraform

* terraform

* terraform

* terraform

* terraform

* terraform

* terraform

* terraform

* terraform

* add wait for create and delete

* add wait for create and delete

* .

* fix integration tests

* fix integration tests

* fix integration tests

* fix integration tests

* fix integration tests

* regenerate

* new code generation

* new generated code

* point to latest sdk

* point to latest sdk

* adjust test cases and doc

* adjust samples

* update to latest node sdk

* merge with master

* Update project_instance.html.markdown

Fixing formatting issues

* Update project_event_notification.html.markdown

* Update README.md

* Update variables.tf

* Update project_event_notification.html.markdown

* new version

* terraform

* terraform

* terraform

* terraform

* terraform

* terraform

* terraform

* terraform

* terraform

* terraform

* feat: projects graph fragment pattern

* align with origin/master

* update test cases

* restore README.md and versions.tf to master branch

* remove duplicated entries

* feat: graph fragment pattern poc

* feat: restore definition blocks

* regenerate the terraform code based on latest YAML

* regenerate the terraform code based on latest YAML

* regenerate the terraform code based on latest YAML

* update doc

* update doc

* fix test cases

* commit generated code

* commit fix

* commit fix

* test cases

* test cases

* test cases

* test cases

* updates

* upgrade to latest go sdk

* update generated doc

* update generated code

* updated secrets baseline

* update code to latest API changes

* secrets

* fix secrets

* update samples with real values

* update secrets

* update secrets

* update generated code to the latest API definition

* update secrets baseline

* merge with master

* merge with master

* merge with master

* update code to the latest SDK level

* address some review comments

* address PR comments

* address PR comments

* update to latest sdk level

* update to latest sdk level

* update to latest sdk level

* merge with master

* update to the latest sdk level

* format test case

* regenerate the code with generator fixes

* regenerate code

* fix "inputs" and "settings" properties

---------

Co-authored-by: dvesperini <dvesperini@gmail.com>
Co-authored-by: knee-na <130502432+knee-na@users.noreply.github.com>
Co-authored-by: Mark-Kulube <markkulube@ibm.com>
  • Loading branch information
4 people committed Dec 8, 2023
1 parent de7b248 commit 1bb8e05
Show file tree
Hide file tree
Showing 15 changed files with 159 additions and 226 deletions.
44 changes: 17 additions & 27 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "go.mod|go.sum|.*.map|^.secrets.baseline$",
"lines": null
},
"generated_at": "2023-11-29T02:05:13Z",
"generated_at": "2023-12-05T09:48:48Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down Expand Up @@ -560,7 +560,7 @@
"hashed_secret": "06d988e96c3d9325c9fbc7c0ef3c6c0f2b4eb8e7",
"is_secret": false,
"is_verified": false,
"line_number": 45,
"line_number": 41,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down Expand Up @@ -794,39 +794,39 @@
"hashed_secret": "c427f185ddcb2440be9b77c8e45f1cd487a2e790",
"is_secret": false,
"is_verified": false,
"line_number": 1449,
"line_number": 1450,
"type": "Base64 High Entropy String",
"verified_result": null
},
{
"hashed_secret": "1f7e33de15e22de9d2eaf502df284ed25ca40018",
"is_secret": false,
"is_verified": false,
"line_number": 1516,
"line_number": 1517,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "1f614c2eb6b3da22d89bd1b9fd47d7cb7c8fc670",
"is_secret": false,
"is_verified": false,
"line_number": 3325,
"line_number": 3326,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "7abfce65b8504403afc25c9790f358d513dfbcc6",
"is_secret": false,
"is_verified": false,
"line_number": 3338,
"line_number": 3339,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "0c2d85bf9a9b1579b16f220a4ea8c3d62b2e24b1",
"is_secret": false,
"is_verified": false,
"line_number": 3379,
"line_number": 3380,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down Expand Up @@ -864,15 +864,15 @@
"hashed_secret": "c8b6f5ef11b9223ac35a5663975a466ebe7ebba9",
"is_secret": false,
"is_verified": false,
"line_number": 1807,
"line_number": 1815,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "8abf4899c01104241510ba87685ad4de76b0c437",
"is_secret": false,
"is_verified": false,
"line_number": 1813,
"line_number": 1821,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down Expand Up @@ -2876,15 +2876,15 @@
"hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4",
"is_secret": false,
"is_verified": false,
"line_number": 334,
"line_number": 335,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "92f08f2d9a0dc3f0d4cb3796435a48508cf59ecd",
"is_secret": false,
"is_verified": false,
"line_number": 654,
"line_number": 663,
"type": "Secret Keyword",
"verified_result": null
}
Expand All @@ -2904,15 +2904,15 @@
"hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4",
"is_secret": false,
"is_verified": false,
"line_number": 119,
"line_number": 120,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "92f08f2d9a0dc3f0d4cb3796435a48508cf59ecd",
"is_secret": false,
"is_verified": false,
"line_number": 293,
"line_number": 298,
"type": "Secret Keyword",
"verified_result": null
}
Expand All @@ -2932,15 +2932,15 @@
"hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4",
"is_secret": false,
"is_verified": false,
"line_number": 236,
"line_number": 237,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "92f08f2d9a0dc3f0d4cb3796435a48508cf59ecd",
"is_secret": false,
"is_verified": false,
"line_number": 884,
"line_number": 875,
"type": "Secret Keyword",
"verified_result": null
}
Expand All @@ -2960,15 +2960,15 @@
"hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4",
"is_secret": false,
"is_verified": false,
"line_number": 72,
"line_number": 73,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "92f08f2d9a0dc3f0d4cb3796435a48508cf59ecd",
"is_secret": false,
"is_verified": false,
"line_number": 504,
"line_number": 499,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down Expand Up @@ -4505,16 +4505,6 @@
"verified_result": null
}
],
"website/docs/r/logs_router_tenant.html.markdown": [
{
"hashed_secret": "d47dcacc720a39e236679ac3e311a0d58bb6519e",
"is_secret": false,
"is_verified": false,
"line_number": 78,
"type": "Secret Keyword",
"verified_result": null
}
],
"website/docs/r/metrics_router_route.html.markdown": [
{
"hashed_secret": "d47dcacc720a39e236679ac3e311a0d58bb6519e",
Expand Down
4 changes: 2 additions & 2 deletions examples/ibm-project/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ data "project" "project_instance" {
project_environment data source:

```hcl
data "ibm_project_environment" "project_environment_instance" {
project_id = ibm_project_environment.project_environment_instance.project_id
data "project_environment" "project_environment_instance" {
project_id = ibm_project.project_instance.id
project_environment_id = ibm_project_environment.project_environment_instance.project_environment_id
}
```
Expand Down
8 changes: 2 additions & 6 deletions examples/ibm-project/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@ resource "ibm_project_config" "project_config_instance" {
api_key = "<your_apikey_here>"
}
locator_id = "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.145be7c1-9ec4-4719-b586-584ee52fbed0-global"
input {
inputs = {
name = "app_repo_name"
}
setting {
name = "app_repo_name"
value = "static-website-dev-app-repo"
}
}
}

Expand Down Expand Up @@ -61,5 +57,5 @@ data "ibm_project" "project_instance" {
// Create project_environment data source
data "ibm_project_environment" "project_environment_instance" {
project_id = ibm_project.project_instance.id
project_environment_id = var.project_environment_project_environment_id
project_environment_id = ibm_project_environment.project_environment_instance.project_environment_id
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/IBM/logs-router-go-sdk v1.0.0
github.com/IBM/networking-go-sdk v0.42.2
github.com/IBM/platform-services-go-sdk v0.54.0
github.com/IBM/project-go-sdk v0.1.1
github.com/IBM/project-go-sdk v0.1.4
github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5
github.com/IBM/scc-go-sdk/v5 v5.1.3
github.com/IBM/schematics-go-sdk v0.2.2
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3
github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/DataDog/zstd v1.4.4/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/IBM-Cloud/bluemix-go v0.0.0-20231123082353-50e8cc9c6959 h1:dvvI4ybsYx6M7fFGrg3HjlNnYxEBi9jJdSU0JhjJbG8=
github.com/IBM-Cloud/bluemix-go v0.0.0-20231123082353-50e8cc9c6959/go.mod h1:jIGLnIfj+uBv2ALz3rVHzNbNwt0V/bEWNeJKECa8Q+k=
github.com/IBM-Cloud/bluemix-go v0.0.0-20231204080125-462fa9e436bc h1:AeooCa6UMWycgKJ9n0do9PEZaNlYZZHqspfwUzPvopc=
github.com/IBM-Cloud/bluemix-go v0.0.0-20231204080125-462fa9e436bc/go.mod h1:jIGLnIfj+uBv2ALz3rVHzNbNwt0V/bEWNeJKECa8Q+k=
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c h1:tRS4VuOG3lHNG+yrsh3vZZQDVNLuFJB0oZbTJp9YXds=
Expand Down Expand Up @@ -161,8 +159,8 @@ github.com/IBM/networking-go-sdk v0.42.2 h1:caqjx4jyFHi10Vlf3skHvlL6K3YJRVstsmCB
github.com/IBM/networking-go-sdk v0.42.2/go.mod h1:lTUZwtUkMANMnrLHFIgRhHrkBfwASY/Iho1fabaPHxo=
github.com/IBM/platform-services-go-sdk v0.54.0 h1:WjHWm9ZAJvlq07E1WXXtEe+d/B0sazWD6cEWVT7EMLU=
github.com/IBM/platform-services-go-sdk v0.54.0/go.mod h1:CWSprvsCsXWvujmBzbtoJSmbRZS9FVV3O594b0t/GiM=
github.com/IBM/project-go-sdk v0.1.1 h1:x1PkGUTkKpgxoXs/6IG4U1mk5BgaPEaRMVpXTs52rE4=
github.com/IBM/project-go-sdk v0.1.1/go.mod h1:lqe0M4cKvABI1iHR1b+KfasVcxQL6nl2VJ8eOyQs8Ig=
github.com/IBM/project-go-sdk v0.1.4 h1:QGehJxpp/QqfrBYSmN2FRYwuGejlHlVscB/9QGQfdLk=
github.com/IBM/project-go-sdk v0.1.4/go.mod h1:lqe0M4cKvABI1iHR1b+KfasVcxQL6nl2VJ8eOyQs8Ig=
github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 h1:NPUhkoOCRuv3OFWt19PmwjXGGTKlvmbuPg9fUrBUNe4=
github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5/go.mod h1:b07XHUVh0XYnQE9s2mqgjYST1h9buaQNqN4EcKhOsX0=
github.com/IBM/sarama v1.41.2 h1:ZDBZfGPHAD4uuAtSv4U22fRZBgst0eEwGFzLj0fb85c=
Expand Down
53 changes: 26 additions & 27 deletions ibm/service/project/data_source_ibm_project_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package project

import (
"context"
"encoding/json"
"fmt"
"log"

Expand Down Expand Up @@ -135,7 +136,7 @@ func DataSourceIbmProjectConfig() *schema.Resource {
"workspace_crn": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "An existing schematics workspace CRN.",
Description: "An IBM Cloud resource name, which uniquely identifies a resource.",
},
"validate_pre_script": &schema.Schema{
Type: schema.TypeList,
Expand Down Expand Up @@ -377,22 +378,22 @@ func DataSourceIbmProjectConfig() *schema.Resource {
"locator_id": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "A unique concatenation of catalogID.versionID that identifies the DA in the catalog.",
Description: "A unique concatenation of catalogID.versionID that identifies the DA in the catalog. Either schematics.workspace_crn, definition.locator_id, or both must be specified.",
},
"inputs": &schema.Schema{
Type: schema.TypeList,
Type: schema.TypeMap,
Computed: true,
Description: "The input variables for configuration definition and environment.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{},
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"settings": &schema.Schema{
Type: schema.TypeList,
Type: schema.TypeMap,
Computed: true,
Description: "Schematics environment variables to use to deploy the configuration.Settings are only available if they were specified when the configuration was initially created.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{},
Description: "Schematics environment variables to use to deploy the configuration. Settings are only available if they were specified when the configuration was initially created.",
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},
Expand Down Expand Up @@ -626,18 +627,26 @@ func dataSourceIbmProjectConfigProjectConfigResponseDefinitionToMap(model *proje
}
modelMap["locator_id"] = model.LocatorID
if model.Inputs != nil {
inputsMap, err := dataSourceIbmProjectConfigInputVariableToMap(model.Inputs)
if err != nil {
return modelMap, err
inputs := make(map[string]interface{})
for k, v := range model.Inputs {
bytes, err := json.Marshal(v)
if err != nil {
return modelMap, err
}
inputs[k] = string(bytes)
}
modelMap["inputs"] = []map[string]interface{}{inputsMap}
modelMap["inputs"] = inputs
}
if model.Settings != nil {
settingsMap, err := dataSourceIbmProjectConfigProjectConfigSettingToMap(model.Settings)
if err != nil {
return modelMap, err
settings := make(map[string]interface{})
for k, v := range model.Settings {
bytes, err := json.Marshal(v)
if err != nil {
return modelMap, err
}
settings[k] = string(bytes)
}
modelMap["settings"] = []map[string]interface{}{settingsMap}
modelMap["settings"] = settings
}
return modelMap, nil
}
Expand Down Expand Up @@ -675,13 +684,3 @@ func dataSourceIbmProjectConfigProjectComplianceProfileToMap(model *projectv1.Pr
}
return modelMap, nil
}

func dataSourceIbmProjectConfigInputVariableToMap(model *projectv1.InputVariable) (map[string]interface{}, error) {
modelMap := make(map[string]interface{})
return modelMap, nil
}

func dataSourceIbmProjectConfigProjectConfigSettingToMap(model *projectv1.ProjectConfigSetting) (map[string]interface{}, error) {
modelMap := make(map[string]interface{})
return modelMap, nil
}
4 changes: 2 additions & 2 deletions ibm/service/project/data_source_ibm_project_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ func testAccCheckIbmProjectConfigDataSourceConfigBasic() string {
authorizations {
method = "api_key"
api_key = "%s"
}
locator_id = "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.cd596f95-95a2-4f21-9b84-477f21fd1e95-global"
}
locator_id = "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.cd596f95-95a2-4f21-9b84-477f21fd1e95-global"
}
lifecycle {
ignore_changes = [
Expand Down
24 changes: 12 additions & 12 deletions ibm/service/project/data_source_ibm_project_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package project

import (
"context"
"encoding/json"
"fmt"
"log"

Expand Down Expand Up @@ -126,11 +127,11 @@ func DataSourceIbmProjectEnvironment() *schema.Resource {
},
},
"inputs": &schema.Schema{
Type: schema.TypeList,
Type: schema.TypeMap,
Computed: true,
Description: "The input variables for configuration definition and environment.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{},
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"compliance_profile": &schema.Schema{
Expand Down Expand Up @@ -265,11 +266,15 @@ func dataSourceIbmProjectEnvironmentEnvironmentDefinitionRequiredPropertiesToMap
modelMap["authorizations"] = []map[string]interface{}{authorizationsMap}
}
if model.Inputs != nil {
inputsMap, err := dataSourceIbmProjectEnvironmentInputVariableToMap(model.Inputs)
if err != nil {
return modelMap, err
inputs := make(map[string]interface{})
for k, v := range model.Inputs {
bytes, err := json.Marshal(v)
if err != nil {
return modelMap, err
}
inputs[k] = string(bytes)
}
modelMap["inputs"] = []map[string]interface{}{inputsMap}
modelMap["inputs"] = inputs
}
if model.ComplianceProfile != nil {
complianceProfileMap, err := dataSourceIbmProjectEnvironmentProjectComplianceProfileToMap(model.ComplianceProfile)
Expand All @@ -295,11 +300,6 @@ func dataSourceIbmProjectEnvironmentProjectConfigAuthToMap(model *projectv1.Proj
return modelMap, nil
}

func dataSourceIbmProjectEnvironmentInputVariableToMap(model *projectv1.InputVariable) (map[string]interface{}, error) {
modelMap := make(map[string]interface{})
return modelMap, nil
}

func dataSourceIbmProjectEnvironmentProjectComplianceProfileToMap(model *projectv1.ProjectComplianceProfile) (map[string]interface{}, error) {
modelMap := make(map[string]interface{})
if model.ID != nil {
Expand Down

0 comments on commit 1bb8e05

Please sign in to comment.