Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:exposed visibility value for the provider in the DA #921

Merged
merged 15 commits into from
Dec 9, 2024

Conversation

Aditya-ranjan-16
Copy link
Contributor

@Aditya-ranjan-16 Aditya-ranjan-16 commented Nov 29, 2024

Description

exposed visibility value for the provider in the DA , with default value set to "private"

Git issue

Release required?

  • No release
  • Patch release (x.x.X)
  • Minor release (x.X.x)
  • Major release (X.x.x)
Release notes content

exposes visibility value for the provider in the DA

Run the pipeline

If the CI pipeline doesn't run when you create the PR, the PR requires a user with GitHub collaborators access to run the pipeline.

Run the CI pipeline when the PR is ready for review and you expect tests to pass. Add a comment to the PR with the following text:

/run pipeline

Checklist for reviewers

  • If relevant, a test for the change is included or updated with this PR.
  • If relevant, documentation for the change is included or updated with this PR.

For mergers

  • Use a conventional commit message to set the release level. Follow the guidelines.
  • Include information that users need to know about the PR in the commit message. The commit message becomes part of the GitHub release notes.
  • Use the Squash and merge option.

@Aditya-ranjan-16
Copy link
Contributor Author

/run pipeline

@ocofaigh
Copy link
Member

Similar to IBM-Cloud/terraform-provider-ibm#5828 it seems the provider being set to private is not supported for the ibm_is_vpc data lookup. We need to sync with provider team on this. For now, I think we need to default to public and add a code comment to the provider issue as to why we are setting to public...

2024-11-29T12:18:49.2570973Z TestRunVsiExtention 2024-11-29T12:18:49Z logger.go:66: �[31m│�[0m �[0m�[1m�[31mError: �[0m�[0m�[1m[ERROR] Error Fetching vpc An error occurred while performing the 'authenticate' step: Post "https://private.iam.cloud.ibm.com/identity/token": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
2024-11-29T12:18:49.2573134Z TestRunVsiExtention 2024-11-29T12:18:49Z logger.go:66: �[31m│�[0m �[0mnull
2024-11-29T12:18:49.2574034Z TestRunVsiExtention 2024-11-29T12:18:49Z logger.go:66: �[31m│�[0m �[0m�[0m
2024-11-29T12:18:49.2574890Z TestRunVsiExtention 2024-11-29T12:18:49Z logger.go:66: �[31m│�[0m �[0m
2024-11-29T12:18:49.2575954Z TestRunVsiExtention 2024-11-29T12:18:49Z logger.go:66: �[31m│�[0m �[0m�[0m  with data.ibm_is_vpc.vpc_by_id,
2024-11-29T12:18:49.2577255Z TestRunVsiExtention 2024-11-29T12:18:49Z logger.go:66: �[31m│�[0m �[0m  on main.tf line 25, in data "ibm_is_vpc" "vpc_by_id":
2024-11-29T12:18:49.2578613Z TestRunVsiExtention 2024-11-29T12:18:49Z logger.go:66: �[31m│�[0m �[0m  25: data "ibm_is_vpc" "vpc_by_id" �[4m{�[0m�[0m
2024-11-29T12:18:49.2580019Z TestRunVsiExtention 2024-11-29T12:18:49Z logger.go:66: �[31m│�[0m �[0m
2024-11-29T12:18:49.2580970Z TestRunVsiExtention 2024-11-29T12:18:49Z logger.go:66: �[31m│�[0m �[0m---

@Aditya-ranjan-16
Copy link
Contributor Author

/run pipeline

@Aditya-ranjan-16
Copy link
Contributor Author

/run pipeline

@Aditya-ranjan-16
Copy link
Contributor Author

/run pipeline

@Aditya-ranjan-16
Copy link
Contributor Author

/run pipeline

@Aditya-ranjan-16
Copy link
Contributor Author

/run pipeline

@Aditya-ranjan-16
Copy link
Contributor Author

Skipping the upgrade test as provider_visibility is being added to the upgrade test and main branch doesn't have this yet.

2024-12-03T19:15:03.3850411Z TestRunUpgradeROKSQuickStartPattern 2024-12-03T19:15:03Z logger.go:66: �[31m╷�[0m�[0m
2024-12-03T19:15:03.3851726Z TestRunUpgradeROKSQuickStartPattern 2024-12-03T19:15:03Z logger.go:66: �[31m│�[0m �[0m�[1m�[31mError: �[0m�[0m�[1mValue for undeclared variable�[0m
2024-12-03T19:15:03.3852623Z TestRunUpgradeROKSQuickStartPattern 2024-12-03T19:15:03Z logger.go:66: �[31m│�[0m �[0m
2024-12-03T19:15:03.3853794Z TestRunUpgradeROKSQuickStartPattern 2024-12-03T19:15:03Z logger.go:66: �[31m│�[0m �[0m�[0mA variable named "provider_visibility" was assigned on the command line,
2024-12-03T19:15:03.3854846Z TestRunUpgradeROKSQuickStartPattern 2024-12-03T19:15:03Z logger.go:66: �[31m│�[0m �[0mbut the root module does not declare a variable of that name. To use this
2024-12-03T19:15:03.3855810Z TestRunUpgradeROKSQuickStartPattern 2024-12-03T19:15:03Z logger.go:66: �[31m│�[0m �[0mvalue, add a "variable" block to the configuration.
2024-12-03T19:15:03.3856822Z TestRunUpgradeROKSQuickStartPattern 2024-12-03T19:15:03Z logger.go:66: �[31m╵�[0m�[0m

@Aditya-ranjan-16
Copy link
Contributor Author

/run pipeline

1 similar comment
@Aditya-ranjan-16
Copy link
Contributor Author

/run pipeline

@ocofaigh
Copy link
Member

ocofaigh commented Dec 4, 2024

@Aditya-ranjan-16 Apologies, but looking at this again the tests that failed were TestRunVsiExtention, TestRunOverride, TestRunUpgradeQuickStartPattern and TestRunUpgradeROKSQuickStartPattern. None of these tests run in schematics, which means none of them have access to the private endpoints here. So for those specific tests, you need to set the provider visibility back to "public" in order for those to pass.

So can you:

  1. Set the default back to private
  2. In the test I mentioned above, set it explicitly to "public". You will also need to do this for all the tests in the other_test.go file
  3. You will need to also update all the entries in the cra-config.yaml to use pubic too

…y(= public) in test functions and cra-config
@Aditya-ranjan-16
Copy link
Contributor Author

/run pipeline

@Aditya-ranjan-16
Copy link
Contributor Author

@ocofaigh pipeline is filing with the following error

TestRunVsiExtention 2024-12-04T18:09:13Z logger.go:66: ╷
TestRunVsiExtention 2024-12-04T18:09:13Z logger.go:66: │ Error: Value for undeclared variable
TestRunVsiExtention 2024-12-04T18:09:13Z logger.go:66: │ 
TestRunVsiExtention 2024-12-04T18:09:13Z logger.go:66: │ A variable named "provider_visibility" was assigned on the command line,
TestRunVsiExtention 2024-12-04T18:09:13Z logger.go:66: │ but the root module does not declare a variable of that name. To use this
TestRunVsiExtention 2024-12-04T18:09:13Z logger.go:66: │ value, add a "variable" block to the configuration.
TestRunVsiExtention 2024-12-04T18:09:13Z logger.go:66: ╵
TestRunVsiExtention 2024-12-04T18:09:13Z retry.go:99: Returning due to fatal error: FatalError{Underlying: error while running command: exit status 1; ╷
│ Error: Value for undeclared variable
│ 
│ A variable named "provider_visibility" was assigned on the command line,
│ but the root module does not declare a variable of that name. To use this
│ value, add a "variable" block to the configuration.
╵}

I checked and found TestRunVsiExtention function maybe is only dealing with the directory "/patterns/vpc" and I have added provider_visibility in these 3 only : roks-quickstart , vsi-extention , vsi-quickstart. as only these had a provider.tf file in them , do I need to add provider.tf in all the sub-folders of the patterns directory ? please advise.

@ocofaigh
Copy link
Member

ocofaigh commented Dec 5, 2024

@Aditya-ranjan-16 Yea sorry landing zone is a little different to our other DAs. There are 3 offerings, and some with multiple variations. So the following need to be updated:

VSI offering - 3 variations:

  • patterns/vsi/main.tf
  • /patterns/vsi-quickstart/provider.tf
  • /patterns/vsi-extension/provider.tf

VPC offering - 1 variation:

  • /patterns/vpc/main.tf

OCP (roks) offering - 2 variations:

  • /patterns/roks/main.tf
  • /roks-quickstart/provider.tf

@Aditya-ranjan-16
Copy link
Contributor Author

/run pipeline

Copy link
Member

@ocofaigh ocofaigh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not be changing the visibility to public in any test that runs in schematics. We want it to use private in schematics, otherwise we have a test gap

@Aditya-ranjan-16
Copy link
Contributor Author

/run pipeline

@Aditya-ranjan-16
Copy link
Contributor Author

TestRunROKSQuickStartPatternSchematics failing with the following error :

2024/12/05 18:45:23 Terraform apply | Error: [ERROR] Error creating resource group: Failed to get account information. with response code  {
 2024/12/05 18:45:23 Terraform apply |     "StatusCode": 500,
 2024/12/05 18:45:23 Terraform apply |     "Headers": {
 2024/12/05 18:45:23 Terraform apply |         "Content-Length": [
 2024/12/05 18:45:23 Terraform apply |             "181"
 2024/12/05 18:45:23 Terraform apply |         ],

TestRunVPCPatternSchematics failing with :

 2024/12/05 19:18:35 Terraform destroy | Error: [ERROR] Error Deleting resource group: Resource groups with active instances can't be deleted. Use the CLI command "ibmcloud resource service-instances --type all -g <resource-group>" to check for remaining instances, then delete the instances and try again. with response code  {
 2024/12/05 19:18:35 Terraform destroy |     "StatusCode": 500,
 2024/12/05 19:18:35 Terraform destroy |     "Headers": {
 2024/12/05 19:18:35 Terraform destroy |         "Content-Length": [
 2024/12/05 19:18:35 Terraform destroy |             "332"
 2024/12/05 19:18:35 Terraform destroy |         ],

@ocofaigh
Copy link
Member

ocofaigh commented Dec 6, 2024

The TestRunROKSQuickStartPatternSchematics test failed during apply in this schematics workspace with the error:

2024/12/05 18:45:23 Terraform apply | ---
 2024/12/05 18:45:23 Terraform apply | id: terraform-1b75c02c
 2024/12/05 18:45:23 Terraform apply | summary: |
 2024/12/05 18:45:23 Terraform apply |   [ERROR] Error creating resource group: Failed to get account information. with response code  {
 2024/12/05 18:45:23 Terraform apply |       "StatusCode": 500,
 2024/12/05 18:45:23 Terraform apply |       "Headers": {
 2024/12/05 18:45:23 Terraform apply |           "Content-Length": [
 2024/12/05 18:45:23 Terraform apply |               "181"
 2024/12/05 18:45:23 Terraform apply |           ],
 2024/12/05 18:45:23 Terraform apply |           "Content-Type": [
 2024/12/05 18:45:23 Terraform apply |               "application/json; charset=utf-8"
 2024/12/05 18:45:23 Terraform apply |           ],
 2024/12/05 18:45:23 Terraform apply |           "Date": [
 2024/12/05 18:45:23 Terraform apply |               "Thu, 05 Dec 2024 18:45:23 GMT"
 2024/12/05 18:45:23 Terraform apply |           ],
 2024/12/05 18:45:23 Terraform apply |           "Etag": [
 2024/12/05 18:45:23 Terraform apply |               "W/\"b5-g1ics8Xd09JM33cLiGd8IssPA9c\""
 2024/12/05 18:45:23 Terraform apply |           ],
 2024/12/05 18:45:23 Terraform apply |           "Server": [
 2024/12/05 18:45:23 Terraform apply |               "istio-envoy"
 2024/12/05 18:45:23 Terraform apply |           ],
 2024/12/05 18:45:23 Terraform apply |           "Strict-Transport-Security": [
 2024/12/05 18:45:23 Terraform apply |               "max-age=31536000; includeSubDomains"
 2024/12/05 18:45:23 Terraform apply |           ],
 2024/12/05 18:45:23 Terraform apply |           "Transaction-Id": [
 2024/12/05 18:45:23 Terraform apply |               "54e661a4-d51c-4699-a1a3-d371095e4cc3"
 2024/12/05 18:45:23 Terraform apply |           ],
 2024/12/05 18:45:23 Terraform apply |           "Vary": [
 2024/12/05 18:45:23 Terraform apply |               "Accept-Encoding"
 2024/12/05 18:45:23 Terraform apply |           ],
 2024/12/05 18:45:23 Terraform apply |           "X-Content-Type-Options": [
 2024/12/05 18:45:23 Terraform apply |               "nosniff"
 2024/12/05 18:45:23 Terraform apply |           ],
 2024/12/05 18:45:23 Terraform apply |           "X-Envoy-Upstream-Service-Time": [
 2024/12/05 18:45:23 Terraform apply |               "697"
 2024/12/05 18:45:23 Terraform apply |           ],
 2024/12/05 18:45:23 Terraform apply |           "X-Ratelimit-Limit": [
 2024/12/05 18:45:23 Terraform apply |               "60"
 2024/12/05 18:45:23 Terraform apply |           ],
 2024/12/05 18:45:23 Terraform apply |           "X-Ratelimit-Remaining": [
 2024/12/05 18:45:23 Terraform apply |               "59"
 2024/12/05 18:45:23 Terraform apply |           ],
 2024/12/05 18:45:23 Terraform apply |           "X-Ratelimit-Reset": [
 2024/12/05 18:45:23 Terraform apply |               "0"
 2024/12/05 18:45:23 Terraform apply |           ],
 2024/12/05 18:45:23 Terraform apply |           "X-Request-Id": [
 2024/12/05 18:45:23 Terraform apply |               "54e661a4-d51c-4699-a1a3-d371095e4cc3"
 2024/12/05 18:45:23 Terraform apply |           ],
 2024/12/05 18:45:23 Terraform apply |           "X-Response-Time": [
 2024/12/05 18:45:23 Terraform apply |               "630.318ms"
 2024/12/05 18:45:23 Terraform apply |           ],
 2024/12/05 18:45:23 Terraform apply |           "_request_id": [
 2024/12/05 18:45:23 Terraform apply |               "54e661a4-d51c-4699-a1a3-d371095e4cc3"
 2024/12/05 18:45:23 Terraform apply |           ]
 2024/12/05 18:45:23 Terraform apply |       },
 2024/12/05 18:45:23 Terraform apply |       "Result": {
 2024/12/05 18:45:23 Terraform apply |           "errors": [
 2024/12/05 18:45:23 Terraform apply |               {
 2024/12/05 18:45:23 Terraform apply |                   "code": "GENERIC_ERROR",
 2024/12/05 18:45:23 Terraform apply |                   "message": "Failed to get account information.",
 2024/12/05 18:45:23 Terraform apply |                   "more_info": "Dependency Code: Account Management"
 2024/12/05 18:45:23 Terraform apply |               }
 2024/12/05 18:45:23 Terraform apply |           ],
 2024/12/05 18:45:23 Terraform apply |           "trace": "54e661a4-d51c-4699-a1a3-d371095e4cc3"
 2024/12/05 18:45:23 Terraform apply |       },
 2024/12/05 18:45:23 Terraform apply |       "RawResult": null
 2024/12/05 18:45:23 Terraform apply |   }
 2024/12/05 18:45:23 Terraform apply | severity: error
 2024/12/05 18:45:23 Terraform apply | resource: ibm_resource_group
 2024/12/05 18:45:23 Terraform apply | operation: create
 2024/12/05 18:45:23 Terraform apply | component:
 2024/12/05 18:45:23 Terraform apply |   name: github.com/IBM-Cloud/terraform-provider-ibm
 2024/12/05 18:45:23 Terraform apply |   version: 1.71.1
 2024/12/05 18:45:23 Terraform apply | ---

Its possible this was a once off and doesn't seem related to changes in this PR.

The TestRunVPCPatternSchematics test failed during destroy in this schematics workspace with the error:

 2024/12/05 19:18:35 Terraform destroy |       "Result": {
 2024/12/05 19:18:35 Terraform destroy |           "errors": [
 2024/12/05 19:18:35 Terraform destroy |               {
 2024/12/05 19:18:35 Terraform destroy |                   "code": "NOT_EMPTY",
 2024/12/05 19:18:35 Terraform destroy |                   "message": "Resource groups with active instances can't be deleted. Use the CLI command \"ibmcloud resource service-instances --type all -g \u003cresource-group\u003e\" to check for remaining instances, then delete the instances and try again.",
 2024/12/05 19:18:35 Terraform destroy |                   "more_info": "n/a"
 2024/12/05 19:18:35 Terraform destroy |               }
 2024/12/05 19:18:35 Terraform destroy |           ],

As per the error message above, I ran the command against the resource group that failed to destroy, and it does seem as if some how there is still an active KMS instance in it:

 % ic resource service-instances -g vpc-sc-wx8n7x-service-rg --type all
Retrieving instances with all types in resource group vpc-sc-wx8n7x-service-rg in all locations under account GoldenEye GoldenEye Development's Account as [email protected]...
OK
Name                    Location   State    Type               Resource Group ID
vpc-sc-wx8n7x-slz-kms   jp-tok     active   service_instance   9a28232c2fa248968530f4ab5d4fc390

This should have deleted by the destroy so no idea why it still exists.

Both these issues are unrelated to the changes in this Pr, so going to re-run pipeline

@ocofaigh
Copy link
Member

ocofaigh commented Dec 6, 2024

/run pipeline

@Aditya-ranjan-16
Copy link
Contributor Author

/run pipeline

@ocofaigh ocofaigh merged commit a6c87a4 into main Dec 9, 2024
2 checks passed
@ocofaigh ocofaigh deleted the provider_visibility branch December 9, 2024 10:03
@terraform-ibm-modules-ops
Copy link
Contributor

🎉 This PR is included in version 6.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[terraform-ibm-landing-zone] Expose provider visibility in the DA
3 participants