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

Inspec: google_memcache_instance(s) fail with "argument out of range" #302

Closed
trickyearlobe opened this issue Jan 27, 2021 · 0 comments · Fixed by GoogleCloudPlatform/magic-modules#4439 or modular-magician/inspec-gcp#497

Comments

@trickyearlobe
Copy link

Describe the problem

Inspec resources google_memcache_instance and google_memcache_instances that are generated by Magic Modules fail with an argument out of range error if any memcached instances exist and get parsed by the Inspec resource. The problem doesn't occur if no instances exist.

Repro steps

Add a memcached instance to your GCP project

Create an Inspec profile that depends on inspec-gcp and add this control.

describe google_memcache_instances(beta: true , project: gcp_project_id, region: 'europe-west2') do
  its('count') { should be >= 1 }
end

Run the profile against your GCP project and see this error

Profile:         GCP InSpec Profile (gcp-test)
Version:         0.1.0
Failure Message: Failed to load source for controls/example2.rb: argument out of range
Target:          gcp://***********

     No tests executed.

Profile: Google Cloud Platform Resource Pack (inspec-gcp)
Version: 1.8.2
Target:  gcp://***********

     No tests executed.

Test Summary: 0 successful, 0 failures, 0 skipped

Root cause

The code incorrectly tries to parsediscoveryEndpoint as a Time type, but its actually a String type containing an ip:port

Possible Solution

Change the type of discoveryEnpoint from Time to String here

trickyearlobe pushed a commit to trickyearlobe/magic-modules that referenced this issue Jan 27, 2021
Fixes inspec/inspec-gcp#302
where the memcached discoveryEndpoint is parsed as a Time instead
of as a String (its an `ip:port` string)

Signed-off-by: Richard Nixon <[email protected]>
slevenick pushed a commit to GoogleCloudPlatform/magic-modules that referenced this issue Jan 27, 2021
#4439)

Fixes inspec/inspec-gcp#302
where the memcached discoveryEndpoint is parsed as a Time instead
of as a String (its an `ip:port` string)

Signed-off-by: Richard Nixon <[email protected]>
modular-magician added a commit to modular-magician/inspec-gcp that referenced this issue Jan 27, 2021
…t (#4439)

Fixes inspec#302
where the memcached discoveryEndpoint is parsed as a Time instead
of as a String (its an `ip:port` string)

Signed-off-by: Richard Nixon <[email protected]>
Signed-off-by: Modular Magician <[email protected]>
modular-magician added a commit to modular-magician/inspec-gcp that referenced this issue Jan 27, 2021
…t (#4439) (#497)

Fixes inspec#302
where the memcached discoveryEndpoint is parsed as a Time instead
of as a String (its an `ip:port` string)

Signed-off-by: Richard Nixon <[email protected]>
Signed-off-by: Modular Magician <[email protected]>
@slevenick slevenick mentioned this issue Jan 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant