-
Notifications
You must be signed in to change notification settings - Fork 37
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
Create application resource in framework #265
Create application resource in framework #265
Conversation
49aaf93
to
3c4f944
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, actually, big piece of work 💪 just need some small adjustments, and the tests need to be fixed. The QA was mostly good, bumped into that no name specified error, import worked well 👍
3c4f944
to
7a4ce21
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is essentially ready to go, though please fix the tests before merge.
I just re-ran the tests because I'm not getting the same errors locally, not sure if CI is outdated. Anyways, the QA went well, however, I'm getting the following error when I run TestAcc_ResourceApplication_sdk2_framework_migrate
locally.
resource_application_test.go:17: Step 6/6 error running import: ImportStateVerify attributes not equivalent. Difference is shown below. The - symbol indicates attributes missing after import.
map[string]string{
- "model": "tf-test-application-2356628633933833839",
- "name": "test-app",
}
--- FAIL: TestAcc_ResourceApplication_sdk2_framework_migrate (113.70s)
@cderici if the tests don't pass, we should be able to merge. and the button isn't green for me. |
7a4ce21
to
70a3a27
Compare
Move addClientNotConfiguredError there, create a intPtr method. Use for generic helper methods within the provider.
With the TF framework, there is no longer a need to handle config as a map[string]interface and do many convertions. Integers, strings and booleans can all be added to the plan as strings, then converted by the juju controller based on the actual config type defined by the charm.
b06748e
to
fbd9af9
Compare
force pushed to fix a merge conflict |
There are no changes to the schema. Introduce retry read application on not found error. With the sdk, we could call the readApplication method from createApplication method to fill in data only known after the application is deploy such as is principal and placement. With the framework this is not directly possible. Received application not found errors. The work around of setting values until the next read causes tests to fail. Introduced a ReadApplicationWithRetryOnNotFound method to ensure we get the application data if we know the application exists. Make a map before using, avoid assignment to nil map panics. Could happen if config is added, when it wasn't there before. Usually appeared on k8s, not machines.
a3d8ad4
to
6913c9e
Compare
squashed many of the commands for merging. the test failing due to a juju bug will be skipped for now and re-enabled when the bug is fixed. |
With microk8s due to juju bug. Once the the juju bug is fixed, it can be re-enabled. With LXD for the same issue on microk8s where ReplaceRequired in schema causing Delete/Create to happen too fast.
6913c9e
to
8aaa02a
Compare
Note - there are 2 acceptance tests failing right now, though I'm not sure why. I cannot reproduce outside of the
Description
Convert the application resource from using the terraform sdk to the newer framework. There is a small bug fix related to exposing an application without an application name specified in the plan.
This PR also adds use the
tflog
package for logging including using a tflog subsystem for granularity. Each resource and data source should have its own subsystem. For applications, log line will include"@module":"juju.resource-application"
. To setup:export TF_LOG_PROVIDER=TRACE ; export TF_LOG_PATH=./terraform.log
. Without the log path, logging will be printed within the normal terraform output.Includes a fix for:
#274 Provider panics when generating plan
Type of change
Environment
Juju controller version: 2.9.43
Terraform version: 0.8.0 next
QA steps
Here is a plan to test with. Also do import testing.
Notes
JUJU-4175
JUJU-4500